code
stringlengths
3
1.01M
repo_name
stringlengths
5
116
path
stringlengths
3
311
language
stringclasses
30 values
license
stringclasses
15 values
size
int64
3
1.01M
# -*- coding: utf8 -*- import subprocess import os from pathlib import Path cwd = os.getcwd() try: print(os.getcwd()) subprocess.call(['make']) # res = subprocess.check_output('uname -a',shell=True) res = subprocess.check_output( r"./darknet detector test cfg/coco.data cfg/yolo.cfg yolo.weights /home/zaki/NoooDemo/0001.jpg", shell=True) except Exception as ex: print(ex) finally: os.chdir(cwd) print(res) def main() -> None: pass if __name__ == '__main__': main()
umyuu/Sample
src/Python3/Q113190/exsample.py
Python
mit
512
--- layout: post title: "Altium Designer Design Tipps" date: 2017-03-06 08:00 categories: Altium-designer permalink: /posts/altium-designer --- ![](https://hakandilek.github.io/layout-pcb.de/static/img/2017-03-06/0.AltiumDesigner.png) # CAD Systeme - Altium Designer Design Tipps *Einführung und Designtips* <!--more--> ## Templates * Die Templates werden über Preferences &rarr; System &rarr; New Document Defaults eingestellt. * PCB Project und Free Documents sollen verlinkt werden. ![](https://hakandilek.github.io/layout-pcb.de/static/img/2017-03-06/1.Templates.png) ## Libraries * Die Libraries werden Preferences &rarr; Data Management &rarr; Installed Libraries gewählt. * Durch viele lokale Libraries und Libraries am Server arbeitet Altium Langsamer. Daher können sie deaktiviert werden, wenn man sie gerade nicht braucht oder es wird empfohlen SVN zu nutzen und die Kopie lokal abzuspeichern. ![](https://hakandilek.github.io/layout-pcb.de/static/img/2017-03-06/2.Libraries.png) ## Schematic Template * In einem Schematic Template können die Texte Automatisch, Local oder Global geändert werden. * **Automatischen Wert:** z.B. DrawnDate &rarr; wenn man die Seite speichert, bekommt das aktuelle Datum automatisch. * **Local Werte:** z.B DrawnName, Checked–Date und –Name, Module &rarr; Rechte Maus Taste &rarr; Options &rarr; Document Parameters. * **Global Werte:** z.B. Project, Component und DrawingNumber &rarr; Project Options &rarr; Parameters ![](https://hakandilek.github.io/layout-pcb.de/static/img/2017-03-06/3.SchematicTemplate.png) * Wenn man die Parameters in mehreren Seiten auf Einmal ändern will * &rarr; Tools &rarr; Parameter Manager ![](https://hakandilek.github.io/layout-pcb.de/static/img/2017-03-06/3.SchematicTemplate2.png) * Wenn die Parameters geändert wird, wird danach bestätigt. * Accept Changes (Create ECO) &rarr; Execute Changes &rarr; Close ![](https://hakandilek.github.io/layout-pcb.de/static/img/2017-03-06/3.SchematicTemplate3.png) ## Workspace Panels * Unten auf der Rechteseite des Editors. * Die Menus unter diese Panels, könnte beliebig ein- und aus- geblendet werden. ![](https://hakandilek.github.io/layout-pcb.de/static/img/2017-03-06/4.WorkspacePanels.png) ### Libraries * Die Installierte Libraries werden hier auftauchen. Man kann direkt hier weitere Libraries hinzufügen oder deaktivieren. * Die angelegte Bauteile in der Libraries könnte hier gefunden werden. ![](https://hakandilek.github.io/layout-pcb.de/static/img/2017-03-06/5.WorkspacePanels-Libraries.png) * Librarycolumns werden beliebig gewählt. * Alle Parameters in Bauteile können als Column dargestellt werden. ![](https://hakandilek.github.io/layout-pcb.de/static/img/2017-03-06/5.WorkspacePanels-Libraries2.png) ### Joker Suche in Libraries * Die Bauteilliste kann für jede Column nach der Reihe sortiert und gesucht werden. * Wenn man etwas in den Suchbalken ohne „Stern“ schreibt, sucht das Programm nur die Wörter, die am Satzanfang stehen. * Setzt man einen Stern (*) vor das gesuchte Wort, so findet er alle Wörter, die in der Library stehen. * Wenn man mehrere Wörter gleichzeitig sucht, setzt man für jedes gesuchte Wort einen Stern davor (*Wort1*, *Wort2*) so findet er alle Wörter, die in der Library stehen. ![](https://hakandilek.github.io/layout-pcb.de/static/img/2017-03-06/6.JockerSuche.png) ### To-Do * Wird in Projektdatei gespeichert. * Keine extra Datei. * &rarr; Recte Maus Taste in To-Do &rarr; Add Project To-Do Item ![](https://hakandilek.github.io/layout-pcb.de/static/img/2017-03-06/7.Todo.png) * Man kann die Arbeit zuweisen und Kategorie wählen. * Wenn die Arbeit erledigt wird, kann man es abhaken. ![](https://hakandilek.github.io/layout-pcb.de/static/img/2017-03-06/7.Todo2.png) ### Supplier Search * Altium sucht Bauteile nur bei Mouser, Digi-Key, Farnell und TME. (Europäische Lieferanten) * Newark, ODBC, Arrow und Allied sind auch vorhanden. (nicht Europäische Lieferanten ) * Die Suche nach folgende Parameter sortiert werden. ![](https://hakandilek.github.io/layout-pcb.de/static/img/2017-03-06/8.SupplierSearch.png) ### Snippets * Wiederholte Schaltpläne oder Layouts in Unterschiedliche Projekten könnte in einem Bibliothek gespeichert werden. * Die Schaltplanteile können einfach in Snippets Bibliothek hinzugefügt werden. * Selektrieren &rarr; Rechtemaustaste &rarr; Snippets &rarr; Create Snippet from selcted objects ## Netzclass Definieren * Die besondere Leitungen oder Pfade könnte man mit Netzclassen spezifiziert. * Z.B: man kann Luft und Kriechstrecken, Ströme, HV… definieren. ![](https://hakandilek.github.io/layout-pcb.de/static/img/2017-03-06/9.Netzclass.png) * Die Netzclassen könnte unterschiedliche Eigenschaften haben. * Unterschiedliche Netzclassen könnte gleiche Eigenschaften haben. ![](https://hakandilek.github.io/layout-pcb.de/static/img/2017-03-06/9.Netzclass2.png) ![](https://hakandilek.github.io/layout-pcb.de/static/img/2017-03-06/9.Netzclass3.png) ## text * die Taste Einfugen auf einem Text ![](https://hakandilek.github.io/layout-pcb.de/static/img/2017-03-06/10.Text.png) * STRG + Signal klicken ![](https://hakandilek.github.io/layout-pcb.de/static/img/2017-03-06/10.Text2.png) ## Footprint Manager * Das Gleiche Bauteil kann unterschiedliche Footprint haben. Die Anpassung oder Kontrolle werden über Footprint Manager geschafft. * Tools &rarr; footprint Manager * Linke Fenster: Bauteile Wählen * Rechte Fenster: aktuelle Footprint abhaken. * Rechte Maustaste &rarr; Set as Current ![](https://hakandilek.github.io/layout-pcb.de/static/img/2017-03-06/11.FootprintManager.png) ## Annotate * Wenn es einmal eingestellt wird, kann Annotate Quickly Funktion verwendet werden. * Start Index: soll immer von 100 starten. * Suffix: zusätzlich Designator- Kennzeichen am Hinten. ![](https://hakandilek.github.io/layout-pcb.de/static/img/2017-03-06/12.Annotate.png) * Reset Dupplicate Schematic Designator: Löscht doppel Bauteil Designatornummer. ![](https://hakandilek.github.io/layout-pcb.de/static/img/2017-03-06/12.Annotate2.png) ## Cross Probe * Wenn in der PCB Datei Bauteile gesucht werden, wird diese Funktion verwendet. * Tools&rarr; Cross Probe &rarr; wird gesuchte Bauteil selektiert, erscheint in der PCB Datei. * Auch von der PCB Datei wird Bauteile im Schaltplan gesucht. ![](https://hakandilek.github.io/layout-pcb.de/static/img/2017-03-06/14.CrossProbe.png) ![](https://hakandilek.github.io/layout-pcb.de/static/img/2017-03-06/14.CrossProbe2.png) ## Connection Matrix * Erreichbar unter Project &rarr; Project options * Einstellung von Sheet Entry, Port und Pin Verbindungen * z.B: wenn Input Port mit Input Pin verbindet. Nets with no driving source * Default wurde VCC und GND Power, alle andere Pins als Passive dargestellt. ![](https://hakandilek.github.io/layout-pcb.de/static/img/2017-03-06/15.ConnectionMatrix.png) ## Harness * Unterschiedliche oder Gleiche Namen * Extra Page Connector * Bus: Wenn Signal sich wiederholt * Harness Connector: beinhaltet Bus und Harness connectoren. ![](https://hakandilek.github.io/layout-pcb.de/static/img/2017-03-06/16.Harness.png) * Harness kann kaskadiert werden. * ein Harness-Connector mehr Mals mit unterschiedlichen Ports verwendet werden ![](https://hakandilek.github.io/layout-pcb.de/static/img/2017-03-06/16.Harness2.png) ## Empfehlungen * Schematics Grid soll mindestens auf 5 stehen. Kleiner als 5 ist Gefahr dass die Pins nicht richtig angeschlossen werden. Taste G = Grid Wechseln. * Man soll die Bauteilwerte nie im Schematik ändern. Wenn sie geändert werden muss, werden sie nur über Bibliotheken geändert und vom Schaltplan aktualisiert * 4 Knoten Punkt soll man nicht verwenden. Wenn muss, dann mit Manuel Junction verwenden. * Man kann jeden Parameter vom Bauteil im Schaltplan ein- und aus- blenden.
hakandilek/layout-pcb.de
_posts/2017-03-06-CAD-Systeme-Altium-Designer.md
Markdown
mit
8,041
package main import "strings" //CreateCommand is a factory method that returns the command that //is infered from the passed command line arguments. func CreateCommand(args []string, translator Translator) Command { if args == nil || len(args) == 0 { return new(OverviewCommand) } count := len(args) command := strings.ToLower(args[0]) switch command { case "all": return NewAllCommand(translator) case "delete": if count == 2 { //Delete list return NewDeleteListCommand(args[1]) } else if count == 3 { //Delete list item return NewDeleteListEntryCommand(args[1], args[2]) } else { //Do nothing. return nil } case "open": if count == 2 { //Open all in a list. return NewOpenListCommand(args[1]) } else if count == 3 { //Open a specific entry. return NewOpenListEntryCommand(args[1], args[2]) } case "random": if count == 1 { return NewRandomEntryCommand() } else if count == 2 { return NewRandomSpecificEntryCommand(args[1]) } case "echo": if count == 2 { return NewEchoEntryCommand(args[1]) } return NewEchoSpecificEntryCommand(args[1], args[2]) case "copy": if count == 2 { return NewCopyEntryCommand(args[1]) } return NewCopySpecificEntryCommand(args[1], args[2]) default: return NewCatchAllCommand(args, translator) } return nil }
jamesmillerio/goboom
commandfactory.go
GO
mit
1,321
// var knexConfig = require('../knexfile') // var knex = require('knex')(knexConfig[process.env.NODE_ENV || "development"]) var knex = require('./knexOrigin') module.exports = { createEvent: (eventObj, cb) => { knex('events').insert(eventObj) .then( (data) => cb(null, data[0]) ) .catch( (err) => cb(err) ) }, getEventById: (eventId, cb) => { knex.select().where("id", eventId).table("events") .then( (data) => cb(null, data[0]) ) .catch( (err) => cb(err) ) }, getEventsByHostId: (userId, cb) => { knex('hosts').select() .join('events', 'hosts.eventId', '=', 'events.id') .where('hosts.userId', userId) .then( (data) => cb(null, data) ) .catch( (err) => cb(err) ) }, getEventsByGuestId: (userId, cb) => { knex('guests').select() .join('events', 'guests.eventId', '=', 'events.id') .where('guests.userId', userId) .then( (data) => cb(null, data) ) .catch( (err) => cb(err) ) }, updateEvent: (eventId, eventChanges, cb) => { knex('events').update(eventChanges).where('id', eventId) .then( (data) => cb(null, data[0]) ) .catch( (err) => cb(err) ) } }
James-Sangalli/DishOut
db/events.js
JavaScript
mit
1,179
/* * This file is part of Nucleus, licensed under the MIT License (MIT). See the LICENSE.txt file * at the root of this project for more details. */ package io.github.nucleuspowered.nucleus.modules.admin.commands.gamemode; import io.github.nucleuspowered.nucleus.modules.admin.AdminPermissions; import io.github.nucleuspowered.nucleus.core.scaffold.command.ICommandContext; import io.github.nucleuspowered.nucleus.core.scaffold.command.ICommandResult; import io.github.nucleuspowered.nucleus.core.scaffold.command.annotation.Command; import io.github.nucleuspowered.nucleus.core.scaffold.command.annotation.CommandModifier; import io.github.nucleuspowered.nucleus.core.scaffold.command.annotation.EssentialsEquivalent; import io.github.nucleuspowered.nucleus.core.scaffold.command.modifier.CommandModifiers; import org.spongepowered.api.command.exception.CommandException; import org.spongepowered.api.data.Keys; import org.spongepowered.api.entity.living.player.gamemode.GameMode; import org.spongepowered.api.entity.living.player.gamemode.GameModes; @Command( aliases = {"gmt"}, basePermission = {AdminPermissions.BASE_GAMEMODE, AdminPermissions.GAMEMODE_MODES_SPECTATOR, AdminPermissions.GAMEMODE_MODES_CREATIVE}, commandDescriptionKey = "gmt", modifiers = { @CommandModifier(value = CommandModifiers.HAS_WARMUP, exemptPermission = AdminPermissions.EXEMPT_WARMUP_GAMEMODE, useFrom = GamemodeCommand.class), @CommandModifier(value = CommandModifiers.HAS_COOLDOWN, exemptPermission = AdminPermissions.EXEMPT_COOLDOWN_GAMEMODE, useFrom = GamemodeCommand.class), @CommandModifier(value = CommandModifiers.HAS_COST, exemptPermission = AdminPermissions.EXEMPT_COST_GAMEMODE, useFrom = GamemodeCommand.class) } ) @EssentialsEquivalent("gmt") public class GamemodeToggleCommand extends GamemodeBase { @Override public ICommandResult execute(final ICommandContext src) throws CommandException { GameMode mode = src.getIfPlayer().get(Keys.GAME_MODE).orElseGet(GameModes.SURVIVAL); if (mode.equals(GameModes.SURVIVAL.get()) || mode.equals(GameModes.NOT_SET.get())) { mode = GameModes.CREATIVE.get(); } else { mode = GameModes.SURVIVAL.get(); } return this.baseCommand(src, src.getIfPlayer(), mode); } }
NucleusPowered/Nucleus
nucleus-modules/src/main/java/io/github/nucleuspowered/nucleus/modules/admin/commands/gamemode/GamemodeToggleCommand.java
Java
mit
2,542
#ifdef _WIN32 #define PATH_SEP ';' #else #define PATH_SEP ':' #endif #include <string> #include <cstdlib> #include <cstring> #include <iomanip> #include <sstream> #include <iostream> #include "ast.hpp" #include "util.hpp" #include "sass.h" #include "context.hpp" #include "plugins.hpp" #include "constants.hpp" #include "parser.hpp" #include "file.hpp" #include "inspect.hpp" #include "output.hpp" #include "expand.hpp" #include "eval.hpp" #include "cssize.hpp" #include "listize.hpp" #include "extend.hpp" #include "remove_placeholders.hpp" #include "functions.hpp" #include "backtrace.hpp" #include "sass2scss.h" #include "prelexer.hpp" #include "emitter.hpp" namespace Sass { using namespace Constants; using namespace File; using namespace Sass; Sass_Queued::Sass_Queued(const std::string& load_path, const std::string& abs_path, const char* source) { this->load_path = load_path; this->abs_path = abs_path; this->source = source; } inline bool sort_importers (const Sass_Importer_Entry& i, const Sass_Importer_Entry& j) { return sass_importer_get_priority(i) > sass_importer_get_priority(j); } Context::Context(Context::Data initializers) : // Output(this), head_imports(0), mem(Memory_Manager<AST_Node>()), c_options (initializers.c_options()), c_compiler (initializers.c_compiler()), source_c_str (initializers.source_c_str()), sources (std::vector<char*>()), strings (std::vector<char*>()), plugin_paths (initializers.plugin_paths()), include_paths (initializers.include_paths()), queue (std::vector<Sass_Queued>()), style_sheets (std::map<std::string, Block*>()), emitter (this), c_headers (std::vector<Sass_Importer_Entry>()), c_importers (std::vector<Sass_Importer_Entry>()), c_functions (std::vector<Sass_Function_Entry>()), indent (initializers.indent()), linefeed (initializers.linefeed()), input_path (make_canonical_path(initializers.input_path())), output_path (make_canonical_path(initializers.output_path())), source_comments (initializers.source_comments()), output_style (initializers.output_style()), source_map_file (make_canonical_path(initializers.source_map_file())), source_map_root (initializers.source_map_root()), // pass-through source_map_embed (initializers.source_map_embed()), source_map_contents (initializers.source_map_contents()), omit_source_map_url (initializers.omit_source_map_url()), is_indented_syntax_src (initializers.is_indented_syntax_src()), precision (initializers.precision()), plugins(), subset_map (Subset_Map<std::string, std::pair<Complex_Selector*, Compound_Selector*> >()) { cwd = get_cwd(); // enforce some safe defaults // used to create relative file links if (input_path == "") input_path = "stdin"; if (output_path == "") output_path = "stdout"; include_paths.push_back(cwd); collect_include_paths(initializers.include_paths_c_str()); // collect_include_paths(initializers.include_paths_array()); collect_plugin_paths(initializers.plugin_paths_c_str()); // collect_plugin_paths(initializers.plugin_paths_array()); for (size_t i = 0, S = plugin_paths.size(); i < S; ++i) { plugins.load_plugins(plugin_paths[i]); } for(auto fn : plugins.get_functions()) { c_functions.push_back(fn); } for(auto fn : plugins.get_headers()) { c_headers.push_back(fn); } for(auto fn : plugins.get_importers()) { c_importers.push_back(fn); } sort (c_headers.begin(), c_headers.end(), sort_importers); sort (c_importers.begin(), c_importers.end(), sort_importers); std::string entry_point = initializers.entry_point(); if (!entry_point.empty()) { std::string result(add_file(entry_point)); if (result.empty()) { throw "File to read not found or unreadable: " + entry_point; } } emitter.set_filename(resolve_relative_path(output_path, source_map_file, cwd)); } void Context::add_c_function(Sass_Function_Entry function) { c_functions.push_back(function); } void Context::add_c_header(Sass_Importer_Entry header) { c_headers.push_back(header); // need to sort the array afterwards (no big deal) sort (c_headers.begin(), c_headers.end(), sort_importers); } void Context::add_c_importer(Sass_Importer_Entry importer) { c_importers.push_back(importer); // need to sort the array afterwards (no big deal) sort (c_importers.begin(), c_importers.end(), sort_importers); } Context::~Context() { // make sure we free the source even if not processed! if (sources.size() == 0 && source_c_str) free(source_c_str); // sources are allocated by strdup or malloc (overtaken from C code) for (size_t i = 0; i < sources.size(); ++i) free(sources[i]); // free all strings we kept alive during compiler execution for (size_t n = 0; n < strings.size(); ++n) free(strings[n]); // everything that gets put into sources will be freed by us for (size_t m = 0; m < import_stack.size(); ++m) sass_delete_import(import_stack[m]); // clear inner structures (vectors) and input source sources.clear(); import_stack.clear(); source_c_str = 0; } void Context::collect_include_paths(const char* paths_str) { if (paths_str) { const char* beg = paths_str; const char* end = Prelexer::find_first<PATH_SEP>(beg); while (end) { std::string path(beg, end - beg); if (!path.empty()) { if (*path.rbegin() != '/') path += '/'; include_paths.push_back(path); } beg = end + 1; end = Prelexer::find_first<PATH_SEP>(beg); } std::string path(beg); if (!path.empty()) { if (*path.rbegin() != '/') path += '/'; include_paths.push_back(path); } } } void Context::collect_include_paths(const char** paths_array) { if (paths_array) { for (size_t i = 0; paths_array[i]; i++) { collect_include_paths(paths_array[i]); } } } void Context::collect_plugin_paths(const char* paths_str) { if (paths_str) { const char* beg = paths_str; const char* end = Prelexer::find_first<PATH_SEP>(beg); while (end) { std::string path(beg, end - beg); if (!path.empty()) { if (*path.rbegin() != '/') path += '/'; plugin_paths.push_back(path); } beg = end + 1; end = Prelexer::find_first<PATH_SEP>(beg); } std::string path(beg); if (!path.empty()) { if (*path.rbegin() != '/') path += '/'; plugin_paths.push_back(path); } } } void Context::collect_plugin_paths(const char** paths_array) { if (paths_array) { for (size_t i = 0; paths_array[i]; i++) { collect_plugin_paths(paths_array[i]); } } } void Context::add_source(std::string load_path, std::string abs_path, char* contents) { sources.push_back(contents); included_files.push_back(abs_path); queue.push_back(Sass_Queued(load_path, abs_path, contents)); emitter.add_source_index(sources.size() - 1); include_links.push_back(resolve_relative_path(abs_path, source_map_file, cwd)); } // Add a new import file to the context std::string Context::add_file(const std::string& file) { using namespace File; std::string path(make_canonical_path(file)); std::string resolved(find_file(path, include_paths)); if (resolved == "") return resolved; if (char* contents = read_file(resolved)) { add_source(path, resolved, contents); style_sheets[path] = 0; return path; } return std::string(""); } // Add a new import file to the context // This has some previous directory context std::string Context::add_file(const std::string& base, const std::string& file, ParserState pstate) { using namespace File; std::string path(make_canonical_path(file)); std::string base_file(join_paths(base, path)); if (style_sheets.count(base_file)) return base_file; std::vector<Sass_Queued> resolved(resolve_file(base, path)); if (resolved.size() > 1) { std::stringstream msg_stream; msg_stream << "It's not clear which file to import for "; msg_stream << "'@import \"" << file << "\"'." << "\n"; msg_stream << "Candidates:" << "\n"; for (size_t i = 0, L = resolved.size(); i < L; ++i) { msg_stream << " " << resolved[i].load_path << "\n"; } msg_stream << "Please delete or rename all but one of these files." << "\n"; error(msg_stream.str(), pstate); } if (resolved.size()) { if (char* contents = read_file(resolved[0].abs_path)) { add_source(base_file, resolved[0].abs_path, contents); style_sheets[base_file] = 0; return base_file; } } // now go the regular code path return add_file(path); } void register_function(Context&, Signature sig, Native_Function f, Env* env); void register_function(Context&, Signature sig, Native_Function f, size_t arity, Env* env); void register_overload_stub(Context&, std::string name, Env* env); void register_built_in_functions(Context&, Env* env); void register_c_functions(Context&, Env* env, Sass_Function_List); void register_c_function(Context&, Env* env, Sass_Function_Entry); char* Context::compile_block(Block* root) { if (!root) return 0; root->perform(&emitter); emitter.finalize(); OutputBuffer emitted = emitter.get_buffer(); std::string output = emitted.buffer; if (source_map_file != "" && !omit_source_map_url) { output += linefeed + format_source_mapping_url(source_map_file); } return sass_strdup(output.c_str()); } Block* Context::parse_file() { Block* root = 0; for (size_t i = 0; i < queue.size(); ++i) { Sass_Import_Entry import = sass_make_import( queue[i].load_path.c_str(), queue[i].abs_path.c_str(), 0, 0 ); import_stack.push_back(import); // keep a copy of the path around (for parser states) strings.push_back(sass_strdup(queue[i].abs_path.c_str())); ParserState pstate(strings.back(), queue[i].source, i); Parser p(Parser::from_c_str(queue[i].source, *this, pstate)); Block* ast = p.parse(); sass_delete_import(import_stack.back()); import_stack.pop_back(); if (i == 0) root = ast; // ToDo: we store by load_path, which can lead // to duplicates if importer reports the same path // Maybe we should add an error for duplicates!? style_sheets[queue[i].load_path] = ast; } if (root == 0) return 0; Env global; // create root environment // register built-in functions on env register_built_in_functions(*this, &global); // register custom functions (defined via C-API) for (size_t i = 0, S = c_functions.size(); i < S; ++i) { register_c_function(*this, &global, c_functions[i]); } // create initial backtrace entry Backtrace backtrace(0, ParserState("", 0), ""); // create crtp visitor objects Expand expand(*this, &global, &backtrace); Cssize cssize(*this, &backtrace); // expand and eval the tree root = root->perform(&expand)->block(); // merge and bubble certain rules root = root->perform(&cssize)->block(); // should we extend something? if (!subset_map.empty()) { // create crtp visitor object Extend extend(*this, subset_map); // extend tree nodes root->perform(&extend); } // clean up by removing empty placeholders // ToDo: maybe we can do this somewhere else? Remove_Placeholders remove_placeholders(*this); root->perform(&remove_placeholders); // return processed tree return root; } // EO parse_file Block* Context::parse_string() { if (!source_c_str) return 0; queue.clear(); if(is_indented_syntax_src) { char * contents = sass2scss(source_c_str, SASS2SCSS_PRETTIFY_1 | SASS2SCSS_KEEP_COMMENT); add_source(input_path, input_path, contents); free(source_c_str); return parse_file(); } add_source(input_path, input_path, source_c_str); return parse_file(); } char* Context::compile_file() { // returns NULL if something fails return compile_block(parse_file()); } char* Context::compile_string() { // returns NULL if something fails return compile_block(parse_string()); } std::string Context::format_source_mapping_url(const std::string& file) { std::string url = resolve_relative_path(file, output_path, cwd); if (source_map_embed) { std::string map = emitter.generate_source_map(*this); std::istringstream is( map ); std::ostringstream buffer; base64::encoder E; E.encode(is, buffer); url = "data:application/json;base64," + buffer.str(); url.erase(url.size() - 1); } return "/*# sourceMappingURL=" + url + " */"; } char* Context::generate_source_map() { if (source_map_file == "") return 0; char* result = 0; std::string map = emitter.generate_source_map(*this); result = sass_strdup(map.c_str()); return result; } std::vector<std::string> Context::get_included_files(size_t skip) { std::vector<std::string> includes = included_files; if (includes.size() == 0) return includes; std::sort( includes.begin() + skip, includes.end() ); includes.erase( includes.begin(), includes.begin() + skip ); includes.erase( std::unique( includes.begin(), includes.end() ), includes.end() ); // the skip solution seems more robust, as we may have real files named stdin // includes.erase( std::remove( includes.begin(), includes.end(), "stdin" ), includes.end() ); return includes; } std::string Context::get_cwd() { return Sass::File::get_cwd(); } void register_function(Context& ctx, Signature sig, Native_Function f, Env* env) { Definition* def = make_native_function(sig, f, ctx); def->environment(env); (*env)[def->name() + "[f]"] = def; } void register_function(Context& ctx, Signature sig, Native_Function f, size_t arity, Env* env) { Definition* def = make_native_function(sig, f, ctx); std::stringstream ss; ss << def->name() << "[f]" << arity; def->environment(env); (*env)[ss.str()] = def; } void register_overload_stub(Context& ctx, std::string name, Env* env) { Definition* stub = new (ctx.mem) Definition(ParserState("[built-in function]"), 0, name, 0, 0, true); (*env)[name + "[f]"] = stub; } void register_built_in_functions(Context& ctx, Env* env) { using namespace Functions; // RGB Functions register_function(ctx, rgb_sig, rgb, env); register_overload_stub(ctx, "rgba", env); register_function(ctx, rgba_4_sig, rgba_4, 4, env); register_function(ctx, rgba_2_sig, rgba_2, 2, env); register_function(ctx, red_sig, red, env); register_function(ctx, green_sig, green, env); register_function(ctx, blue_sig, blue, env); register_function(ctx, mix_sig, mix, env); // HSL Functions register_function(ctx, hsl_sig, hsl, env); register_function(ctx, hsla_sig, hsla, env); register_function(ctx, hue_sig, hue, env); register_function(ctx, saturation_sig, saturation, env); register_function(ctx, lightness_sig, lightness, env); register_function(ctx, adjust_hue_sig, adjust_hue, env); register_function(ctx, lighten_sig, lighten, env); register_function(ctx, darken_sig, darken, env); register_function(ctx, saturate_sig, saturate, env); register_function(ctx, desaturate_sig, desaturate, env); register_function(ctx, grayscale_sig, grayscale, env); register_function(ctx, complement_sig, complement, env); register_function(ctx, invert_sig, invert, env); // Opacity Functions register_function(ctx, alpha_sig, alpha, env); register_function(ctx, opacity_sig, alpha, env); register_function(ctx, opacify_sig, opacify, env); register_function(ctx, fade_in_sig, opacify, env); register_function(ctx, transparentize_sig, transparentize, env); register_function(ctx, fade_out_sig, transparentize, env); // Other Color Functions register_function(ctx, adjust_color_sig, adjust_color, env); register_function(ctx, scale_color_sig, scale_color, env); register_function(ctx, change_color_sig, change_color, env); register_function(ctx, ie_hex_str_sig, ie_hex_str, env); // String Functions register_function(ctx, unquote_sig, sass_unquote, env); register_function(ctx, quote_sig, sass_quote, env); register_function(ctx, str_length_sig, str_length, env); register_function(ctx, str_insert_sig, str_insert, env); register_function(ctx, str_index_sig, str_index, env); register_function(ctx, str_slice_sig, str_slice, env); register_function(ctx, to_upper_case_sig, to_upper_case, env); register_function(ctx, to_lower_case_sig, to_lower_case, env); // Number Functions register_function(ctx, percentage_sig, percentage, env); register_function(ctx, round_sig, round, env); register_function(ctx, ceil_sig, ceil, env); register_function(ctx, floor_sig, floor, env); register_function(ctx, abs_sig, abs, env); register_function(ctx, min_sig, min, env); register_function(ctx, max_sig, max, env); register_function(ctx, random_sig, random, env); // List Functions register_function(ctx, length_sig, length, env); register_function(ctx, nth_sig, nth, env); register_function(ctx, set_nth_sig, set_nth, env); register_function(ctx, index_sig, index, env); register_function(ctx, join_sig, join, env); register_function(ctx, append_sig, append, env); register_function(ctx, zip_sig, zip, env); register_function(ctx, list_separator_sig, list_separator, env); // Map Functions register_function(ctx, map_get_sig, map_get, env); register_function(ctx, map_merge_sig, map_merge, env); register_function(ctx, map_remove_sig, map_remove, env); register_function(ctx, map_keys_sig, map_keys, env); register_function(ctx, map_values_sig, map_values, env); register_function(ctx, map_has_key_sig, map_has_key, env); register_function(ctx, keywords_sig, keywords, env); // Introspection Functions register_function(ctx, type_of_sig, type_of, env); register_function(ctx, unit_sig, unit, env); register_function(ctx, unitless_sig, unitless, env); register_function(ctx, comparable_sig, comparable, env); register_function(ctx, variable_exists_sig, variable_exists, env); register_function(ctx, global_variable_exists_sig, global_variable_exists, env); register_function(ctx, function_exists_sig, function_exists, env); register_function(ctx, mixin_exists_sig, mixin_exists, env); register_function(ctx, feature_exists_sig, feature_exists, env); register_function(ctx, call_sig, call, env); // Boolean Functions register_function(ctx, not_sig, sass_not, env); register_function(ctx, if_sig, sass_if, env); // Misc Functions register_function(ctx, inspect_sig, inspect, env); register_function(ctx, unique_id_sig, unique_id, env); // Selector functions register_function(ctx, selector_nest_sig, selector_nest, env); register_function(ctx, selector_append_sig, selector_append, env); register_function(ctx, selector_extend_sig, selector_extend, env); register_function(ctx, selector_replace_sig, selector_replace, env); register_function(ctx, selector_unify_sig, selector_unify, env); register_function(ctx, is_superselector_sig, is_superselector, env); register_function(ctx, simple_selectors_sig, simple_selectors, env); register_function(ctx, selector_parse_sig, selector_parse, env); } void register_c_functions(Context& ctx, Env* env, Sass_Function_List descrs) { while (descrs && *descrs) { register_c_function(ctx, env, *descrs); ++descrs; } } void register_c_function(Context& ctx, Env* env, Sass_Function_Entry descr) { Definition* def = make_c_function(descr, ctx); def->environment(env); (*env)[def->name() + "[f]"] = def; } }
go-gonzo/scss
internal/libsass/libsass/src/context.cpp
C++
mit
20,845
<!DOCTYPE html><html><head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>[爆卦] 鴻池也需要溫暖,靠發不實簡訊給選民取暖 - 看板 Gossiping - 批踢踢實業坊</title> <meta name="robots" content="all"> <meta name="keywords" content="Ptt BBS 批踢踢"> <meta name="description" content=" https://www.facebook.com/Appendectomy/posts/355459524639096:0 【鴻池也需要溫暖,靠發不實簡訊給選民取暖】 大家可能已經發現,林鴻池和蔡正元這兩人,除了同是割闌尾罷免前三名爛尾之外,他們 "> <meta property="og:site_name" content="Ptt 批踢踢實業坊"> <meta property="og:title" content="[爆卦] 鴻池也需要溫暖,靠發不實簡訊給選民取暖"> <meta property="og:description" content=" https://www.facebook.com/Appendectomy/posts/355459524639096:0 【鴻池也需要溫暖,靠發不實簡訊給選民取暖】 大家可能已經發現,林鴻池和蔡正元這兩人,除了同是割闌尾罷免前三名爛尾之外,他們 "> <link rel="stylesheet" type="text/css" href="//images.ptt.cc/v2.10/bbs-common.css"> <link rel="stylesheet" type="text/css" href="//images.ptt.cc/v2.10/bbs.css" media="screen"> <link rel="stylesheet" type="text/css" href="//images.ptt.cc/v2.10/pushstream.css" media="screen"> <link rel="stylesheet" type="text/css" href="//images.ptt.cc/v2.10/bbs-print.css" media="print"> <script type="text/javascript" async="" src="https://apis.google.com/js/plusone.js"></script><script id="facebook-jssdk" src="//connect.facebook.net/en_US/all.js#xfbml=1"></script><script type="text/javascript" async="" src="https://ssl.google-analytics.com/ga.js"></script><script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="//images.ptt.cc/v2.10/bbs.js"></script> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-32365737-1']); _gaq.push(['_setDomainName', 'ptt.cc']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </head> <body> <div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> <div id="topbar-container"> <div id="topbar" class="bbs-content"> <a id="logo" href="/">批踢踢實業坊</a> <span>›</span> <a class="board" href="/bbs/Gossiping/index.html"><span class="board-label">看板 </span>Gossiping</a> <a class="right small" href="/about.html">關於我們</a> <a class="right small" href="/contact.html">聯絡資訊</a> </div> </div> <div id="navigation-container"> <div id="navigation" class="bbs-content"> <a class="board" href="/bbs/Gossiping/index.html">返回看板</a> <div class="bar"></div> <div class="share"> <span>分享</span> <div class="fb-like" data-send="false" data-layout="button_count" data-width="90" data-show-faces="false" data-href="http://www.ptt.cc/bbs/Gossiping/M.1419005416.A.F32.html"></div> <div class="g-plusone" data-size="medium"></div> <script type="text/javascript"> window.___gcfg = {lang: 'zh-TW'}; (function() { var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/plusone.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); })(); </script> </div> </div> </div> <div id="main-container"> <div id="main-content" class="bbs-screen bbs-content"><div class="article-metaline"><span class="article-meta-tag">作者</span><span class="article-meta-value">Demogorgan (Superconductor)</span></div><div class="article-metaline-right"><span class="article-meta-tag">看板</span><span class="article-meta-value">Gossiping</span></div><div class="article-metaline"><span class="article-meta-tag">標題</span><span class="article-meta-value">[爆卦] 鴻池也需要溫暖,靠發不實簡訊給選民取暖</span></div><div class="article-metaline"><span class="article-meta-tag">時間</span><span class="article-meta-value">Sat Dec 20 00:10:12 2014</span></div> <a href="https://www.facebook.com/Appendectomy/posts/355459524639096:0" target="_blank" rel="nofollow">https://www.facebook.com/Appendectomy/posts/355459524639096:0</a> 【鴻池也需要溫暖,靠發不實簡訊給選民取暖】 大家可能已經發現,林鴻池和蔡正元這兩人,除了同是割闌尾罷免前三名爛尾之外,他們 還有幾個共同之處:不知檢討和自我反省。就像蔡正元在連勝文大敗之後,只會怪國民黨 中央,卻不反思是否是自己這個「競選總幹事」的問題,更不用說他對自己罷免連署以高 標通過第二階段完全無感這件事。林鴻池的不知檢討和自我反省,和蔡正元也不相上下。 傳給選民的簡訊當中,指稱割闌尾罷免理由是偏離事實,混淆視聽。但到底是誰在說謊, 誰又說的是實話,只要上立法院公報,就知道罷免理由是真是假。 現在危急全民健康的食安風暴,有立委預計要設立『賠償信託基金』專戶,讓食安受害者 能夠得到安全完善的保護措施,但林鴻池卻投下反對票。林鴻池「毒害」人民還不只這一 樁,林之前2009年公開表示「為人民健康把關,強烈反對美牛內臟進口」,言猶在耳2012 年卻以黨紀施壓國民黨立委,強行讓美牛案過關,明知是禍害人民的法案,卻泯滅良心只 顧馬意。另外,林鴻池還踐踏立法體系,2013年6月偷偷半夜通過會計法修正案,跟30秒 一樣低劣的手段,試圖用此法爲顏清標的貪汙罪解套,連同樣是國民黨的書記長賴士葆都 說,整個修法過程很神秘,他也是最後一兩天才被告知。這些所有事件都有憑有據,只要 稍微查一下就能知道,但林鴻池還敢大言不慚的對他的選民說,罷免理由偏離事實,各位 板橋人,相信大家眼睛都是雪亮的,讓我們在明天12/20星期六,一起一次罷免掉林鴻池 ,明天「整個新北都是割闌尾的連署站」,讓我們在板橋西區58間7-11外面罷免連署攤位 ,不見不散! ------------------- ■ 第二階段倒數計時中 吳育昇:倒數07天,12/27連署截止 林鴻池:倒數07天,12/27連署截止 ■ 第二階段擺攤列表 吳育昇:<a href="http://goo.gl/VhnA2M" target="_blank" rel="nofollow">http://goo.gl/VhnA2M</a> 林鴻池:<a href="http://goo.gl/BFxRfp" target="_blank" rel="nofollow">http://goo.gl/BFxRfp</a> --------------------- 【現在加入。割闌尾V計劃 <a href="http://1129vday.tw/】" target="_blank" rel="nofollow">http://1129vday.tw/】</a> ■ 後續志工:<a href="http://goo.gl/MURskc" target="_blank" rel="nofollow">http://goo.gl/MURskc</a> -------- 【高雄區割闌尾】 ● 週末擺攤志工報名處 <a href="http://goo.gl/forms/8gNs8L63Tz" target="_blank" rel="nofollow">http://goo.gl/forms/8gNs8L63Tz</a> 本週活動:12/20(六)、12/21(日) 下午3點~5點 全聯 (小港漢民路中山國中斜對面) <a href="http://goo.gl/mgmvkQ" target="_blank" rel="nofollow">http://goo.gl/mgmvkQ</a> (GOOGLE MAP) -------- ★flyingV 緊急募資中 <a href="https://www.flyingv.cc/project/5126" target="_blank" rel="nofollow">https://www.flyingv.cc/project/5126</a> 高雄兩位闌尾: ★黃昭順提議書載點 <a href="http://ppt.cc/--O7" target="_blank" rel="nofollow">http://ppt.cc/--O7</a> 戶籍在左營、楠梓 ★林國正提議書載點 <a href="http://ppt.cc/seyN" target="_blank" rel="nofollow">http://ppt.cc/seyN</a> 戶籍在前鎮、小港 前鎮8里(興東、復國、竹內、竹東、竹南、竹北、竹西、竹中里)非林國正選區,故不能 寫其提議書。 郵遞區號80099,高雄郵局第500號信箱 -- <span class="hl"> Just chemistry!</span><span class="f1 hl"> Helium</span> <span class="f5 hl">Boron Carbon </span><span class="f1 hl"> Nitrogen Oxygen Fluorine Neon</span> <span class="f4 hl">Aluminum</span><span class="f5 hl"> Silicon </span><span class="f3 hl"> Phosphorus Sulfur </span><span class="f1 hl"> Chlorine Argon</span> <span class="f4 hl">Gallium </span><span class="f5 hl"> Germanium Arsenic Selenium </span><span class="f2 hl"> Bromine </span><span class="f1 hl"> Krypton</span> <span class="f4 hl">Indium Tin </span><span class="f5 hl"> Antimony Tellurium </span><span class="f3 hl">Iodine </span><span class="f1 hl"> Xenon</span> <span class="f4 hl">Thallium Lead </span><span class="f5 hl"> Bismuth Polonium </span><span class="f6 hl"> Astatine</span><span class="f1 hl"> Radon</span> -- <span class="f2">※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 49.158.172.132 </span><span class="f2">※ 文章網址: <a href="http://www.ptt.cc/bbs/Gossiping/M.1419005416.A.F32.html" target="_blank" rel="nofollow">http://www.ptt.cc/bbs/Gossiping/M.1419005416.A.F32.html</a> </span><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">qooisgood</span><span class="f3 push-content">: 推爆他阿!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</span><span class="push-ipdatetime"> 12/20 00:10 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">zxc17893</span><span class="f3 push-content">: 快上阿!!!!!!!!!!!!!</span><span class="push-ipdatetime"> 12/20 00:11 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">yoyosunmoon</span><span class="f3 push-content">: push</span><span class="push-ipdatetime"> 12/20 00:11 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">micronetplor</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 00:11 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">onlyhuman</span><span class="f3 push-content">:</span><span class="push-ipdatetime"> 12/20 00:11 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">OR</span><span class="f3 push-content">:</span><span class="push-ipdatetime"> 12/20 00:12 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">ggbb</span><span class="f3 push-content">: 推推</span><span class="push-ipdatetime"> 12/20 00:12 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">jerry123456</span><span class="f3 push-content">: 推!!!!!!!!!!!</span><span class="push-ipdatetime"> 12/20 00:12 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">qqq0103</span><span class="f3 push-content">:</span><span class="push-ipdatetime"> 12/20 00:13 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">s8338127</span><span class="f3 push-content">: push</span><span class="push-ipdatetime"> 12/20 00:13 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">paris930</span><span class="f3 push-content">: Bye 鴻池</span><span class="push-ipdatetime"> 12/20 00:14 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">jaivu</span><span class="f3 push-content">: 幫高調</span><span class="push-ipdatetime"> 12/20 00:14 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">ECZEMA</span><span class="f3 push-content">: 林鴻池罷免連署很不夠</span><span class="push-ipdatetime"> 12/20 00:14 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">qooisgood</span><span class="f3 push-content">: 鴻池需要溫暖 為什麼不推</span><span class="push-ipdatetime"> 12/20 00:14 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">ymx3xc</span><span class="f3 push-content">:</span><span class="push-ipdatetime"> 12/20 00:14 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">victoryman</span><span class="f3 push-content">:</span><span class="push-ipdatetime"> 12/20 00:14 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">aimiveyoris</span><span class="f3 push-content">: 在推!!!</span><span class="push-ipdatetime"> 12/20 00:15 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">rayonwu</span><span class="f3 push-content">: 高調</span><span class="push-ipdatetime"> 12/20 00:15 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">FrankerZ</span><span class="f3 push-content">: 幫高調</span><span class="push-ipdatetime"> 12/20 00:15 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">tomo1026</span><span class="f3 push-content">: 比起林鴻池 薇閣昇才更值得罷免</span><span class="push-ipdatetime"> 12/20 00:15 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">eco100</span><span class="f3 push-content">: 睡前高調</span><span class="push-ipdatetime"> 12/20 00:15 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">rangting</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 00:15 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">qooisgood</span><span class="f3 push-content">:</span><span class="push-ipdatetime"> 12/20 00:15 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">oncemore</span><span class="f3 push-content">: 會計法就別提了 藍綠通姦的產物</span><span class="push-ipdatetime"> 12/20 00:16 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">stevely</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 00:16 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">LuckyBee</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 00:16 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">yaya</span><span class="f3 push-content">:</span><span class="push-ipdatetime"> 12/20 00:17 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">dian9</span><span class="f3 push-content">:</span><span class="push-ipdatetime"> 12/20 00:17 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">noworneverev</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 00:17 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">bobobola</span><span class="f3 push-content">: 柯p也因為會計法解套阿</span><span class="push-ipdatetime"> 12/20 00:17 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">Solony</span><span class="f3 push-content">: push</span><span class="push-ipdatetime"> 12/20 00:18 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">loki1789</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 00:18 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">yinling0105</span><span class="f3 push-content">: 感覺很難打...大家加油!</span><span class="push-ipdatetime"> 12/20 00:18 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">iwillptt</span><span class="f3 push-content">:</span><span class="push-ipdatetime"> 12/20 00:18 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">Waitaha</span><span class="f3 push-content">: 為什麼不罷免羅淑蕾</span><span class="push-ipdatetime"> 12/20 00:18 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">conbanwa</span><span class="f3 push-content">:</span><span class="push-ipdatetime"> 12/20 00:19 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">stiles</span><span class="f3 push-content">: push</span><span class="push-ipdatetime"> 12/20 00:19 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">demonh311</span><span class="f3 push-content">: 給正元溫暖</span><span class="push-ipdatetime"> 12/20 00:19 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">tyrone126</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 00:19 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">unreal29</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 00:19 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">Lailungsheng</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 00:19 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">qooisgood</span><span class="f3 push-content">:</span><span class="push-ipdatetime"> 12/20 00:19 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">pttpai</span><span class="f3 push-content">: 推,加油!</span><span class="push-ipdatetime"> 12/20 00:20 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">hungryuu</span><span class="f3 push-content">:</span><span class="push-ipdatetime"> 12/20 00:21 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">CO2</span><span class="f3 push-content">:</span><span class="push-ipdatetime"> 12/20 00:21 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">scarlee</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 00:22 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">sharkimage</span><span class="f3 push-content">: 加油</span><span class="push-ipdatetime"> 12/20 00:22 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">moee5432</span><span class="f3 push-content">: 推!</span><span class="push-ipdatetime"> 12/20 00:22 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">xfirex</span><span class="f3 push-content">: 割</span><span class="push-ipdatetime"> 12/20 00:23 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">trappings</span><span class="f3 push-content">: 已割 推!!!</span><span class="push-ipdatetime"> 12/20 00:24 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">Drizzle</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 00:24 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">opces</span><span class="f3 push-content">:</span><span class="push-ipdatetime"> 12/20 00:24 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">artdeco1</span><span class="f3 push-content">: push</span><span class="push-ipdatetime"> 12/20 00:24 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">Tuscany</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 00:25 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">jing202</span><span class="f3 push-content">: 上啊!</span><span class="push-ipdatetime"> 12/20 00:25 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">theEastCoast</span><span class="f3 push-content">:</span><span class="push-ipdatetime"> 12/20 00:25 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">wl760713</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 00:26 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">Howard119</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 00:27 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">corexxx</span><span class="f3 push-content">: 推!</span><span class="push-ipdatetime"> 12/20 00:27 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">qooisgood</span><span class="f3 push-content">:</span><span class="push-ipdatetime"> 12/20 00:28 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">goddarn</span><span class="f3 push-content">: 推一個 加油啊!</span><span class="push-ipdatetime"> 12/20 00:31 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">stupideric</span><span class="f3 push-content">: 欠推啦</span><span class="push-ipdatetime"> 12/20 00:31 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">ntpupu</span><span class="f3 push-content">: 高</span><span class="push-ipdatetime"> 12/20 00:31 </span></div><div class="push"><span class="f1 hl push-tag">→ </span><span class="f3 hl push-userid">wade8204</span><span class="f3 push-content">: 推啊</span><span class="push-ipdatetime"> 12/20 00:32 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">minaminojill</span><span class="f3 push-content">: 推,真愛假</span><span class="push-ipdatetime"> 12/20 00:34 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">aipado</span><span class="f3 push-content">: red pool fxxk u</span><span class="push-ipdatetime"> 12/20 00:34 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">renji1231</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 00:36 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">coco119</span><span class="f3 push-content">:</span><span class="push-ipdatetime"> 12/20 00:38 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">WNmime</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 00:39 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">SHIU0315</span><span class="f3 push-content">: 推個</span><span class="push-ipdatetime"> 12/20 00:40 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">kaoru1992</span><span class="f3 push-content">:</span><span class="push-ipdatetime"> 12/20 00:40 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">sandiato</span><span class="f3 push-content">: 不try一下怎麼知道</span><span class="push-ipdatetime"> 12/20 00:42 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">jeneaqa1</span><span class="f3 push-content">: 和止兀一起走</span><span class="push-ipdatetime"> 12/20 00:42 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">Ayenyen</span><span class="f3 push-content">: 幫高調啊!!!!!推!!</span><span class="push-ipdatetime"> 12/20 00:42 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">fricca</span><span class="f3 push-content">: 高調</span><span class="push-ipdatetime"> 12/20 00:43 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">cbstgb</span><span class="f3 push-content">: 高調</span><span class="push-ipdatetime"> 12/20 00:44 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">p830159</span><span class="f3 push-content">: 高調</span><span class="push-ipdatetime"> 12/20 00:47 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">chungyiju</span><span class="f3 push-content">:</span><span class="push-ipdatetime"> 12/20 00:48 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">yaya</span><span class="f3 push-content">: PUSH</span><span class="push-ipdatetime"> 12/20 00:50 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">pro33342</span><span class="f3 push-content">: 高調啦</span><span class="push-ipdatetime"> 12/20 00:51 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">lawkey</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 00:51 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">jimmysts</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 00:53 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">jordan621</span><span class="f3 push-content">:</span><span class="push-ipdatetime"> 12/20 00:54 </span></div><div class="push"><span class="f1 hl push-tag">→ </span><span class="f3 hl push-userid">zxc75953515</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 00:55 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">sgonacle7821</span><span class="f3 push-content">: 割掉他!!!</span><span class="push-ipdatetime"> 12/20 00:55 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">bongg</span><span class="f3 push-content">:</span><span class="push-ipdatetime"> 12/20 00:56 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">hengyi</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 00:57 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">kis28519</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 00:58 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">Zhangyuan</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 00:59 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">LeeLaa</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 01:00 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">jessica5230</span><span class="f3 push-content">: 加油!!!!</span><span class="push-ipdatetime"> 12/20 01:02 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">dian9</span><span class="f3 push-content">:</span><span class="push-ipdatetime"> 12/20 01:02 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">Dulcia</span><span class="f3 push-content">: 割掉他!!!!</span><span class="push-ipdatetime"> 12/20 01:04 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">foxfish</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 01:04 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">smile1007</span><span class="f3 push-content">: 推啦!!!</span><span class="push-ipdatetime"> 12/20 01:04 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">chunyun</span><span class="f3 push-content">: 無恥至極。</span><span class="push-ipdatetime"> 12/20 01:06 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">Kanecart</span><span class="f3 push-content">: 割掉他</span><span class="push-ipdatetime"> 12/20 01:08 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">odi5656</span><span class="f3 push-content">: 推推~</span><span class="push-ipdatetime"> 12/20 01:09 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">james1014306</span><span class="f3 push-content">: 幫高調</span><span class="push-ipdatetime"> 12/20 01:13 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">pase139</span><span class="f3 push-content">: 這不割說不過去</span><span class="push-ipdatetime"> 12/20 01:14 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">qqq0103</span><span class="f3 push-content">:</span><span class="push-ipdatetime"> 12/20 01:16 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">jeanne3624</span><span class="f3 push-content">:</span><span class="push-ipdatetime"> 12/20 01:16 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">dtlove17</span><span class="f3 push-content">:</span><span class="push-ipdatetime"> 12/20 01:21 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">karta0681608</span><span class="f3 push-content">: 高調</span><span class="push-ipdatetime"> 12/20 01:22 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">blxbl</span><span class="f3 push-content">: 幫高調</span><span class="push-ipdatetime"> 12/20 01:25 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">cjdcjdc</span><span class="f3 push-content">:</span><span class="push-ipdatetime"> 12/20 01:26 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">chunyun</span><span class="f3 push-content">: 畜牲</span><span class="push-ipdatetime"> 12/20 01:26 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">Kemuel</span><span class="f3 push-content">: 高調</span><span class="push-ipdatetime"> 12/20 01:27 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">omaha</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 01:30 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">handlesome</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 01:31 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">Cruised</span><span class="f3 push-content">: !</span><span class="push-ipdatetime"> 12/20 01:31 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">qqq0103</span><span class="f3 push-content">:</span><span class="push-ipdatetime"> 12/20 01:34 </span></div><div class="push"><span class="f1 hl push-tag">→ </span><span class="f3 hl push-userid">yaya</span><span class="f3 push-content">: !</span><span class="push-ipdatetime"> 12/20 01:43 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">uujidggl</span><span class="f3 push-content">: 高調</span><span class="push-ipdatetime"> 12/20 01:45 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">GAPB</span><span class="f3 push-content">: 推!</span><span class="push-ipdatetime"> 12/20 01:52 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">Roarwolf</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 01:55 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">jevix</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 01:58 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">uniz</span><span class="f3 push-content">: 高調推!!</span><span class="push-ipdatetime"> 12/20 01:59 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">mikajamie</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 02:00 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">attitudium</span><span class="f3 push-content">: 這顆就是惡性腫瘤</span><span class="push-ipdatetime"> 12/20 02:05 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">ueewen</span><span class="f3 push-content">: 推!</span><span class="push-ipdatetime"> 12/20 02:12 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">immoonlight</span><span class="f3 push-content">: X推</span><span class="push-ipdatetime"> 12/20 02:40 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">kazukisora</span><span class="f3 push-content">:</span><span class="push-ipdatetime"> 12/20 02:40 </span></div><div class="push"><span class="f1 hl push-tag">→ </span><span class="f3 hl push-userid">canappeco</span><span class="f3 push-content">: 鴻池也需要割闌尾</span><span class="push-ipdatetime"> 12/20 03:01 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">gretchen1</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 03:21 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">zxp930110</span><span class="f3 push-content">: 安安正元兒在等你囉</span><span class="push-ipdatetime"> 12/20 03:44 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">joyc06u6</span><span class="f3 push-content">:</span><span class="push-ipdatetime"> 12/20 04:03 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">Hotaruinori</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 04:28 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">nsaids</span><span class="f3 push-content">: KMT出品必屬佳作</span><span class="push-ipdatetime"> 12/20 06:09 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">tozz</span><span class="f3 push-content">: 出草囉喔喔</span><span class="push-ipdatetime"> 12/20 06:33 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">Whitening</span><span class="f3 push-content">: 誇張的國民黨立委!</span><span class="push-ipdatetime"> 12/20 06:59 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">mvpdirk712</span><span class="f3 push-content">: 快滾吧 這種爛立委多一個也嫌太多</span><span class="push-ipdatetime"> 12/20 07:18 </span></div><div class="push"><span class="f1 hl push-tag">→ </span><span class="f3 hl push-userid">TREKKER</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 07:58 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">houseman0713</span><span class="f3 push-content">: 這不推不行~</span><span class="push-ipdatetime"> 12/20 08:01 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">greco0616</span><span class="f3 push-content">:</span><span class="push-ipdatetime"> 12/20 08:31 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">deeplythink</span><span class="f3 push-content">:</span><span class="push-ipdatetime"> 12/20 08:34 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">funnyrain</span><span class="f3 push-content">: 加油</span><span class="push-ipdatetime"> 12/20 08:37 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">usamichan</span><span class="f3 push-content">: 垃圾</span><span class="push-ipdatetime"> 12/20 08:57 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">lunaX19</span><span class="f3 push-content">: 這人在板橋很久了...</span><span class="push-ipdatetime"> 12/20 09:07 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">HOLDONY</span><span class="f3 push-content">: 加油</span><span class="push-ipdatetime"> 12/20 09:25 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">cmy66</span><span class="f3 push-content">: 加油!!</span><span class="push-ipdatetime"> 12/20 09:25 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">gg889g8</span><span class="f3 push-content">: 加油</span><span class="push-ipdatetime"> 12/20 09:40 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">julia66</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 10:22 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">imogenemuse</span><span class="f3 push-content">: 投美牛這點,一定得罷免,連臺灣本島食安都驗不出來</span><span class="push-ipdatetime"> 12/20 10:25 </span></div><div class="push"><span class="f1 hl push-tag">→ </span><span class="f3 hl push-userid">imogenemuse</span><span class="f3 push-content">: 美牛進來…真得有做到狂牛與瘦肉精的全篩嗎?</span><span class="push-ipdatetime"> 12/20 10:26 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">maxn86</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 10:28 </span></div><div class="push"><span class="f1 hl push-tag">→ </span><span class="f3 hl push-userid">adifdtd</span><span class="f3 push-content">: 割闌尾是我幾個月來每日關注的重點 感謝團隊 (_ _)</span><span class="push-ipdatetime"> 12/20 10:35 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">boggae</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 10:40 </span></div><div class="push"><span class="f1 hl push-tag">→ </span><span class="f3 hl push-userid">angeltear15</span><span class="f3 push-content">: Ya</span><span class="push-ipdatetime"> 12/20 10:42 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">l1l1l1l1</span><span class="f3 push-content">: 板橋人選出這種垃圾不自殺負責嗎</span><span class="push-ipdatetime"> 12/20 10:46 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">windangellin</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 11:33 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">xxxx9659</span><span class="f3 push-content">: 加油 自己的爛委自己割 別選區的沒辦法幫</span><span class="push-ipdatetime"> 12/20 13:08 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">VTsuyoshi</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 13:22 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">endlesser</span><span class="f3 push-content">: 幹 這些政客能割掉最好</span><span class="push-ipdatetime"> 12/20 13:43 </span></div><div class="push"><span class="f1 hl push-tag">→ </span><span class="f3 hl push-userid">TY0842</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 13:46 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">pin0511</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 13:59 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">butywater</span><span class="f3 push-content">: 讓他回家吃自己</span><span class="push-ipdatetime"> 12/20 14:46 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">imchrisliu</span><span class="f3 push-content">: 推推</span><span class="push-ipdatetime"> 12/20 15:14 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">kt102441</span><span class="f3 push-content">: 高調</span><span class="push-ipdatetime"> 12/20 16:16 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">klimpan</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 17:01 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">Automatic620</span><span class="f3 push-content">: 高調</span><span class="push-ipdatetime"> 12/20 17:32 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">tomchun6</span><span class="f3 push-content">: 推 加油!</span><span class="push-ipdatetime"> 12/20 19:44 </span></div><div class="push"><span class="f1 hl push-tag">→ </span><span class="f3 hl push-userid">vp89dpoub5</span><span class="f3 push-content">: 推</span><span class="push-ipdatetime"> 12/20 21:44 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">lisa810824</span><span class="f3 push-content">: 今天經過板橋沒有簽到Q 你們還會在哪裡設據點呀</span><span class="push-ipdatetime"> 12/21 01:16 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">steveok12</span><span class="f3 push-content">: 把一些無效政客給送走吧!</span><span class="push-ipdatetime"> 12/21 23:28 </span></div></div> <div id="article-polling" data-pollurl="/poll/Gossiping/M.1419005416.A.F32.html?cacheKey=2052-1348174897&amp;offset=19729&amp;offset-sig=2de239edfcb097ae8418c68d84ba897e1a543238" data-longpollurl="/v1/longpoll?id=aa03d6a8051265083bb6da24f368fd2c34a2237b" data-offset="19729">推文自動更新已關閉</div> <div class="bbs-screen bbs-footer-message">本網站已依台灣網站內容分級規定處理。此區域為限制級,未滿十八歲者不得瀏覽。</div> </div> </body></html>
iultimatez/PTTScraper
result/M.1419005416.A.F32.html
HTML
mit
44,250
#include "class_5.h" #include "class_2.h" #include "class_0.h" #include "class_9.h" #include "class_6.h" #include "class_3.h" #include <lib_26/class_0.h> #include <lib_21/class_6.h> #include <lib_27/class_5.h> #include <lib_19/class_7.h> #include <lib_6/class_8.h> class_5::class_5() {} class_5::~class_5() {}
menify/sandbox
aql/benchmark/lib_31/class_5.cpp
C++
mit
311
// // HDRouter.h // Pods // // Created by mrdaios on 15/8/17. // // #import <Foundation/Foundation.h> @protocol HDViewProtocol; @protocol HDViewModelProtocol; @interface HDRouter : NSObject /** * ViewModel <=> ViewController */ @property (nonatomic, strong, readonly) NSMutableDictionary *viewModelViewMappings; + (instancetype)sharedInstance; - (id<HDViewProtocol>)viewControllerForViewModel:(id<HDViewModelProtocol>)viewModel; @end
Haidora/HaidoraBrick
Pod/Classes/Extension/Navigation/Utils/HDRouter.h
C
mit
445
<?php /** @var \xltxlm\h5skin\component\Power $this */ if(!defined(__FILE__)) { $vueid=md5(get_class($this)); define(__FILE__,true); ?> <script src="https://<?=$this->getSsoThrift()->getHosturl()?>:<?=$this->getSsoThrift()->getPort()?>/Vue/iPower/iPower.js?t=<?=date('Ymd')?>" ></script> <?php } if($this->isInit()){ return false;}?> <ipower power="<?=$this->getPower()?>" ajaxediturl="<?=$this->getAjaxEditUrl()?>" ctroller="<?=$this->getCtroller()?>" ></ipower>
xltxlm/H5skin
src/Component/Power.tpl.php
PHP
mit
476
# Introduction to DHCP basics and Terminology [source][1] ## DHCP introduction DHCP (Dynamic Host Configuration Protocol) is a standardized networking protocol used on IP networks that dynamically configures IP addresses and other information that is needed for Internet communication. DHCP allows computers and other devices to receive an IP address automatically from a central DHCP server, reducing the need for a network administrator or a user from having to configure these settings manually. DHCP servers maintain a database of available IP addresses and other kinds of addresses, such as a default route, and one or more DNS server addresses. DHCP may be used to configure some of these settings and the remaining settings may be manually configured. DHCP servers typically grant IP addresses to devices only for a limited interval. Devices are responsible for renewing their IP address lease before that interval expires, and must stop using the address once the interval has expired, if they have not been able to renew it. ## DHCP process There are a surprising number of steps which take place before your computer or mobile device can “talk” or “access” network / internet resources. Lets look at the steps which take place from the moment you either plug in a network cable or connect to a wireless network.. ##### 1. DHCPDISCOVER It is a DHCP message that marks the beginning of a DHCP interaction between the client (your home PC or mobile phone/tablet) and server (most likely your home router (BT homehub for example)). This message is sent by the client that is connected to the local subnet. It’s a broadcast message that uses 255.255.255.255 as destination IP address while the source IP address is 0.0.0.0 ##### 2. DHCPOFFER It is DHCP message that is sent in response to DHCPDISCOVER by a DHCP server (BT homehub) to DHCP client (your mobile phone/PC). This message contains the network configuration settings for the client that sent the DHCPDISCOVER message. ##### 3. DHCPREQUEST This DHCP message is sent in response to DHCPOFFER indicating that the client has accepted the network configuration sent in DHCPOFFER message from the server. ##### 4. DHCPACK This message is sent by the DHCP server in response to DHCPREQUEST received from the client. This message marks the end of the process that started with DHCPDISCOVER. The DHCPACK message is nothing but an acknowledgement by the DHCP server that authorizes the DHCP client to start using the network configuration it received from the DHCP server earlier. ##### 5. DHCPNAK This message is the exact opposite to DHCPACK described above. This message is sent by the DHCP server when it is not able to satisfy the DHCPREQUEST message from the client. ##### 6. DHCPDECLINE This message is sent from the DHCP client to the server in case the client finds that the IP address assigned by DHCP server is already in use. ##### 7. DHCPINFORM This message is sent from the DHCP client in case the IP address is statically configured on the client and only other network settings or configurations are desired to be dynamically acquired from DHCP server. ##### 8. DHCPRELEASE This message is sent by the DHCP client in case it wants to terminate the lease of network address it has be provided by DHCP server. Now we’ve looked at the steps involved, below shows a simple diagram using the steps above as to how DHCP commonly works. ![dhcp1](https://github.com/team-avesta/wiki/blob/master/engineering/sysops/dhcp/Images/dhcp1.png) ## DHCP Terminology [source][2] #### Pool/Scope The IP addresses available for clients to request. Many home networks today use a 192.168.x.0/24, like 192.168.1.0/24. This provides an address range of 192.168.1.1 – 192.168.1.254. Any address that is not taken in this range is available to be “leased” to clients on the network. #### Lease A lease is an IP address given to a client. This is called a lease because it expires after a certain period of time and can return to the address pool if necessary. Typically, a client will continue requesting the same leased IP address at half the configured lease time. For instance, if an address is leased to a device for 24 hours, it will request the address again at 12 hours to prevent the address from returning to the pool and being used by another device. If this request does not happen (perhaps if the device has left the network), the IP address will return to the pool and be reassigned to another device if one requests. #### IP Reservation With an IP reservation, you can instruct the DHCP server to always assign the same address to a device using that device’s MAC address. A MAC address is the hardcoded or virtual hardware address used by a device’s network interface card (NIC). #### IP Conflict An IP conflict occurs when 2 or more devices on a network attempt to request the same IP address. This typically happens when one device has a static IP address set that is within the address pool and another device attempts to request that IP address. To avoid this, it is best to configure an IP reservation for the static client or modify the address scope such that they do not contain the IP address statically assigned to the client. For instance, if a client is given 192.168.1.10, set the scope to only provide IP addresses from 192.168.1.11 – 192.168.1.253. This will allow all of the addresses below 192.168.1.11 to be statically assigned without conflicting with a DHCP host. ## The Concept of Lease As mentioned above, your device is simply assigned an IP address (leased) by the DHCP server. This means if the lease expires, the DHCP server is free to assign the same IP address to any other host or device requesting for the same. This is why a lot of networks which see frequent client connections and disconnects (for example wifi hot spots) will have very short lease times (2-4 hours up to 8-10 hours). Where as a lot of physical networks, which have desktops connected, you tend to find the lease is set for a longer time period (7-10 days). It’s also worth noting that the DHCP client tries to renew the lease after half of the lease time has expired. This is done by the exchange of DHCPREQUEST and DHCPACK messages. While doing all this, the client enters the renewing stage. ## Additional Links for Info * [Wiki page for dhcp server][3] [1]: http://www.michaelriccioni.com/introduction-to-dhcp-the-basics/ "permalink to http://www.michaelriccioni.com/introduction-to-dhcp-the-basics/" [2]: https://linuxacademy.com/howtoguides/posts/show/topic/13613-introduction-to-dhcp "Linux Academy link to DHCP" [3]: https://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol
team-avesta/wiki
engineering/sysops/dhcp/README.md
Markdown
mit
6,739
<!DOCTYPE HTML> <html> <head> <title>ractive-transitions-velocity test suite</title> <link rel='stylesheet' href='lib/qunit.css'> </head> <body> <div id='qunit'></div> <div id='qunit-fixture'></div> <script src='lib/qunit.js'></script> <script src='lib/qunit-assert-html.js'></script> <script src='../vendor/ractive/ractive-legacy.js'></script> <script src='../vendor/jquery/dist/jquery.js'></script> <script src='../vendor/velocity/jquery.velocity.js'></script> <script src='../vendor/velocity/velocity.ui.js'></script> <script src='../tmp/ractive-transitions-velocity.js'></script> <!-- load test modules --> <script src='tests.js'></script> </body> </html>
cfenzo/ractive-transitions-velocity
test/index.html
HTML
mit
684
<?php defined('BASEPATH') OR exit('No direct script access allowed'); /* |-------------------------------------------------------------------------- | Base Site URL |-------------------------------------------------------------------------- | | URL to your CodeIgniter root. Typically this will be your base URL, | WITH a trailing slash: | | http://example.com/ | | WARNING: You MUST set this value! | | If it is not set, then CodeIgniter will try guess the protocol and path | your installation, but due to security concerns the hostname will be set | to $_SERVER['SERVER_ADDR'] if available, or localhost otherwise. | The auto-detection mechanism exists only for convenience during | development and MUST NOT be used in production! | | If you need to allow multiple domains, remember that this file is still | a PHP script and you can easily do that on your own. | */ //$config['base_url'] = ''; $baseUrl = str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME'])); $baseUrl = trim($baseUrl, '/'); $baseUrl .= '/'; $proto = is_https() ? 'https://' : 'http://'; $config['base_url'] = $proto.$_SERVER['HTTP_HOST'].'/'.$baseUrl; /* |-------------------------------------------------------------------------- | Index File |-------------------------------------------------------------------------- | | Typically this will be your index.php file, unless you've renamed it to | something else. If you are using mod_rewrite to remove the page set this | variable so that it is blank. | */ $config['index_page'] = 'index.php'; /* |-------------------------------------------------------------------------- | URI PROTOCOL |-------------------------------------------------------------------------- | | This item determines which server global should be used to retrieve the | URI string. The default setting of 'REQUEST_URI' works for most servers. | If your links do not seem to work, try one of the other delicious flavors: | | 'REQUEST_URI' Uses $_SERVER['REQUEST_URI'] | 'QUERY_STRING' Uses $_SERVER['QUERY_STRING'] | 'PATH_INFO' Uses $_SERVER['PATH_INFO'] | | WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded! */ $config['uri_protocol'] = 'REQUEST_URI'; /* |-------------------------------------------------------------------------- | URL suffix |-------------------------------------------------------------------------- | | This option allows you to add a suffix to all URLs generated by CodeIgniter. | For more information please see the user guide: | | https://codeigniter.com/user_guide/general/urls.html */ $config['url_suffix'] = ''; /* |-------------------------------------------------------------------------- | Default Language |-------------------------------------------------------------------------- | | This determines which set of language files should be used. Make sure | there is an available translation if you intend to use something other | than english. | */ $config['language'] = 'english'; /* |-------------------------------------------------------------------------- | Default Character Set |-------------------------------------------------------------------------- | | This determines which character set is used by default in various methods | that require a character set to be provided. | | See http://php.net/htmlspecialchars for a list of supported charsets. | */ $config['charset'] = 'UTF-8'; /* |-------------------------------------------------------------------------- | Enable/Disable System Hooks |-------------------------------------------------------------------------- | | If you would like to use the 'hooks' feature you must enable it by | setting this variable to TRUE (boolean). See the user guide for details. | */ $config['enable_hooks'] = TRUE; /* |-------------------------------------------------------------------------- | Class Extension Prefix |-------------------------------------------------------------------------- | | This item allows you to set the filename/classname prefix when extending | native libraries. For more information please see the user guide: | | https://codeigniter.com/user_guide/general/core_classes.html | https://codeigniter.com/user_guide/general/creating_libraries.html | */ $config['subclass_prefix'] = 'MY_'; /* |-------------------------------------------------------------------------- | Composer auto-loading |-------------------------------------------------------------------------- | | Enabling this setting will tell CodeIgniter to look for a Composer | package auto-loader script in application/vendor/autoload.php. | | $config['composer_autoload'] = TRUE; | | Or if you have your vendor/ directory located somewhere else, you | can opt to set a specific path as well: | | $config['composer_autoload'] = '/path/to/vendor/autoload.php'; | | For more information about Composer, please visit http://getcomposer.org/ | | Note: This will NOT disable or override the CodeIgniter-specific | autoloading (application/config/autoload.php) */ $config['composer_autoload'] = FALSE; /* |-------------------------------------------------------------------------- | Allowed URL Characters |-------------------------------------------------------------------------- | | This lets you specify which characters are permitted within your URLs. | When someone tries to submit a URL with disallowed characters they will | get a warning message. | | As a security measure you are STRONGLY encouraged to restrict URLs to | as few characters as possible. By default only these are allowed: a-z 0-9~%.:_- | | Leave blank to allow all characters -- but only if you are insane. | | The configured value is actually a regular expression character group | and it will be executed as: ! preg_match('/^[<permitted_uri_chars>]+$/i | | DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!! | */ $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-'; /* |-------------------------------------------------------------------------- | Enable Query Strings |-------------------------------------------------------------------------- | | By default CodeIgniter uses search-engine friendly segment based URLs: | example.com/who/what/where/ | | You can optionally enable standard query string based URLs: | example.com?who=me&what=something&where=here | | Options are: TRUE or FALSE (boolean) | | The other items let you set the query string 'words' that will | invoke your controllers and its functions: | example.com/index.php?c=controller&m=function | | Please note that some of the helpers won't work as expected when | this feature is enabled, since CodeIgniter is designed primarily to | use segment based URLs. | */ $config['enable_query_strings'] = FALSE; $config['controller_trigger'] = 'c'; $config['function_trigger'] = 'm'; $config['directory_trigger'] = 'd'; /* |-------------------------------------------------------------------------- | Allow $_GET array |-------------------------------------------------------------------------- | | By default CodeIgniter enables access to the $_GET array. If for some | reason you would like to disable it, set 'allow_get_array' to FALSE. | | WARNING: This feature is DEPRECATED and currently available only | for backwards compatibility purposes! | */ $config['allow_get_array'] = TRUE; /* |-------------------------------------------------------------------------- | Error Logging Threshold |-------------------------------------------------------------------------- | | You can enable error logging by setting a threshold over zero. The | threshold determines what gets logged. Threshold options are: | | 0 = Disables logging, Error logging TURNED OFF | 1 = Error Messages (including PHP errors) | 2 = Debug Messages | 3 = Informational Messages | 4 = All Messages | | You can also pass an array with threshold levels to show individual error types | | array(2) = Debug Messages, without Error Messages | | For a live site you'll usually only enable Errors (1) to be logged otherwise | your log files will fill up very fast. | */ $config['log_threshold'] = 0; /* |-------------------------------------------------------------------------- | Error Logging Directory Path |-------------------------------------------------------------------------- | | Leave this BLANK unless you would like to set something other than the default | application/logs/ directory. Use a full server path with trailing slash. | */ $config['log_path'] = ''; /* |-------------------------------------------------------------------------- | Log File Extension |-------------------------------------------------------------------------- | | The default filename extension for log files. The default 'php' allows for | protecting the log files via basic scripting, when they are to be stored | under a publicly accessible directory. | | Note: Leaving it blank will default to 'php'. | */ $config['log_file_extension'] = ''; /* |-------------------------------------------------------------------------- | Log File Permissions |-------------------------------------------------------------------------- | | The file system permissions to be applied on newly created log files. | | IMPORTANT: This MUST be an integer (no quotes) and you MUST use octal | integer notation (i.e. 0700, 0644, etc.) */ $config['log_file_permissions'] = 0644; /* |-------------------------------------------------------------------------- | Date Format for Logs |-------------------------------------------------------------------------- | | Each item that is logged has an associated date. You can use PHP date | codes to set your own date formatting | */ $config['log_date_format'] = 'Y-m-d H:i:s'; /* |-------------------------------------------------------------------------- | Error Views Directory Path |-------------------------------------------------------------------------- | | Leave this BLANK unless you would like to set something other than the default | application/views/errors/ directory. Use a full server path with trailing slash. | */ $config['error_views_path'] = ''; /* |-------------------------------------------------------------------------- | Cache Directory Path |-------------------------------------------------------------------------- | | Leave this BLANK unless you would like to set something other than the default | application/cache/ directory. Use a full server path with trailing slash. | */ $config['cache_path'] = ''; /* |-------------------------------------------------------------------------- | Cache Include Query String |-------------------------------------------------------------------------- | | Whether to take the URL query string into consideration when generating | output cache files. Valid options are: | | FALSE = Disabled | TRUE = Enabled, take all query parameters into account. | Please be aware that this may result in numerous cache | files generated for the same page over and over again. | array('q') = Enabled, but only take into account the specified list | of query parameters. | */ $config['cache_query_string'] = FALSE; /* |-------------------------------------------------------------------------- | Encryption Key |-------------------------------------------------------------------------- | | If you use the Encryption class, you must set an encryption key. | See the user guide for more info. | | https://codeigniter.com/user_guide/libraries/encryption.html | */ $config['encryption_key'] = ''; /* |-------------------------------------------------------------------------- | Session Variables |-------------------------------------------------------------------------- | | 'sess_driver' | | The storage driver to use: files, database, redis, memcached | | 'sess_cookie_name' | | The session cookie name, must contain only [0-9a-z_-] characters | | 'sess_expiration' | | The number of SECONDS you want the session to last. | Setting to 0 (zero) means expire when the browser is closed. | | 'sess_save_path' | | The location to save sessions to, driver dependent. | | For the 'files' driver, it's a path to a writable directory. | WARNING: Only absolute paths are supported! | | For the 'database' driver, it's a table name. | Please read up the manual for the format with other session drivers. | | IMPORTANT: You are REQUIRED to set a valid save path! | | 'sess_match_ip' | | Whether to match the user's IP address when reading the session data. | | WARNING: If you're using the database driver, don't forget to update | your session table's PRIMARY KEY when changing this setting. | | 'sess_time_to_update' | | How many seconds between CI regenerating the session ID. | | 'sess_regenerate_destroy' | | Whether to destroy session data associated with the old session ID | when auto-regenerating the session ID. When set to FALSE, the data | will be later deleted by the garbage collector. | | Other session cookie settings are shared with the rest of the application, | except for 'cookie_prefix' and 'cookie_httponly', which are ignored here. | */ $config['sess_driver'] = 'files'; $config['sess_cookie_name'] = 'ci_session'; $config['sess_expiration'] = 7200; $config['sess_save_path'] = NULL; $config['sess_match_ip'] = FALSE; $config['sess_time_to_update'] = 300; $config['sess_regenerate_destroy'] = FALSE; /* |-------------------------------------------------------------------------- | Cookie Related Variables |-------------------------------------------------------------------------- | | 'cookie_prefix' = Set a cookie name prefix if you need to avoid collisions | 'cookie_domain' = Set to .your-domain.com for site-wide cookies | 'cookie_path' = Typically will be a forward slash | 'cookie_secure' = Cookie will only be set if a secure HTTPS connection exists. | 'cookie_httponly' = Cookie will only be accessible via HTTP(S) (no javascript) | | Note: These settings (with the exception of 'cookie_prefix' and | 'cookie_httponly') will also affect sessions. | */ $config['cookie_prefix'] = ''; $config['cookie_domain'] = ''; $config['cookie_path'] = '/'; $config['cookie_secure'] = FALSE; $config['cookie_httponly'] = FALSE; /* |-------------------------------------------------------------------------- | Standardize newlines |-------------------------------------------------------------------------- | | Determines whether to standardize newline characters in input data, | meaning to replace \r\n, \r, \n occurrences with the PHP_EOL value. | | WARNING: This feature is DEPRECATED and currently available only | for backwards compatibility purposes! | */ $config['standardize_newlines'] = FALSE; /* |-------------------------------------------------------------------------- | Global XSS Filtering |-------------------------------------------------------------------------- | | Determines whether the XSS filter is always active when GET, POST or | COOKIE data is encountered | | WARNING: This feature is DEPRECATED and currently available only | for backwards compatibility purposes! | */ $config['global_xss_filtering'] = FALSE; /* |-------------------------------------------------------------------------- | Cross Site Request Forgery |-------------------------------------------------------------------------- | Enables a CSRF cookie token to be set. When set to TRUE, token will be | checked on a submitted form. If you are accepting user data, it is strongly | recommended CSRF protection be enabled. | | 'csrf_token_name' = The token name | 'csrf_cookie_name' = The cookie name | 'csrf_expire' = The number in seconds the token should expire. | 'csrf_regenerate' = Regenerate token on every submission | 'csrf_exclude_uris' = Array of URIs which ignore CSRF checks */ $config['csrf_protection'] = FALSE; $config['csrf_token_name'] = 'csrf_test_name'; $config['csrf_cookie_name'] = 'csrf_cookie_name'; $config['csrf_expire'] = 7200; $config['csrf_regenerate'] = TRUE; $config['csrf_exclude_uris'] = array(); /* |-------------------------------------------------------------------------- | Output Compression |-------------------------------------------------------------------------- | | Enables Gzip output compression for faster page loads. When enabled, | the output class will test whether your server supports Gzip. | Even if it does, however, not all browsers support compression | so enable only if you are reasonably sure your visitors can handle it. | | Only used if zlib.output_compression is turned off in your php.ini. | Please do not use it together with httpd-level output compression. | | VERY IMPORTANT: If you are getting a blank page when compression is enabled it | means you are prematurely outputting something to your browser. It could | even be a line of whitespace at the end of one of your scripts. For | compression to work, nothing can be sent before the output buffer is called | by the output class. Do not 'echo' any values with compression enabled. | */ $config['compress_output'] = FALSE; /* |-------------------------------------------------------------------------- | Master Time Reference |-------------------------------------------------------------------------- | | Options are 'local' or any PHP supported timezone. This preference tells | the system whether to use your server's local time as the master 'now' | reference, or convert it to the configured one timezone. See the 'date | helper' page of the user guide for information regarding date handling. | */ $config['time_reference'] = 'local'; /* |-------------------------------------------------------------------------- | Rewrite PHP Short Tags |-------------------------------------------------------------------------- | | If your PHP installation does not have short tag support enabled CI | can rewrite the tags on-the-fly, enabling you to utilize that syntax | in your view files. Options are TRUE or FALSE (boolean) | | Note: You need to have eval() enabled for this to work. | */ $config['rewrite_short_tags'] = FALSE; /* |-------------------------------------------------------------------------- | Reverse Proxy IPs |-------------------------------------------------------------------------- | | If your server is behind a reverse proxy, you must whitelist the proxy | IP addresses from which CodeIgniter should trust headers such as | HTTP_X_FORWARDED_FOR and HTTP_CLIENT_IP in order to properly identify | the visitor's IP address. | | You can use both an array or a comma-separated list of proxy addresses, | as well as specifying whole subnets. Here are a few examples: | | Comma-separated: '10.0.1.200,192.168.5.0/24' | Array: array('10.0.1.200', '192.168.5.0/24') */ $config['proxy_ips'] = '';
634894289/item_check
application/config/config.php
PHP
mit
18,667
<!DOCTYPE html> <html> <head> <title>A URL Shortener MicroService</title> <link href="/public/css/main.css" rel="stylesheet" type="text/css"> </head> <body> <div class="container"> <br /> <p class="clementine-text">A URL Shortener MicroService</p> <div class="container"> <blockquote> <h1>User stories:</h1> <p>I can pass a URL as a parameter and I will receive a shortened URL in the JSON response.</p> <p>When I visit that shortened URL, it will redirect me to my original link.</p> </blockquote> <h3>Example creation usage:</h3> <code>https://urlshortenerapi.herokuapp.com/https://www.google.com</code> <br> <code>https://urlshortenerapi.herokuapp.com/http://freecodecamp.com/news</code> <h3>Example creation output:</h3> <code> { "original": "http://freecodecamp.com/news", "shortened": "https://urlshortenerapi.herokuapp.com/4" } </code> <h3>Usage:</h3> <code>https://urlshortenerapi.herokuapp.com/4</code> <h3>Will redirect to:</h3> <code>http://freecodecamp.com/news</code> </div> </div> <script type="text/javascript" src="common/ajax-functions.js"></script> <script type="text/javascript" src="controllers/clickController.client.js"></script> <script type="text/javascript" src="controllers/userController.client.js"></script> </body> </html>
christoph-phillips/URLShortenerAPI
public/index.html
HTML
mit
1,466
namespace Chushka.Models.Enums { public enum RoleType { User = 0, Admin = 1 } }
stoyanov7/SoftwareUniversity
C#Development/C#Web/C#WebDevelopmentBasics/Exams/Chushka/Chushka.Models/Enums/RoleType.cs
C#
mit
117
using PsISEProjectExplorer.Services; using PsISEProjectExplorer.UI.Helpers; using PsISEProjectExplorer.UI.IseIntegration; using PsISEProjectExplorer.UI.ViewModel; using System; using System.IO; using System.Linq; namespace PsISEProjectExplorer.Commands { [Component] public class DeleteItemCommand : Command { private readonly TreeViewModel treeViewModel; private readonly MessageBoxHelper messageBoxHelper; private readonly IseIntegrator iseIntegrator; private readonly FilesPatternProvider filesPatternProvider; private readonly FileSystemOperationsService fileSystemOperationsService; private readonly UnsavedFileChecker unsavedFileChecker; public DeleteItemCommand(TreeViewModel treeViewModel, MessageBoxHelper messageBoxHelper, IseIntegrator iseIntegrator, FilesPatternProvider filesPatternProvider, FileSystemOperationsService fileSystemOperationsService, UnsavedFileChecker unsavedFileChecker) { this.treeViewModel = treeViewModel; this.messageBoxHelper = messageBoxHelper; this.iseIntegrator = iseIntegrator; this.filesPatternProvider = filesPatternProvider; this.fileSystemOperationsService = fileSystemOperationsService; this.unsavedFileChecker = unsavedFileChecker; } public void Execute() { var selectedItem = this.treeViewModel.SelectedItem; if (selectedItem == null) { return; } if (!this.unsavedFileChecker.EnsureCurrentlyOpenedFileIsSaved()) { return; } int numFilesInside = 0; try { numFilesInside = Directory.GetFileSystemEntries(selectedItem.Path).Count(); } catch (Exception) { // ignore - this only has impact on message } string message = numFilesInside == 0 ? String.Format("'{0}' will be deleted permanently.", selectedItem.Path) : String.Format("'{0}' will be deleted permanently (together with {1} items inside).", selectedItem.Path, numFilesInside); if (this.messageBoxHelper.ShowConfirmMessage(message)) { try { this.iseIntegrator.CloseFile(selectedItem.Path); this.filesPatternProvider.RemoveAdditionalPath(selectedItem.Path); fileSystemOperationsService.DeleteFileOrDirectory(selectedItem.Path); } catch (Exception e) { this.messageBoxHelper.ShowError("Failed to delete: " + e.Message); } } } } }
mgr32/PsISEProjectExplorer
PsISEProjectExplorer/Commands/DeleteItemCommand.cs
C#
mit
2,902
package jwe import ( "crypto" "crypto/aes" "crypto/cipher" "crypto/ecdsa" "crypto/rand" "crypto/rsa" "crypto/sha1" "crypto/sha256" "crypto/subtle" "encoding/binary" "fmt" "hash" "github.com/lestrrat/go-jwx/internal/concatkdf" "github.com/lestrrat/go-jwx/internal/debug" "github.com/lestrrat/go-jwx/jwa" "github.com/pkg/errors" ) // NewKeyWrapEncrypt creates a key-wrap encryptor using AES-CGM. // Although the name suggests otherwise, this does the decryption as well. func NewKeyWrapEncrypt(alg jwa.KeyEncryptionAlgorithm, sharedkey []byte) (KeyWrapEncrypt, error) { return KeyWrapEncrypt{ alg: alg, sharedkey: sharedkey, }, nil } // Algorithm returns the key encryption algorithm being used func (kw KeyWrapEncrypt) Algorithm() jwa.KeyEncryptionAlgorithm { return kw.alg } // Kid returns the key ID associated with this encrypter func (kw KeyWrapEncrypt) Kid() string { return kw.KeyID } // KeyDecrypt decrypts the encrypted key using AES-CGM key unwrap func (kw KeyWrapEncrypt) KeyDecrypt(enckey []byte) ([]byte, error) { block, err := aes.NewCipher(kw.sharedkey) if err != nil { return nil, errors.Wrap(err, "failed to create cipher from shared key") } cek, err := keyunwrap(block, enckey) if err != nil { return nil, errors.Wrap(err, "failed to unwrap data") } return cek, nil } // KeyEncrypt encrypts the given content encryption key func (kw KeyWrapEncrypt) KeyEncrypt(cek []byte) (ByteSource, error) { block, err := aes.NewCipher(kw.sharedkey) if err != nil { return nil, errors.Wrap(err, "failed to create cipher from shared key") } encrypted, err := keywrap(block, cek) if err != nil { return nil, errors.Wrap(err, `keywrap: failed to wrap key`) } return ByteKey(encrypted), nil } // NewEcdhesKeyWrapEncrypt creates a new key encrypter based on ECDH-ES func NewEcdhesKeyWrapEncrypt(alg jwa.KeyEncryptionAlgorithm, key *ecdsa.PublicKey) (*EcdhesKeyWrapEncrypt, error) { generator, err := NewEcdhesKeyGenerate(alg, key) if err != nil { return nil, errors.Wrap(err, "failed to create key generator") } return &EcdhesKeyWrapEncrypt{ algorithm: alg, generator: generator, }, nil } // Algorithm returns the key encryption algorithm being used func (kw EcdhesKeyWrapEncrypt) Algorithm() jwa.KeyEncryptionAlgorithm { return kw.algorithm } // Kid returns the key ID associated with this encrypter func (kw EcdhesKeyWrapEncrypt) Kid() string { return kw.KeyID } // KeyEncrypt encrypts the content encryption key using ECDH-ES func (kw EcdhesKeyWrapEncrypt) KeyEncrypt(cek []byte) (ByteSource, error) { kg, err := kw.generator.KeyGenerate() if err != nil { return nil, errors.Wrap(err, "failed to create key generator") } bwpk, ok := kg.(ByteWithECPrivateKey) if !ok { return nil, errors.New("key generator generated invalid key (expected ByteWithECPrivateKey)") } block, err := aes.NewCipher(bwpk.Bytes()) if err != nil { return nil, errors.Wrap(err, "failed to generate cipher from generated key") } jek, err := keywrap(block, cek) if err != nil { return nil, errors.Wrap(err, "failed to wrap data") } bwpk.ByteKey = ByteKey(jek) return bwpk, nil } // NewEcdhesKeyWrapDecrypt creates a new key decrypter using ECDH-ES func NewEcdhesKeyWrapDecrypt(alg jwa.KeyEncryptionAlgorithm, pubkey *ecdsa.PublicKey, apu, apv []byte, privkey *ecdsa.PrivateKey) *EcdhesKeyWrapDecrypt { return &EcdhesKeyWrapDecrypt{ algorithm: alg, apu: apu, apv: apv, privkey: privkey, pubkey: pubkey, } } // Algorithm returns the key encryption algorithm being used func (kw EcdhesKeyWrapDecrypt) Algorithm() jwa.KeyEncryptionAlgorithm { return kw.algorithm } // KeyDecrypt decrypts the encrypted key using ECDH-ES func (kw EcdhesKeyWrapDecrypt) KeyDecrypt(enckey []byte) ([]byte, error) { var keysize uint32 switch kw.algorithm { case jwa.ECDH_ES_A128KW: keysize = 16 case jwa.ECDH_ES_A192KW: keysize = 24 case jwa.ECDH_ES_A256KW: keysize = 32 default: return nil, errors.Wrap(ErrUnsupportedAlgorithm, "invalid ECDH-ES key wrap algorithm") } privkey := kw.privkey pubkey := kw.pubkey pubinfo := make([]byte, 4) binary.BigEndian.PutUint32(pubinfo, keysize*8) z, _ := privkey.PublicKey.Curve.ScalarMult(pubkey.X, pubkey.Y, privkey.D.Bytes()) kdf := concatkdf.New(crypto.SHA256, []byte(kw.algorithm.String()), z.Bytes(), kw.apu, kw.apv, pubinfo, []byte{}) kek := make([]byte, keysize) kdf.Read(kek) block, err := aes.NewCipher(kek) if err != nil { return nil, errors.Wrap(err, "failed to create cipher for ECDH-ES key wrap") } return keyunwrap(block, enckey) } // NewRSAOAEPKeyEncrypt creates a new key encrypter using RSA OAEP func NewRSAOAEPKeyEncrypt(alg jwa.KeyEncryptionAlgorithm, pubkey *rsa.PublicKey) (*RSAOAEPKeyEncrypt, error) { switch alg { case jwa.RSA_OAEP, jwa.RSA_OAEP_256: default: return nil, errors.Wrap(ErrUnsupportedAlgorithm, "invalid RSA OAEP encrypt algorithm") } return &RSAOAEPKeyEncrypt{ alg: alg, pubkey: pubkey, }, nil } // NewRSAPKCSKeyEncrypt creates a new key encrypter using PKCS1v15 func NewRSAPKCSKeyEncrypt(alg jwa.KeyEncryptionAlgorithm, pubkey *rsa.PublicKey) (*RSAPKCSKeyEncrypt, error) { switch alg { case jwa.RSA1_5: default: return nil, errors.Wrap(ErrUnsupportedAlgorithm, "invalid RSA PKCS encrypt algorithm") } return &RSAPKCSKeyEncrypt{ alg: alg, pubkey: pubkey, }, nil } // Algorithm returns the key encryption algorithm being used func (e RSAPKCSKeyEncrypt) Algorithm() jwa.KeyEncryptionAlgorithm { return e.alg } // Kid returns the key ID associated with this encrypter func (e RSAPKCSKeyEncrypt) Kid() string { return e.KeyID } // Algorithm returns the key encryption algorithm being used func (e RSAOAEPKeyEncrypt) Algorithm() jwa.KeyEncryptionAlgorithm { return e.alg } // Kid returns the key ID associated with this encrypter func (e RSAOAEPKeyEncrypt) Kid() string { return e.KeyID } // KeyEncrypt encrypts the content encryption key using RSA PKCS1v15 func (e RSAPKCSKeyEncrypt) KeyEncrypt(cek []byte) (ByteSource, error) { if e.alg != jwa.RSA1_5 { return nil, errors.Wrap(ErrUnsupportedAlgorithm, "invalid RSA PKCS encrypt algorithm") } encrypted, err := rsa.EncryptPKCS1v15(rand.Reader, e.pubkey, cek) if err != nil { return nil, errors.Wrap(err, "failed to encrypt using PKCS1v15") } return ByteKey(encrypted), nil } // KeyEncrypt encrypts the content encryption key using RSA OAEP func (e RSAOAEPKeyEncrypt) KeyEncrypt(cek []byte) (ByteSource, error) { var hash hash.Hash switch e.alg { case jwa.RSA_OAEP: hash = sha1.New() case jwa.RSA_OAEP_256: hash = sha256.New() default: return nil, errors.New("failed to generate key encrypter for RSA-OAEP: RSA_OAEP/RSA_OAEP_256 required") } encrypted, err := rsa.EncryptOAEP(hash, rand.Reader, e.pubkey, cek, []byte{}) if err != nil { return nil, errors.Wrap(err, `failed to OAEP encrypt`) } return ByteKey(encrypted), nil } // NewRSAPKCS15KeyDecrypt creates a new decrypter using RSA PKCS1v15 func NewRSAPKCS15KeyDecrypt(alg jwa.KeyEncryptionAlgorithm, privkey *rsa.PrivateKey, keysize int) *RSAPKCS15KeyDecrypt { generator := NewRandomKeyGenerate(keysize * 2) return &RSAPKCS15KeyDecrypt{ alg: alg, privkey: privkey, generator: generator, } } // Algorithm returns the key encryption algorithm being used func (d RSAPKCS15KeyDecrypt) Algorithm() jwa.KeyEncryptionAlgorithm { return d.alg } // KeyDecrypt decryptes the encrypted key using RSA PKCS1v1.5 func (d RSAPKCS15KeyDecrypt) KeyDecrypt(enckey []byte) ([]byte, error) { if debug.Enabled { debug.Printf("START PKCS.KeyDecrypt") } // Hey, these notes and workarounds were stolen from go-jose defer func() { // DecryptPKCS1v15SessionKey sometimes panics on an invalid payload // because of an index out of bounds error, which we want to ignore. // This has been fixed in Go 1.3.1 (released 2014/08/13), the recover() // only exists for preventing crashes with unpatched versions. // See: https://groups.google.com/forum/#!topic/golang-dev/7ihX6Y6kx9k // See: https://code.google.com/p/go/source/detail?r=58ee390ff31602edb66af41ed10901ec95904d33 _ = recover() }() // Perform some input validation. expectedlen := d.privkey.PublicKey.N.BitLen() / 8 if expectedlen != len(enckey) { // Input size is incorrect, the encrypted payload should always match // the size of the public modulus (e.g. using a 2048 bit key will // produce 256 bytes of output). Reject this since it's invalid input. return nil, fmt.Errorf( "input size for key decrypt is incorrect (expected %d, got %d)", expectedlen, len(enckey), ) } var err error bk, err := d.generator.KeyGenerate() if err != nil { return nil, errors.New("failed to generate key") } cek := bk.Bytes() // When decrypting an RSA-PKCS1v1.5 payload, we must take precautions to // prevent chosen-ciphertext attacks as described in RFC 3218, "Preventing // the Million Message Attack on Cryptographic Message Syntax". We are // therefore deliberatly ignoring errors here. err = rsa.DecryptPKCS1v15SessionKey(rand.Reader, d.privkey, enckey, cek) if err != nil { return nil, errors.Wrap(err, "failed to decrypt via PKCS1v15") } return cek, nil } // NewRSAOAEPKeyDecrypt creates a new key decrypter using RSA OAEP func NewRSAOAEPKeyDecrypt(alg jwa.KeyEncryptionAlgorithm, privkey *rsa.PrivateKey) (*RSAOAEPKeyDecrypt, error) { switch alg { case jwa.RSA_OAEP, jwa.RSA_OAEP_256: default: return nil, errors.Wrap(ErrUnsupportedAlgorithm, "invalid RSA OAEP decrypt algorithm") } return &RSAOAEPKeyDecrypt{ alg: alg, privkey: privkey, }, nil } // Algorithm returns the key encryption algorithm being used func (d RSAOAEPKeyDecrypt) Algorithm() jwa.KeyEncryptionAlgorithm { return d.alg } // KeyDecrypt decryptes the encrypted key using RSA OAEP func (d RSAOAEPKeyDecrypt) KeyDecrypt(enckey []byte) ([]byte, error) { if debug.Enabled { debug.Printf("START OAEP.KeyDecrypt") } var hash hash.Hash switch d.alg { case jwa.RSA_OAEP: hash = sha1.New() case jwa.RSA_OAEP_256: hash = sha256.New() default: return nil, errors.New("failed to generate key encrypter for RSA-OAEP: RSA_OAEP/RSA_OAEP_256 required") } return rsa.DecryptOAEP(hash, rand.Reader, d.privkey, enckey, []byte{}) } // Decrypt for DirectDecrypt does not do anything other than // return a copy of the embedded key func (d DirectDecrypt) Decrypt() ([]byte, error) { cek := make([]byte, len(d.Key)) copy(cek, d.Key) return cek, nil } var keywrapDefaultIV = []byte{0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6} const keywrapChunkLen = 8 func keywrap(kek cipher.Block, cek []byte) ([]byte, error) { if len(cek)%8 != 0 { return nil, ErrInvalidBlockSize } n := len(cek) / keywrapChunkLen r := make([][]byte, n) for i := 0; i < n; i++ { r[i] = make([]byte, keywrapChunkLen) copy(r[i], cek[i*keywrapChunkLen:]) } buffer := make([]byte, keywrapChunkLen*2) tBytes := make([]byte, keywrapChunkLen) copy(buffer, keywrapDefaultIV) for t := 0; t < 6*n; t++ { copy(buffer[keywrapChunkLen:], r[t%n]) kek.Encrypt(buffer, buffer) binary.BigEndian.PutUint64(tBytes, uint64(t+1)) for i := 0; i < keywrapChunkLen; i++ { buffer[i] = buffer[i] ^ tBytes[i] } copy(r[t%n], buffer[keywrapChunkLen:]) } out := make([]byte, (n+1)*keywrapChunkLen) copy(out, buffer[:keywrapChunkLen]) for i := range r { copy(out[(i+1)*8:], r[i]) } return out, nil } func keyunwrap(block cipher.Block, ciphertxt []byte) ([]byte, error) { if len(ciphertxt)%keywrapChunkLen != 0 { return nil, ErrInvalidBlockSize } n := (len(ciphertxt) / keywrapChunkLen) - 1 r := make([][]byte, n) for i := range r { r[i] = make([]byte, keywrapChunkLen) copy(r[i], ciphertxt[(i+1)*keywrapChunkLen:]) } buffer := make([]byte, keywrapChunkLen*2) tBytes := make([]byte, keywrapChunkLen) copy(buffer[:keywrapChunkLen], ciphertxt[:keywrapChunkLen]) for t := 6*n - 1; t >= 0; t-- { binary.BigEndian.PutUint64(tBytes, uint64(t+1)) for i := 0; i < keywrapChunkLen; i++ { buffer[i] = buffer[i] ^ tBytes[i] } copy(buffer[keywrapChunkLen:], r[t%n]) block.Decrypt(buffer, buffer) copy(r[t%n], buffer[keywrapChunkLen:]) } if subtle.ConstantTimeCompare(buffer[:keywrapChunkLen], keywrapDefaultIV) == 0 { return nil, errors.New("keywrap: failed to unwrap key") } out := make([]byte, n*keywrapChunkLen) for i := range r { copy(out[i*keywrapChunkLen:], r[i]) } return out, nil }
lestrrat/go-jwx
jwe/key_encrypt.go
GO
mit
12,484
(function ($) { "use strict"; Dropzone.options.myDropzone = { // Prevents Dropzone from uploading dropped files immediately autoProcessQueue: false , init: function () { var submitButton = document.querySelector("#submit-all") myDropzone = this; // closure submitButton.addEventListener("click", function () { myDropzone.processQueue(); // Tell Dropzone to process all queued files. }); // You might want to show the submit button only when // files are dropped here: this.on("addedfile", function () { // Show submit button here and/or inform user to click it. }); } }; })(jQuery);
witoldlitwin/CoreQuiz
src/CoreQuiz/wwwroot/js/pages/file-upload.js
JavaScript
mit
907
// @flow /* eslint-disable */ import { periodic, now, merge, never, newStream, propagateEventTask } from '@most/core' import {disposeBoth, disposeWith} from '@most/disposable' import {newDefaultScheduler, asap} from '@most/scheduler' import M from '../m' import tree from './element' import type {Pith} from '../vtree/rvnode' import Counter1 from '../piths/counter1' import Counter2 from '../piths/counter2' const elm = document.getElementById('root-node') if (!elm) throw new Error() const count = () => M.of(periodic(1000)) .scan(a => a + 1, 0) .skip(1) .map(i => 'h' + i) .take(10) .continueWith(count) .valueOf() const ring = pith => pith // (put, on) => pith({...put}, on) const rez = tree(elm)(Test()) const disposable = M.of(rez).$.run( { event: (t, e) => {}, end: t => {}, error: (t, err) => {} }, newDefaultScheduler() ) setTimeout(disposable.dispose.bind(disposable), 20000) function Test() { return ring((put, on) => { function f(vnode, cb) { if (f.patchedNodes.has(vnode)) return const listener = () => console.log('patch', vnode) vnode.node.addEventListener('click', listener) console.log('addEventListener') f.patchedNodes.set(vnode, () => { console.log('removeEventListener') vnode.node.removeEventListener('click', listener) }) } f.patchedNodes = new Map() put.put( newStream((sink, scheduler) => { console.log('sink') return disposeBoth( asap(propagateEventTask(f, sink), scheduler), disposeWith(() => { f.patchedNodes.forEach(d => d()) f.patchedNodes.clear() }, null) ) }) ) // put.text('text') put.node('div')(put => { put.node('button', {on: {click: 'a'}})(put => put.text('a')) put.node('button', {on: {click: 'b'}})(put => put.text('b')) put.node('button', {on: {click: 'o'}})(put => put.text('o')) }) put.node('h4')(put => put.text(count())) put.node('div', {}, 'key')( M.of(on) .filter(x => typeof x.action === 'string') .map(x => { if (x.action === 'a') return Counter1(0) if (x.action === 'b') return Counter1(1) return Counter2(1) }) .startWith(put => put.node('h1')(put => put.text('select'))) .tap(pith => console.timeStamp(pith.toString())) .valueOf() ) }) } function C(): Pith { return (put, on) => { put.node('button', {on: {click: 'A'}})(put => { put.text('A') }) put.text( M.of(on) .map(x => x.action) .startWith('') .valueOf() ) } }
Antares007/sakhe
src/vtree/test-vnode0.js
JavaScript
mit
2,682
/* * The MIT License * * Copyright 2015 Adam Kowalewski. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package pl.otwartapw.opw.ws.obwodowa.bean; import java.util.List; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.Query; import pl.otwartapw.opw.ws.obwodowa.entity.OpwLink; import pl.otwartapw.opw.ws.obwodowa.entity.OpwWynik; /** * * @author Adam Kowalewski */ @Stateless public class LinkBean extends AbstractOpwFacade<OpwLink> { @PersistenceContext(unitName = PU_OPW) private EntityManager em; public LinkBean() { super(OpwLink.class); } @Override protected EntityManager getEntityManager() { return em; } public List<OpwLink> findAll(OpwWynik wynik, boolean active){ Query q = em.createQuery("SELECT o FROM OpwLink o WHERE o.opwWynikId = :wynik AND o.active = :active"); q.setParameter("wynik", wynik); q.setParameter("active", active); List<OpwLink> result = q.getResultList(); return result; } }
OtwartaPlatformaWyborcza/opw-ws-obwodowa
opw-ws-obwodowa/src/main/java/pl/otwartapw/opw/ws/obwodowa/bean/LinkBean.java
Java
mit
2,149
var socket; //socket.io (live engine) //Variable is set by server later on var position = { x: 1, y: 1 }; var heading; // direction of player var nameSize = 18; // size of the name label //Variable is set by server later on var worldDimensions = { x: 1, y: 1 }; var inPlay = false; //whether you have started playing var currFrameNum = 0; var prevTimeOfFrame = 0; function setup() { createCanvas(windowWidth, windowHeight); //Load the skins into the array for (var path in playerImageOptions) { playerImages.push(loadImage("sprites/players/" + playerImageOptions[path])) } imageMode(CENTER) } //receive world dimensions from the server function setWorldDimensions(wd) { worldDimensions = wd; } //reload the page when you die function iDied() { location.reload(); } //draw the grid background function drawGrid(sqrWidth, border) { strokeWeight(border); stroke(25); for (var x = 0; x < worldDimensions.x - 1; x += (sqrWidth + border)) { line(x, 0, x, worldDimensions.y); } for (var y = 0; y < worldDimensions.y - 1; y += (sqrWidth + border)) { line(0, y, worldDimensions.x, y); } } //Display the world function worldUpdate(bodies) { background(30); displayBodies(bodies); } function displayBodies(bodies) { for (var i = 0; i < bodies.length; i++) { var body = bodies[i]; //Check if the body is a player if (body.label === 'player') { //Draw the player image if (body.socketID === socket.id) { translate(-body.position.x + width / 2, -body.position.y + height / 2); break; } } } drawGrid(60, 20); //Loop through all the bodies in the world for (var i = 0; i < bodies.length; i++) { var body = bodies[i]; //Check if the body is a player if (body.label === 'player') { //Draw the player image push(); translate(body.position.x, body.position.y); rotate(body.angle); image(playerImages[body.skinID], 0, 0); pop(); //Write number of bullets if it is the current player var bodyColor = color(body.render.fillStyle); fill(color(255 - red(bodyColor), 255 - green(bodyColor), 255 - blue(bodyColor))); textSize(nameSize); text(body.numOfBullets, body.position.x - textWidth(body.numOfBullets) / 2, body.position.y - 60) text(body.name, body.position.x - textWidth(body.name) / 2, body.position.y) //Draw the health bar var barSize = body.maxHealth / 2; fill(255, 0, 0); rect(body.position.x - barSize / 2, body.position.y - 45, barSize, 10); fill(0, 255, 0); rect(body.position.x - barSize / 2, body.position.y - 45, barSize * body.health / body.maxHealth, 10) } else { //Draw shape from its vertices strokeWeight(body.render.lineWidth); fill(body.render.fillStyle); stroke(body.render.strokeStyle); var vertices; push(); if (typeof(body.vertices) === 'string') { translate(body.position.x, body.position.y); rotate(body.angle); vertices = objectVertices[body.vertices]; } else { vertices = body.vertices } beginShape(); for (var j = 0; j < vertices.length; j++) { var v = vertices[j]; vertex(v.x, v.y); } endShape(CLOSE); pop(); } } } function draw() { if (inPlay) { heading = { x: (mouseX - width / 2), y: (mouseY - height / 2) }; heading = getUnitVector(heading); socket.emit('heading', heading) } else { var padding = 0; var imageSize = (width - padding * (playerImages.length - 1)) / playerImages.length; for (var i = 0; i < playerImages.length; i++) { push(); translate(i * (imageSize + padding) + imageSize / 2, imageSize / 2); rotate(Math.PI / 2); image(playerImages[i], 0, 0, imageSize, imageSize); pop(); } } } function getUnitVector(v) { var scale = Math.sqrt(v.x * v.x + v.y * v.y); if (scale !== 0) { v.x = v.x / scale; v.y = v.y / scale } return v; } function windowResized() { resizeCanvas(windowWidth, windowHeight) } function keyReleased() { if (key === ' ') { socket.emit('newBullet') } if (key === 'B') { var bombParams = getBombParams(); try { if ((bombParams.bullets > 0)) { socket.emit('newBomb', bombParams.bullets, bombParams.trigger, bombParams.visible) } } catch (e) { } } if (key === 'S' && inPlay) { toggleBombSelector(); } }
raphy1234/The-Game-Of-Things
public/sketch.js
JavaScript
mit
5,019
{{<govuk_template}} {{$head}} {{>includes/head}} {{/head}} {{$propositionHeader}} {{>includes/propositional_navigation}} {{/propositionHeader}} {{$headerClass}}with-proposition{{/headerClass}} {{$content}} <main id="content" role="main"> {{>includes/phase_banner}} <div class="grid-row"> <div class="column-two-thirds"> <form action="gettingOn{{#edit}}?edit=true{{/edit}}" method="post" method="#" class="form checkMyAnswers" data-question="gettingOn"> <h1 class="form-title heading-large">{{>includes/pages/progress}} Mixing with people </h1> <div class="form-group" id="form-group-frequency"> <fieldset class="form-group"> <legend class="form-label">Does your condition affect you:</legend> <label class="block-label" for="waste-type-1" data-show="details"> <input id="waste-type-1" name="difficulty" type="checkbox" value="mixing with people you do not know" >mixing with people you do not know </label> <label class="block-label" for="waste-type-2" data-show="details"> <input id="waste-type-2" name="difficulty" type="checkbox" value="mixing with people you know" >mixing with people you know </label> <label class="block-label" for="waste-type-3" data-show="details"> <input id="waste-type-3" name="difficulty" type="checkbox" value="understanding simple conversations" >understanding simple conversations </label> <label class="block-label" for="waste-type-4" data-show="details"> <input id="waste-type-4" name="difficulty" type="checkbox" value="understanding long or complicated conversations" >understanding long or complicated conversations </label> <label class="block-label" for="waste-type-5" data-show="details"> <input id="waste-type-5" name="difficulty" type="checkbox" value="getting across what you want to say" >getting across what you want to say </label> <label class="block-label" for="waste-type-6" data-show="details"> <input id="waste-type-6" name="difficulty" type="checkbox" value="understanding how people are behaving towards you" >understanding how people are behaving towards you </label> <label class="block-label" for="waste-type-9" data-show="details" data-target="other"> <input id="waste-type-9" name="difficulty" type="checkbox" value="Other"> in another way </label> <div class="panel-indent js-hidden" id="other"> <input class="form-control" type="text" id="manageMedications-other-country" name="other-difficulty"> </div> <p class="form-block">or</p> <label class="block-label" for="waste-type-10" data-hide="details"> <input id="waste-type-10" name="difficulty" type="checkbox" value="Your condition does not affect you mixing with people">Your condition does not affect you mixing with people </label> </fieldset> </div> <div class="panel-indent js-hidden" id="details"> <div class="form-group"> <legend class="form-label" id="frequency" for="frequency"> <span class="frequency-question">How often does your condition affect you mixing with people? </span> </legend> <label class="block-label" for="pip.radio.allthetime.id"> <input id="pip.radio.allthetime.id" type="radio" name="frequency" value="Every time you have to mix with people" > Every time you have to mix with people </label> <label class="block-label" for="pip.radio.morethanhalf.id"> <input id="pip.radio.morethanhalf.id" type="radio" name="frequency" value="More than half the time" > More than half the time </label> <label class="block-label" for="pip.radio.lessthanhalf.id"> <input id="pip.radio.lessthanhalf.id" type="radio" name="frequency" value="Less than half the time" > Less than half the time </label> <label class="block-label" for="pip.radio.own-words.id"> <input id="pip.radio.own-words.id" type="radio" name="frequency" value="Tell us how often in your own words" {{#frequency.frequencyTell us how often in your own words}}checked=checked{{/frequency.frequencyTell us how often in your own words}} > Explain how often in your own words </label> <div id="how-often" class="form-group js-hidden"> <br /> <label class="form-label" for="ownWords">If you can, tell us roughly how many days out of a week or month you’re affected.</label> <input type="text" class="form-control" id="ownWords" value="{{#frequency.ownWords}}{{frequency.ownWords}}{{/frequency.ownWords}}" name="ownWords" /> </div> </div> <div class="form-group"> <fieldset> <legend class="form-label">How do you mix with people?</legend> <label class="block-label" for="how-manage-type-1"> <input id="how-manage-type-1" name="how-manage-types" type="checkbox" value="Someone needs to encourage you to mix with people">Someone needs to encourage you to mix with people </label> <label class="block-label" for="how-manage-type-2"> <input id="how-manage-type-2" name="how-manage-types" type="checkbox" value="You rely on someone to explain things to you">You rely on someone to explain things to you </label> <label class="block-label" for="how-manage-type-3"> <input id="how-manage-type-3" name="how-manage-types" type="checkbox" value="Someone needs to supervise you">Someone needs to supervise you </label> <label class="block-label" for="how-manage-type-4"> <input id="how-manage-type-4" name="how-manage-types" type="checkbox" value="You manage on your own, but with difficulty">You manage on your own, but with difficulty </label> <label class="block-label" for="how-manage-type-5" data-target="anotherWay"> <input id="how-manage-type-5" name="how-manage-types" type="checkbox" value="In another way"> In another way </label> <div class="panel-indent js-hidden" id="anotherWay"> <input class="form-control" type="text" id="manageAnotherWay" name="manageAnotherWay"> </div> </fieldset> </div> <div class="form-group"> <label class="form-label" for="detailsWhy">Explain how your condition affects you mixing with people. </label> <p> Include if: </p> <ul class="list-bullet" style="margin-top:-15px;margin-left:10px;"> <li>what you’re able to do depends on the type of day you’re having</li> <li>mixing with people could put you or others at risk</li> <li>mixing with people has an effect on your condition</li> </ul> <span class="font-xsmall form-control-3-4 character-count">1500 characters left</span> <textarea class="form-control-3-4" maxlength="1500" id="detailsWhy" name="detailsWhy"></textarea> </div> </div> <div class="form-group"> <input type="submit" class="button" value="Save and continue" name="saveAndcontinue"> <input type="submit" value="Save and come back later" name="saveAndExit" class="exit-link"> <a href="#" class="example-back-link">Back</a> </div> </form> </div> <div class="column-third">{{>includes/pages/getHelp}} </div> </div> </main><!-- / #page-container --> {{/content}} {{$bodyEnd}} {{>includes/elements_scripts}} {{/bodyEnd}} {{/govuk_template}}
gup-dwp/pip-prototype
app/views/pip14a/gettingOn.html
HTML
mit
8,053
// Minitest (c) 2011 Jamie Webb // MIT License package cc.jwebb.minitest import org.junit.Assert._ /** Used as an implicit parameter to control the margin for error allowed in * floating point equality tests. */ class Epsilon(val v : Double) { /** Default value. */ def this() = this(0.000000001) } /** Test assertions on Objects. */ class TestObjectOps[T](me : T) { private def show(x : Any) : String = x match { case null => "(null)" case a : Array[_] => a.view.map(show).mkString("Array(", ", ", ")") case _ => x.toString } /** Equality test. */ def ==?(that : AnyRef) = assertEquals(that, me) /** Inequality test. */ def !=?(that : AnyRef) = if (me == that) fail("Expected " + show(me) + " != " + show(that)) /** Non-null test. */ def ? = assertNotNull(me) /** Regex matching test. */ def =~?(that : String) = { assertNotNull(me) assertTrue("Expected '" + show(me) + "' to match '" + that + "'", show(me).matches(that)) } } /** Test assertions on Longs. */ class TestLongOps(me : Long) { def ==?(that : Long) = assertTrue("Expected " + me + " == " + that, me == that) def !=?(that : Long) = assertTrue("Expected " + me + " != " + that, me != that) def <<?(that : Long) = assertTrue("Expected " + me + " < " + that, me < that) def <=?(that : Long) = assertTrue("Expected " + me + " <= " + that, me <= that) def >>?(that : Long) = assertTrue("Expected " + me + " > " + that, me > that) def >=?(that : Long) = assertTrue("Expected " + me + " >= " + that, me >= that) } /** Test assertions on Doubles. */ class TestDoubleOps(me : Double) { def ==?(that : Double)(implicit e : Epsilon) = assertTrue("Expected " + me + " == " + that, math.abs(me - that) < e.v) def !=?(that : Double)(implicit e : Epsilon) = assertTrue("Expected " + me + " != " + that, math.abs(me - that) > e.v) def <<?(that : Double) = assertTrue("Expected " + me + " < " + that, me < that) def <=?(that : Double) = assertTrue("Expected " + me + " <= " + that, me <= that) def >>?(that : Double) = assertTrue("Expected " + me + " > " + that, me > that) def >=?(that : Double) = assertTrue("Expected " + me + " >= " + that, me >= that) } /** Test assertions on Booleans. */ class TestBooleanOps(me : Boolean) { def ==?(that : Boolean) = assertFalse(me ^ that) def !=?(that : Boolean) = assertTrue(me ^ that) def ?? = assertTrue(me) def !? = assertFalse(me) } // vim:sw=4:ts=4:noet
jwebb/minitest
src/main/scala/testops.scala
Scala
mit
2,422
require 'spec_helper' require 'support/sales_helper' RSpec.describe Sales::OrderSaga do include SalesHelper let(:command_bus) { CommandBus.new } let(:event_store) { FakeEventStore.new } let(:order_repository) { Sales::Adapter::Persistence::OrderRepository.new(event_store) } let(:saga_repository) { Sales::Adapter::Persistence::OrderSagaRepository.new(event_store) } let(:product_repository) { Sales::Adapter::Persistence::ProductRepository.new([product]) } let(:order_saga_manager) { Sales::OrderSagaManager.new(saga_repository, command_bus) } let(:gateway_response) { Sales::Adapter::Payment::Success.new(payment_id) } let(:payment_api) { Sales::Adapter::Payment::Api.new(gateway_response) } let(:payment_gateway) { Sales::Adapter::Payment::Gateway.new(event_store, payment_api) } let(:order_service) do Sales::Application::OrderApplicationService.new(order_repository, product_repository) end let(:payment_service) do Sales::Application::PaymentApplicationService.new(payment_gateway) end let(:events_setup) do { order_saga_manager => [ Sales::Domain::OrderPlaced, Sales::Domain::PaymentSucceeded, Sales::Domain::PaymentFailed ] } end let(:commands_setup) do { Sales::Application::AddItemToOrder => order_service.method(:add_item_to_order), Sales::Application::PlaceOrder => order_service.method(:place_order), Sales::Application::CompleteOrder => order_service.method(:complete_order), Sales::Application::CancelOrder => order_service.method(:cancel_order), Sales::Application::RequestPayment => payment_service.method(:request_payment) } end before do events_setup.each { |handler, events| event_store.subscribe(handler, events) } commands_setup.each { |command, handler| command_bus.register(command, handler) } end describe "with successful payment" do it "completes the order" do commands = [ Sales::Application::AddItemToOrder.new(order_id: order_id, product_id: product.id), Sales::Application::PlaceOrder.new(order_id: order_id, customer_id: customer_id) ] expected_events = [ Sales::Domain::ItemAddedToOrder.new(order_id: order_id, product_id: product.id, price: product.price), Sales::Domain::OrderPlaced.new(order_id: order_id, customer_id: customer_id, total_price: product.price), Sales::Domain::PaymentSucceeded.new(payment_id: payment_id, customer_id: customer_id, order_id: order_id, amount: product.price), Sales::Domain::OrderCompleted.new(order_id: order_id) ] commands.each { |command| command_bus.call(command) } expect(event_store).to receive_events(expected_events) end end describe "with failed payment" do let(:gateway_response) { Sales::Adapter::Payment::Error.new("Invalid CVV2") } it "exipres the order" do commands = [ Sales::Application::AddItemToOrder.new(order_id: order_id, product_id: product.id), Sales::Application::PlaceOrder.new(order_id: order_id, customer_id: customer_id) ] expected_events = [ Sales::Domain::ItemAddedToOrder.new(order_id: order_id, product_id: product.id, price: product.price), Sales::Domain::OrderPlaced.new(order_id: order_id, customer_id: customer_id, total_price: product.price), Sales::Domain::PaymentFailed.new(error: "Invalid CVV2", customer_id: customer_id, order_id: order_id, amount: product.price), Sales::Domain::OrderCancelled.new(order_id: order_id, reason: "Payment failed") ] commands.each { |command| command_bus.call(command) } expect(event_store).to receive_events(expected_events) end end end
mlomnicki/ddd-ecommerce
spec/sales/order_saga_spec.rb
Ruby
mit
3,759
// Thai jQuery.timeago.settings.strings = { prefixAgo : null, prefixFromNow: null, suffixAgo : "ที่แล้ว", suffixFromNow: "จากตอนนี้", seconds : "น้อยกว่าหนึ่งนาที", minute : "ประมาณหนึ่งนาที", minutes : "%d นาที", hour : "ประมาณหนึ่งชั่วโมง", hours : "ประมาณ %d ชั่วโมง", day : "หนึ่งวัน", days : "%d วัน", month : "ประมาณหนึ่งเดือน", months : "%d เดือน", year : "ประมาณหนึ่งปี", years : "%d ปี", wordSeparator: "", numbers : [] };
neowutran/Nuitinfo
nuitinfo/protected/common/lib/vendor/2amigos/yiiwheels/widgets/timeago/assets/js/locales/jquery.timeago.th.js
JavaScript
mit
847
using System; using System.Collections.Generic; using Nop.Core; using Nop.Core.Caching; using Nop.Core.Data; using Nop.Core.Domain.Catalog; using Nop.Core.Domain.Orders; using Nop.Core.Domain.Shipping; using Nop.Core.Domain.Stores; using Nop.Core.Plugins; using Nop.Services.Catalog; using Nop.Services.Common; using Nop.Services.Events; using Nop.Services.Localization; using Nop.Services.Logging; using Nop.Services.Orders; using Nop.Services.Shipping; using Nop.Tests; using NUnit.Framework; using Rhino.Mocks; namespace Nop.Services.Tests.Shipping { [TestFixture] public class CalculateDimensionsTests : ServiceTest { private IRepository<ShippingMethod> _shippingMethodRepository; private IRepository<Warehouse> _warehouseRepository; private ILogger _logger; private IProductAttributeParser _productAttributeParser; private ICheckoutAttributeParser _checkoutAttributeParser; private ShippingSettings _shippingSettings; private IEventPublisher _eventPublisher; private ILocalizationService _localizationService; private IAddressService _addressService; private IGenericAttributeService _genericAttributeService; private IShippingService _shippingService; private ShoppingCartSettings _shoppingCartSettings; private IProductService _productService; private Store _store; private IStoreContext _storeContext; [SetUp] public new void SetUp() { _shippingSettings = new ShippingSettings(); _shippingSettings.UseCubeRootMethod = true; _shippingSettings.ConsiderAssociatedProductsDimensions = true; _shippingMethodRepository = MockRepository.GenerateMock<IRepository<ShippingMethod>>(); _warehouseRepository = MockRepository.GenerateMock<IRepository<Warehouse>>(); _logger = new NullLogger(); _productAttributeParser = MockRepository.GenerateMock<IProductAttributeParser>(); _checkoutAttributeParser = MockRepository.GenerateMock<ICheckoutAttributeParser>(); var cacheManager = new NopNullCache(); var pluginFinder = new PluginFinder(); _productService = MockRepository.GenerateMock<IProductService>(); _eventPublisher = MockRepository.GenerateMock<IEventPublisher>(); _eventPublisher.Expect(x => x.Publish(Arg<object>.Is.Anything)); _localizationService = MockRepository.GenerateMock<ILocalizationService>(); _addressService = MockRepository.GenerateMock<IAddressService>(); _genericAttributeService = MockRepository.GenerateMock<IGenericAttributeService>(); _store = new Store { Id = 1 }; _storeContext = MockRepository.GenerateMock<IStoreContext>(); _storeContext.Expect(x => x.CurrentStore).Return(_store); _shoppingCartSettings = new ShoppingCartSettings(); _shippingService = new ShippingService(_shippingMethodRepository, _warehouseRepository, _logger, _productService, _productAttributeParser, _checkoutAttributeParser, _genericAttributeService, _localizationService, _addressService, _shippingSettings, pluginFinder, _storeContext, _eventPublisher, _shoppingCartSettings, cacheManager); } [Test] public void should_return_zero_with_all_zero_dimensions() { var items = new List<GetShippingOptionRequest.PackageItem> { new GetShippingOptionRequest.PackageItem(new ShoppingCartItem { Quantity = 1, Product = new Product { Length = 0, Width = 0, Height = 0 } }), }; decimal length, width, height; _shippingService.GetDimensions(items, out width, out length, out height); length.ShouldEqual(0); width.ShouldEqual(0); height.ShouldEqual(0); items = new List<GetShippingOptionRequest.PackageItem> { new GetShippingOptionRequest.PackageItem(new ShoppingCartItem { Quantity = 2, Product = new Product { Length = 0, Width = 0, Height = 0 } }), }; _shippingService.GetDimensions(items, out width, out length, out height); length.ShouldEqual(0); width.ShouldEqual(0); height.ShouldEqual(0); } [Test] public void can_calculate_with_single_item_and_qty_1_should_ignore_cubic_method() { var items = new List<GetShippingOptionRequest.PackageItem> { new GetShippingOptionRequest.PackageItem(new ShoppingCartItem { Quantity = 1, Product = new Product { Length = 2, Width = 3, Height = 4 } }) }; decimal length, width, height; _shippingService.GetDimensions(items, out width, out length, out height); length.ShouldEqual(2); width.ShouldEqual(3); height.ShouldEqual(4); } [Test] public void can_calculate_with_single_item_and_qty_2() { var items = new List<GetShippingOptionRequest.PackageItem> { new GetShippingOptionRequest.PackageItem(new ShoppingCartItem { Quantity = 2, Product = new Product { Length = 2, Width = 4, Height = 4 } }) }; decimal length, width, height; _shippingService.GetDimensions(items, out width, out length, out height); length.ShouldEqual(4); width.ShouldEqual(4); height.ShouldEqual(4); } [Test] public void can_calculate_with_cubic_item_and_multiple_qty() { var items = new List<GetShippingOptionRequest.PackageItem> { new GetShippingOptionRequest.PackageItem(new ShoppingCartItem { Quantity = 3, Product = new Product { Length = 2, Width = 2, Height = 2 } }) }; decimal length, width, height; _shippingService.GetDimensions(items, out width, out length, out height); Math.Round(length, 2).ShouldEqual(2.88); Math.Round(width, 2).ShouldEqual(2.88); Math.Round(height, 2).ShouldEqual(2.88); } [Test] public void can_calculate_with_multiple_items_1() { var items = new List<GetShippingOptionRequest.PackageItem> { new GetShippingOptionRequest.PackageItem(new ShoppingCartItem { Quantity = 3, Product = new Product { Length = 2, Width = 2, Height = 2 } }), new GetShippingOptionRequest.PackageItem(new ShoppingCartItem { Quantity = 1, Product = new Product { Length = 3, Width = 5, Height = 2 } }) }; decimal length, width, height; _shippingService.GetDimensions(items, out width, out length, out height); Math.Round(length, 2).ShouldEqual(3.78); Math.Round(width, 2).ShouldEqual(5); //preserve max width Math.Round(height, 2).ShouldEqual(3.78); } [Test] public void can_calculate_with_multiple_items_2() { //take 8 cubes of 1x1x1 which is "packed" as 2x2x2 var items = new List<GetShippingOptionRequest.PackageItem>(); for (int i = 0; i < 8; i++) items.Add(new GetShippingOptionRequest.PackageItem(new ShoppingCartItem { Quantity = 1, Product = new Product { Length = 1, Width = 1, Height = 1 } })); decimal length, width, height; _shippingService.GetDimensions(items, out width, out length, out height); Math.Round(length, 2).ShouldEqual(2); Math.Round(width, 2).ShouldEqual(2); Math.Round(height, 2).ShouldEqual(2); } } }
Anovative/Nop39
Tests/Nop.Services.Tests/Shipping/CalculateDimensionsTests.cs
C#
mit
9,922
/* * This file is part of TechReborn, licensed under the MIT License (MIT). * * Copyright (c) 2018 TechReborn * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package techreborn.compat.crafttweaker; import crafttweaker.CraftTweakerAPI; import crafttweaker.api.item.IIngredient; import crafttweaker.api.item.IItemStack; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; import techreborn.api.Reference; import techreborn.api.recipe.machines.AlloySmelterRecipe; /** * mods.techreborn.alloySmelter.addRecipe(<minecraft:gold_ingot>, <minecraft:iron_ingot>, <minecraft:diamond>, 20, 100); */ @ZenClass("mods.techreborn.alloySmelter") public class CTAlloySmelter extends CTGeneric { @ZenMethod public static void addRecipe(IItemStack output, IIngredient input1, IIngredient input2, int ticktime, int euTick) { Object oInput1 = CraftTweakerCompat.toObject(input1); Object oInput2 = CraftTweakerCompat.toObject(input2); AlloySmelterRecipe r = new AlloySmelterRecipe(oInput1, oInput2, CraftTweakerCompat.toStack(output), ticktime, euTick); addRecipe(r); } @ZenMethod public static void removeInputRecipe(IIngredient iIngredient) { CraftTweakerAPI.apply(new RemoveInput(iIngredient, getMachineName())); } @ZenMethod public static void removeRecipe(IItemStack output) { CraftTweakerAPI.apply(new Remove(CraftTweakerCompat.toStack(output), getMachineName())); } @ZenMethod public static void removeAll(){ CraftTweakerAPI.apply(new RemoveAll(getMachineName())); } public static String getMachineName() { return Reference.ALLOY_SMELTER_RECIPE; } }
drcrazy/TechReborn
src/main/java/techreborn/compat/crafttweaker/CTAlloySmelter.java
Java
mit
2,662
Marsmello 0.8.x BETA ==================== Copyright (c) 2009-2013 Marsmello Developers Copyright (c) 2011-2013 Marsmello Developers Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php. This product includes software developed by the OpenSSL Project for use in the [OpenSSL Toolkit](http://www.openssl.org/). This product includes cryptographic software written by Eric Young ([eay@cryptsoft.com](mailto:eay@cryptsoft.com)), and UPnP software written by Thomas Bernard. Intro --------------------- Marsmello is a free open source peer-to-peer electronic cash system that is completely decentralized, without the need for a central server or trusted parties. Users hold the crypto keys to their own money and transact directly with each other, with the help of a P2P network to check for double-spending. Setup --------------------- You need the Qt4 run-time libraries to run Marsmello-Qt. On Debian or Ubuntu: `sudo apt-get install libqtgui4` Unpack the files into a directory and run: - bin/32/Marsmello-qt (GUI, 32-bit) - bin/32/Marsmellod (headless, 32-bit) - bin/64/Marsmello-qt (GUI, 64-bit) - bin/64/Marsmellod (headless, 64-bit) See the documentation at the [Marsmello Wiki](http://Marsmello.info) for help and more information. Other Pages --------------------- - [Unix Build Notes](build-unix.md) - [OSX Build Notes](build-osx.md) - [Windows Build Notes](build-msw.md) - [Coding Guidelines](coding.md) - [Release Process](release-process.md) - [Release Notes](release-notes.md) - [Multiwallet Qt Development](multiwallet-qt.md) - [Unit Tests](unit-tests.md) - [Translation Process](translation_process.md)
TEHmarshmallow/Marsmallows
doc/README.md
Markdown
mit
1,711
using ServiceStack.DataAnnotations; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SqlFace.Models { [Alias("AP_SEQ")] public class CustomSequence:UniqueFilterable { #region Properties private static object _syncObj = new object(); public string SEQ_NAME { get; set; } public decimal SEQ_NO { get; set; } #endregion public object GetId() { return SEQ_NAME; } public static decimal GetNextVal(string sname, OrmService svc) { decimal dNextVal = -1; CustomSequence seq; //var service = new OrmService<CustomSequence>(db); lock (_syncObj) { seq = svc.GetById<CustomSequence>(sname); if (null!= seq) { dNextVal = seq.SEQ_NO + 1; seq.SEQ_NO = dNextVal; svc.Update(seq,f=>f.SEQ_NO,s=>s.SEQ_NAME==sname); } else { dNextVal = 1; svc.Create(new CustomSequence { SEQ_NAME = sname, SEQ_NO = 1 }); } } return dNextVal; } } }
tearf001/Sql-App
com.models/OracleSequence.cs
C#
mit
1,411
--- # DO NOT EDIT! # This file is automatically generated by get-members. If you change it, bad # things will happen. layout: default title: "Mr Andrew Love" house: commons --- <div class="row"> <div class="col-md-8"> {% include members/mr-andrew-love.html %} <h3>What is Mr Andrew Love interested in?</h3> <li><a href="http://jenit.github.io/childs-guide-to-parliament/interests/housing.html">Housing</a></li> <li><a href="http://jenit.github.io/childs-guide-to-parliament/interests/regeneration.html">Regeneration</a></li> <li><a href="http://jenit.github.io/childs-guide-to-parliament/interests/mutuality.html">Mutuality</a></li> <li><a href="http://jenit.github.io/childs-guide-to-parliament/interests/the-economy.html">The Economy</a></li> </div> <div class="col-md-4"> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title">Place</h3> </div> <div class="panel-body"> <p>Mr Andrew Love is the MP for <b>Edmonton</b>.</p> <div id="constituency-map" style="width:100%;height:250px"></div> <script> L.mapbox.accessToken = 'pk.eyJ1IjoiamFja3NvbmowNCIsImEiOiJxNmRPTDhvIn0.zxOHkhRVui-0MBwEdKnfUg'; var map = L.mapbox.map('constituency-map', 'jacksonj04.k663m066',{ zoomControl: false }); var featureLayer = L.mapbox.featureLayer() .loadURL('{{ site.baseurl }}/data/boundaries/edmonton.geojson') .addTo(map); featureLayer.on('ready', function() { map.fitBounds(featureLayer.getBounds()); }); </script> <p class="small"><a href="{{ site.baseurl }}/glossary.html#constituency">What is a constituency?</a><p> </div> </div> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title">Party</h3> </div> <div class="panel-body"> <p>Mr Andrew Love is an MP in the <b>Labour (Co-op)</b> party.</p> <p class="small"><a href="{{ site.baseurl }}/glossary.html#party">What is a party?</a><p> </div> </div> </div> </div>
JeniT/childs-guide-to-parliament
members/mr-andrew-love.html
HTML
mit
2,411
#include <stdio.h> #include <rslib.h> #include <string.h> #define TARGET "Reed Solomon Tests" #include <test.h> static struct rs_control *rs_decoder; int main() { INIT_TEST(); rs_decoder = init_rs (10, 0x409, 0, 1, 6); int blocks = 32; unsigned char data8[blocks]; char *parity_data; uint16_t par[6]; parity_data = (char*)par; memset(par, 0, sizeof(par)); printf("Initial Values\n"); print_hex(data8, 32); print_hex(parity_data,12); encode_rs8 (rs_decoder, data8, blocks, par, 0); printf("After encoding\n"); print_hex(data8, 32); print_hex(parity_data,12); /* * Create errors here */ data8[blocks/2] += 5; data8[blocks/3] += 5; data8[blocks/4] += 5; printf("Before Decoding\n"); print_hex(data8, 32); print_hex(parity_data,12); int numerr; numerr = decode_rs8 (rs_decoder, data8, par, blocks, NULL, 0, NULL, 0, NULL); printf("Errors detected: %d\n",numerr); printf("After Decoding\n"); print_hex(data8, 32); print_hex(parity_data,12); free_rs(rs_decoder); EXIT_TEST(); return 0; }
adithyabhatkajake/shacham-and-waters-scheme
tests/reed-solomon.c
C
mit
1,166
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("09. ForbiddenWords")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("09. ForbiddenWords")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("a0a4b9aa-0247-4ef0-ba76-d3b39b7a1290")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
g-yonchev/TelerikAcademy
Homeworks/C# 2/06. Strings And Text Processing/09. ForbiddenWords/Properties/AssemblyInfo.cs
C#
mit
1,412
<?php namespace Gubler\Color; /** * Class Color. */ class Color { /** @var int */ protected $red; /** @var int */ protected $green; /** @var int */ protected $blue; /** @var float */ protected $alpha; /** @var float */ protected $hue; /** @var int */ protected $saturation; /** @var int */ protected $luminosity; /** @var ColorParser */ protected $parser; /** @var ColorConverter */ protected $converter; // ---------------------------------------- // CONSTRUCTOR // ---------------------------------------- /** * Construct from string. * * @param string $color */ public function __construct(string $color) { $this->parser = new ColorParser(); $this->converter = new ColorConverter(); $rgb = $this->parser->parse($color)->toArray(); $this->red = $rgb['red']; $this->green = $rgb['green']; $this->blue = $rgb['blue']; $this->alpha = $rgb['alpha']; $this->updateHsl(); } // ---------------------------------------- // OUTPUT // ---------------------------------------- /** * @return string */ public function __toString() { return $this->rgba(); } /** * @return string */ public function rgba() { return 'rgba('.$this->red.', '.$this->green.', '.$this->blue.', '.$this->alpha.')'; } /** * @return string */ public function rgb() { return 'rgb('.$this->red.', '.$this->green.', '.$this->blue.')'; } /** * @return string */ public function hex() { return $this->converter->rgbToHex($this->red, $this->green, $this->blue); } /** * @return string */ public function hsla() { return 'hsla('.$this->hue.', '.$this->saturation.'%, '.$this->luminosity.'%, '.$this->alpha.')'; } /** * @return string */ public function hsl() { return 'hsl('.$this->hue.', '.$this->saturation.'%, '.$this->luminosity.'%)'; } // ---------------------------------------- // CONTRAST TEXT COLOR // ---------------------------------------- /** * Returns a Color of black or white to contrast against current color. * * This color can be used for to determine what color to use for text on the current color. * * @return Color */ public function contrastTextColor() { if ($this->perceivedBrightness() > 128) { return new self('rgba(0, 0, 0, '.$this->alpha.')'); } return new self('rgba(255, 255, 255, '.$this->alpha.')'); } // ---------------------------------------- // UPDATERS // ---------------------------------------- /** * @param int $red * @param int $green * @param int $blue * @param float $alpha * * @return Color */ public function setRgba(int $red, int $green, int $blue, float $alpha = 1.0): Color { $this->red = $red; $this->green = $green; $this->blue = $blue; $this->alpha = $alpha; $this->updateHsl(); return $this; } /** * @param float $hue * @param int $saturation * @param int $luminosity * @param float $alpha * * @return Color */ public function setHsla(float $hue, int $saturation, int $luminosity, float $alpha = 1.0): Color { $this->hue = $hue; $this->saturation = $saturation; $this->luminosity = $luminosity; $this->alpha = $alpha; $this->updateRgb(); return $this; } /** * @param string $hex * * @return Color */ public function setHex(string $hex): Color { $rgb = (new ColorParser($hex))->toArray(); $this->red = $rgb['red']; $this->green = $rgb['green']; $this->blue = $rgb['blue']; $this->alpha = $rgb['alpha']; $this->updateHsl(); return $this; } // ---------------------------------------- // INTERNAL UPDATERS // ---------------------------------------- protected function updateHsl() { $hsl = $this->converter->rgbToHsl($this->red, $this->green, $this->blue); $this->hue = $hsl['hue']; $this->saturation = $hsl['saturation']; $this->luminosity = $hsl['luminosity']; } protected function updateRgb() { $rgb = $this->converter->hslToRgb($this->hue, $this->saturation, $this->luminosity); $this->red = $rgb['red']; $this->blue = $rgb['blue']; $this->green = $rgb['green']; } // ---------------------------------------- // Internal converter // ---------------------------------------- /** * Converts color to YIQ color space and determines perceived brightness * on a 0-255 scale. * * @return int */ protected function perceivedBrightness() { return ( ($this->red * 299) + ($this->green * 587) + ($this->blue * 114) ) / 1000; } }
gubler/color
src/Color.php
PHP
mit
5,176
// Copyright (c) 2009 by Doug Kearns // // This work is licensed for reuse under an MIT license. Details are // given in the License.txt file included with this file. const Name = "Vimperator"; /* * We can't load our modules here, so the following code is sadly * duplicated: .w !sh vimdiff ../../*'/components/about-handler.js' */ Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); const Cc = Components.classes; const Ci = Components.interfaces; const name = Name.toLowerCase(); function AboutHandler() {} AboutHandler.prototype = { classDescription: "About " + Name + " Page", classID: Components.ID("81495d80-89ee-4c36-a88d-ea7c4e5ac63f"), contractID: "@mozilla.org/network/protocol/about;1?what=" + name, QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule]), newChannel: function (uri) { let channel = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService) .newChannel("chrome://" + name + "/content/about.html", null, null); channel.originalURI = uri; return channel; }, getURIFlags: function (uri) Ci.nsIAboutModule.ALLOW_SCRIPT }; if(XPCOMUtils.generateNSGetFactory) var NSGetFactory = XPCOMUtils.generateNSGetFactory([AboutHandler]); else function NSGetModule(compMgr, fileSpec) XPCOMUtils.generateModule([AboutHandler]) // vim: set fdm=marker sw=4 ts=4 et:
derenio/vimperator-labs
vimperator/components/about-handler.js
JavaScript
mit
1,401
package protocol import ( "context" "github.com/coffeehc/logger" "github.com/coffeehc/netx" "github.com/ugorji/go/codec" ) type msgpackProtocol struct { hander *codec.MsgpackHandle interf func() interface{} } //NewMsgpackProcotol cteate a Msgpack Protocol implement func NewMsgpackProcotol(interfFunc func() interface{}) netx.Protocol { p := &msgpackProtocol{hander: new(codec.MsgpackHandle)} p.interf = interfFunc if p.interf == nil { p.interf = func() interface{} { var i interface{} return &i } } return p } func (mp *msgpackProtocol) Encode(cxt context.Context, connContext netx.ConnContext, chain netx.ProtocolChain, data interface{}) { var b []byte encode := codec.NewEncoderBytes(&b, mp.hander) err := encode.Encode(data) if err != nil { logger.Error("Msgpack序列化错误:%s", err) return } chain.Fire(cxt, connContext, b) } func (mp *msgpackProtocol) Decode(cxt context.Context, connContext netx.ConnContext, chain netx.ProtocolChain, data interface{}) { if v, ok := data.([]byte); ok { obj := mp.interf() decode := codec.NewDecoderBytes(v, mp.hander) err := decode.Decode(obj) if err != nil { logger.Error("Msgpack反序列化失败:%s", err) return } data = obj } chain.Fire(cxt, connContext, data) } func (mp *msgpackProtocol) EncodeDestroy() {} func (mp *msgpackProtocol) DecodeDestroy() {}
coffeehc/coffeenet
protocol/msgpack_protocol.go
GO
mit
1,366
// The MIT License (MIT) // // Copyright (c) 2017 Jesse Sweetland // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using System.Collections.Generic; using System.Linq; namespace Platibus.Journaling { /// <summary> /// The result of a journal read /// </summary> public class MessageJournalReadResult { private readonly IList<MessageJournalEntry> _entries; /// <summary> /// The position at which the read started /// </summary> public MessageJournalPosition Start { get; } /// <summary> /// The next position to read from /// </summary> public MessageJournalPosition Next { get; } /// <summary> /// Whether the end of the journal was reached during the read operation /// </summary> public bool EndOfJournal { get; } /// <summary> /// The journaled messages that were read /// </summary> public IEnumerable<MessageJournalEntry> Entries => _entries; /// <summary> /// Initializes a new <see cref="MessageJournalReadResult"/> /// </summary> /// <param name="start">The position at which the read started</param> /// <param name="next">The next position to read from</param> /// <param name="endOfJournal">Whether the end of the journal was reached during the read operation</param> /// <param name="messages">The journaled messages that were read</param> public MessageJournalReadResult(MessageJournalPosition start, MessageJournalPosition next, bool endOfJournal, IEnumerable<MessageJournalEntry> messages) { Start = start ?? throw new ArgumentNullException(nameof(start)); Next = next ?? throw new ArgumentNullException(nameof(next)); EndOfJournal = endOfJournal; _entries = (messages ?? Enumerable.Empty<MessageJournalEntry>()).ToList(); } } }
sweetlandj/Platibus
Source/Platibus/Journaling/MessageJournalReadResult.cs
C#
mit
2,986
package com.phycholee.blog.test; import com.phycholee.blog.model.Article; import com.phycholee.blog.utils.FileUtil; import com.phycholee.blog.utils.PropertiesUtil; import com.phycholee.blog.utils.TimeUtil; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.util.FileCopyUtils; import java.io.File; /** * Created by PhychoLee on 2016/11/14 10:38. * Description: 测试上传文件到本地磁盘 */ @SpringBootTest @RunWith(SpringRunner.class) public class TestFileUpload { @Value("${web.upload-path}") private String path; @Test public void uploadTest() throws Exception { File f = new File("E:/avatar.jpg"); FileCopyUtils.copy(f, new File(path+"/1.jpg")); } @Test public void listFilesTest() { File file = new File(path); for(File f : file.listFiles()) { System.out.println("fileName : "+f.getName()); } } @Test public void testTime(){ String yearMonthDay = TimeUtil.getDateTime(); System.out.println(yearMonthDay); } @Test public void testString(){ String a = "\\"; a = a.replace("\\", "/"); System.out.println(a); } @Test public void deleteImage(){ // String root = PropertiesUtil.getPropertyByKey("root"); // Article article = new Article(); // article.setJumbotron(root+"jumbotron/201612/aaa.jpg"); // // String imgSrc = root+"post/201612/bbb.jpg,"+root+"post/201612/ccc.jpg"; // article.setImgSrc(imgSrc); // // System.out.println(article.getJumbotron()); // System.out.println(article.getImgSrc()); // // FileUtil.deleteImage(article, path); String root = PropertiesUtil.getPropertyByKey("root"); String url = root+"jumbotron/20171/268f4155-fcb9-41df-9e7e-0adba051c4ba.jpg"; FileUtil.deleteImageByUrl(url, path); } @Test public void testGetProperties(){ String root = PropertiesUtil.getPropertyByKey("root"); System.out.println(root); } @Test public void testDeleteInvalidRcs(){ String root = PropertiesUtil.getPropertyByKey("root"); String old = root+"post/20171/aaa.jpg,"+root+"post/20171/bbb.jpg"; String ne = root+"post/20171/aaa.jpg,"+root+"post/20171/ccc.jpg"; FileUtil.deleteInvalidImgSrc(old, ne, path); } }
phycholee/PhychoLeeBlog
src/main/java/com/phycholee/blog/test/TestFileUpload.java
Java
mit
2,567
#Collection of Algorithms and Data Structures This is a #180daysCodeChallenge i have taken to brush my fundamentals in DATA STRUCTURES & ALGORITHMS #November 21 , 2017 is the deadline
arapaka/algorithms-datastructures
README.md
Markdown
mit
186
#............................................................................... # # This file is part of the AXL library. # # AXL is distributed under the MIT license. # For details see accompanying license.txt file, # the public copy of which is also available at: # http://tibbo.com/downloads/archive/axl/license.txt # #............................................................................... unset(Qt5Core_DIR CACHE) unset(Qt5Gui_DIR CACHE) unset(Qt5Widgets_DIR CACHE) unset(Qt5Network_DIR CACHE) set(QT_FOUND FALSE) set(QTCORE_FOUND FALSE) set(QTGUI_FOUND FALSE) set(QTWIDGETS_FOUND FALSE) set(QTNETWORK_FOUND FALSE) if(NOT QT_CMAKE_DIR) find_package(Qt5Core QUIET) if(Qt5Core_FOUND) set(QT_FOUND TRUE) set(QTCORE_FOUND TRUE) set(QTCORE_CMAKE_DIR ${Qt5Core_DIR}) endif() find_package(Qt5Gui QUIET) if(Qt5Gui_FOUND) set(QTGUI_FOUND TRUE) set(QTGUI_CMAKE_DIR ${Qt5Gui_DIR}) endif() find_package(Qt5Widgets QUIET) if(Qt5Widgets_FOUND) set(QTWIDGETS_FOUND TRUE) set(QTWIDGETS_CMAKE_DIR ${Qt5Widgets_DIR}) endif() find_package(Qt5Network QUIET) if(Qt5Network_FOUND) set(QTNETWORK_FOUND TRUE) set(QTNETWORK_CMAKE_DIR ${Qt5Network_DIR}) endif() else() if(EXISTS ${QT_CMAKE_DIR}/Qt5Core/Qt5CoreConfig.cmake) include("${QT_CMAKE_DIR}/Qt5Core/Qt5CoreConfig.cmake") set(QT_FOUND TRUE) set(QTCORE_FOUND TRUE) set(QTCORE_CMAKE_DIR ${QT_CMAKE_DIR}/Qt5Core) endif() if(EXISTS ${QT_CMAKE_DIR}/Qt5Gui/Qt5GuiConfig.cmake) include("${QT_CMAKE_DIR}/Qt5Gui/Qt5GuiConfig.cmake") set(QTGUI_FOUND TRUE) set(QTGUI_CMAKE_DIR ${QT_CMAKE_DIR}/Qt5Gui) endif() if(EXISTS ${QT_CMAKE_DIR}/Qt5Widgets/Qt5WidgetsConfig.cmake) include("${QT_CMAKE_DIR}/Qt5Widgets/Qt5WidgetsConfig.cmake") set(QTWIDGETS_FOUND TRUE) set(QTWIDGETS_CMAKE_DIR ${QT_CMAKE_DIR}/Qt5Widgets) endif() if(EXISTS ${QT_CMAKE_DIR}/Qt5Network/Qt5NetworkConfig.cmake) include("${QT_CMAKE_DIR}/Qt5Network/Qt5NetworkConfig.cmake") set(QTNETWORK_FOUND TRUE) set(QTNETWORK_CMAKE_DIR ${QT_CMAKE_DIR}/Qt5Network) endif() endif() if(QT_FOUND) axl_message("QT ${Qt5Core_VERSION_STRING} paths:") axl_message(" Core CMake files:" "${QTCORE_CMAKE_DIR}") if(QTGUI_FOUND) axl_message(" Gui CMake files:" "${QTGUI_CMAKE_DIR}") endif() if(QTWIDGETS_FOUND) axl_message(" Widgets CMake files:" "${QTWIDGETS_CMAKE_DIR}") endif() if(QTNETWORK_FOUND) axl_message(" Network CMake files:" "${QTNETWORK_CMAKE_DIR}") endif() if(QT_DLL_DIR) axl_message(" DLLs:" "${QT_DLL_DIR}") endif() endif() #............................................................................... # this macro is similar to qt5_wrap_cpp but does not generate those ridiculous output paths macro( qt5_wrap_cpp_alt _MOC_CPP_LIST # ... ) set(${_MOC_CPP_LIST}) # clear list set(_H_LIST ${ARGN}) foreach(_H_PATH ${_H_LIST}) get_filename_component(_H_NAME ${_H_PATH} NAME_WE) get_filename_component(_H_EXT ${_H_PATH} EXT) string(COMPARE EQUAL ${_H_EXT} ".cpp" _IS_CPP) if(${_IS_CPP}) set(_MOC_CPP_PATH ${CMAKE_CURRENT_BINARY_DIR}/${_H_NAME}.moc) else() set(_MOC_CPP_PATH ${CMAKE_CURRENT_BINARY_DIR}/moc_${_H_NAME}.cpp) endif() qt5_generate_moc(${_H_PATH} ${_MOC_CPP_PATH}) list(APPEND ${_MOC_CPP_LIST} ${_MOC_CPP_PATH}) endforeach() endmacro() #............................................................................... # this macro is similar to qt5_use_modules but doesn't touch the target's # POSITION_INDEPENDENT_CODE property which MAY cause some QT statics to be # instantiated and exported from the executable -- ultimately resulting in # possible ABI versioning issues with newer QT versions (e.g. users start to # experience crashes after upgrading to qt-5.15) # # crucial for qt-5.0.x through 5.3.x; starting with 5.4.x QT macros are fixed macro( qt5_use_modules_alt _TARGET # ... ) get_target_property(_PREV_PIC ${_TARGET} POSITION_INDEPENDENT_CODE) qt5_use_modules(${_TARGET} ${ARGN}) set_target_properties(${_TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ${_PREV_PIC}) endmacro() #............................................................................... macro( add_qt_rpath_link) if(NOT QT_FOUND) message(FATAL_ERROR "QT is required for add_qt_rpath_link() macro") endif() if(NOT UNIX OR APPLE) message(FATAL_ERROR "add_qt_rpath_link should only be used on Unix") endif() if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Debug") set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath-link,'${QT_CMAKE_DIR}/..'" ) endif() endmacro() #...............................................................................
vovkos/axl
cmake/import_qt.cmake
CMake
mit
4,628
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 from loguru import logger from pathlib import Path def check_meta_yaml_for_noarch(fn:Path, text=None): import re logger.debug("Checking for noarch") if text is None: with open(fn, "rt") as fl: text = fl.read() mo = re.search(r"\n\s*noarch_python:\s*True", text) if mo: logger.info("Detected conda noarch python") return True mo = re.search(r"\n\s*noarch:\s*python", text) if mo: logger.info("Detected conda noarch python") return True return False
mjirik/discon
discon/discon_tools.py
Python
mit
600
package emplRegApp.web.manageBeans; import emplRegApp.domain.models.view.EmployeeViewModel; import emplRegApp.service.EmployeeService; import org.modelmapper.ModelMapper; import javax.enterprise.context.RequestScoped; import javax.inject.Inject; import javax.inject.Named; import java.io.Serializable; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.List; import java.util.stream.Collectors; @Named @RequestScoped public class EmployeeListBean implements Serializable { private static final long serialVersionUID = 1L; private List<EmployeeViewModel> employees; private EmployeeService employeeService; private ModelMapper modelMapper; public EmployeeListBean() { } @Inject public EmployeeListBean(EmployeeService employeeService, ModelMapper modelMapper) { this.employeeService = employeeService; this.modelMapper = modelMapper; this.employees = getAllEmployees(); } public List<EmployeeViewModel> getEmployees() { return this.employees; } public void setEmployees(List<EmployeeViewModel> employees) { this.employees = employees; } public BigDecimal getTotalMoney() { return this.employees .stream() .map(EmployeeViewModel::getSalary) .reduce(BigDecimal.ZERO, BigDecimal::add); } public BigDecimal getAverageSalary() { return this.employees.size() == 0 ? BigDecimal.ZERO : this.getTotalMoney().divide(new BigDecimal(this.employees.size()), RoundingMode.HALF_UP); } private List<EmployeeViewModel> getAllEmployees() { return this.employeeService.findAll() .stream() .map(serviceModel -> this.modelMapper.map(serviceModel, EmployeeViewModel.class)) .collect(Collectors.toList()); } }
ivelin1936/Studing-SoftUni-
Java WEB/Java Web Development Basics/Exercises - JavaServer Faces/EmplReg/src/main/java/emplRegApp/web/manageBeans/EmployeeListBean.java
Java
mit
1,904
<?php /* * Lizzy - small and fast web-page rendering engine * * Substitution-Variables and Macros() * * Usage: {{ }} * or {{x }} where x: * ^ = omit if var is not defined * # = comment out, skip altogether * ! = force late processing * & = force md compilation after evaluation */ use Symfony\Component\Yaml\Yaml; define('MAX_TRANSVAR_ITERATION_DEPTH', 100); class Transvar { private $transvars = array(); private $usedVars = array(); private $undefinedVars = array(); private $macros = array(); private $macroInfo = array(); private $invocationCounter = array(); private $sysVariables = ['head_injections', 'content', 'body_end_injections']; private $filesLoaded = array(); public $page; //.................................................... public function __construct($lzy) { $this->lzy = $lzy; $this->page = new Page; $this->config = $lzy->config; } // __construct //.................................................... public function translate($html) { $this->doTranslate($html); return $html; } // translate //.................................................... public function supervisedTranslate($page, &$html, $processShieldedElements = false) { if ($processShieldedElements) { $html = $this->unshieldVariables($html); } $modified = $this->doTranslate($html); if ($modified) { $page->merge($this->page); $this->resetPageObj(); return true; } return false; } // supervisedTranslate private function resetPageObj() { $this->page = new Page; } //.................................................... private function doTranslate(&$str, $iterationDepth = 0) { $this->page->set('frontmatter', $this->lzy->page->get('frontmatter')); if ($iterationDepth >= MAX_TRANSVAR_ITERATION_DEPTH) { fatalError("Max. iteration depth exeeded.<br>Most likely cause: a recursive invokation of a macro or variable."); } $modified = false; list($p1, $p2) = strPosMatching($str); $n = 0; while (($p1 !== false)) { if ($n++ >= MAX_TRANSVAR_ITERATION_DEPTH) { fatalError("Max. iteration depth exeeded.<br>Most likely cause: a recursive invokation of a macro or variable."); } $modified = true; $this->commmented = false; $this->optional = false; $this->dontCache = false; $this->compileMd = false; $var = trim(substr($str, $p1+2, $p2-$p1-2)); if (!$var) { $str = substr($str,0,$p1).substr($str, $p2+2); list($p1, $p2) = strPosMatching($str, '{{', '}}', $p1+1); continue; } // handle macro-modifiers, e.g. {{# }} $var = $this->handleModifers($var); if ($this->config->cachingActive && $this->dontCache) { // don't cache -> shield now and translate after read-cache $str = $this->shieldVariableInstance($str, $p1, $var, $p2); } else { if ($this->commmented) { $str = substr($str, 0, $p1) . substr($str, $p2 + 2); } else { // not commented if (strpos($var, '{{') !== false) { // nested transvar/macros $modified |= $this->doTranslate($var, $iterationDepth + 1); } $var = str_replace("\n", '', $var); // remove newlines // ----------------------------------------------------------------------- translate now: if (preg_match('/^([\w\-]+)\((.*)\)/', $var, $m)) { // macro $macro = $m[1]; $argStr = $m[2]; $val = $this->translateMacro($macro, $argStr); } else { // variable $val = $this->translateVariable($var); } // postprocessing: if (!$this->optional && ($val === false)) { // handle case when element unknown: $str = substr($str, 0, $p1) . $var . substr($str, $p2 + 2); } else { $before = substr($str, 0, $p1); $after = substr($str, $p2 + 2); // remove spurious <p></p>: if ((substr($before, -3) == '<p>') && (substr($after, 0, 4) == '</p>')) { $before = substr($before, 0, -3); $after = substr($after, 4); } $str = $before . $val . $after; } } } $n--; list($p1, $p2) = strPosMatching($str, '{{', '}}', $p1+1); } return $modified; } // doTranslate //.................................................... public function translateVariable($varName) { $val = $this->getVariable($varName); if ($val === false) { $val = $this->doUserCode($varName, $this->config->custom_permitUserCode); if (is_array($val)) { fatalError($val[1]); } } return $val; } // translateVariable //.................................................... public function translateMacro($macro, $argStr) { $this->macroArgs[$macro] = parseArgumentStr($argStr); $this->macroInx = 0; if (!isset($this->macros[$macro])) { // macro already loaded $this->loadMacro($macro); } if (isset($this->macros[$macro])) { // and try to execute it $this->optionAddNoComment = false; $val = $this->executeMacro($macro); if (($val !== null) && ($this->config->isLocalhost || $this->config->isPrivileged) && !$this->optionAddNoComment) { $val = "\n\n<!-- Lizzy Macro: $macro() -->\n$val\n<!-- /$macro() -->\n\n\n"; // mark its output } if (trim($argStr) == 'help') { if ($val2 = $this->getMacroHelp($macro)) { $val = $val2.$val; } } if ($this->compileMd) { $val = compileMarkdownStr($val); } } elseif ($this->optional) { // was marked as optional '{{^', so just skip it $val = ''; } else { // macro not defined, raise error $msg ="Error: undefined macro: '$macro()'"; logError($msg); if ($this->config->localCall || $this->config->isPrivileged) { $val = "<div class='error-msg'>$msg</div>"; } else { $val = ''; } } return $val; } // translateMacro //.................................................... private function executeMacro($macro) { $val = $this->macros[$macro]( $this->getArgsArray($macro) ); return $val; // execute the macro } // executeMacro //.................................................... public function setMacroInfo($macroName, $info) { $this->macroInfo[] = [$macroName, $info]; } // setMacroInfo //.................................................... public function getArg($macroName, $name, $help = '', $default = null, $removeNl = true /*, $dynamic = false*/) { $inx = $this->macroInx++; $this->macroFieldnames[$macroName][$inx] = $name; if (preg_match('/^\d/', $name)) { $index = intval($name); if ($index < sizeof($this->macroArgs[$macroName])) { $out = array_values($this->macroArgs[$macroName])[$index]; } } else { if (isset($this->macroArgs[$macroName][$name])) { $out = $this->macroArgs[$macroName][$name]; } else { if (isset($this->macroArgs[$macroName][$inx])) { $out = $this->macroArgs[$macroName][$inx]; } elseif ($default !== null) { $out = $default; } else { $out = null; } $this->macroArgs[$macroName][$name] = $out; // prepare named option as well } } if ($removeNl && is_string($out)) { $out = str_replace('↵', '', $out); } $this->macroHelp[$macroName][$name] = $help; return $out; } // getArg //.................................................... private function getArgsArray($macroName, $removeNl = true, $argNames = false) { //??? unfinished! // -> removeNl in case of $argNames provided $this->macroHelp[$macroName] = []; if ($argNames && is_array($argNames)) { $an = []; foreach ($argNames as $i => $argName) { if (isset($this->macroArgs[$macroName][$argName])) { $an[$argName] = $this->macroArgs[$macroName][$argName]; } elseif (isset($this->macroArgs[$macroName][$i])) { $an[$argName] = $this->macroArgs[$macroName][$i]; } else { $an[$argName] = ''; } } return $an; } if (!$this->macroArgs[$macroName]) { return []; } if ($removeNl) { $a = []; foreach ($this->macroArgs[$macroName] as $key => $value) { $key = trim(str_replace(['↵',"'"], '', $key)); $a[$key] = $value; } return $a; } else { return $this->macroArgs[$macroName]; } } // getArgsArray //.................................................... private function getMacroHelp($macroName) { $argsHelp = $this->macroHelp[$macroName]; if (!$argsHelp) { // don't show anything if there are no arguments listed return ''; } $out = ''; foreach ($argsHelp as $name => $text) { $out .= "\t<dt>$name:</dt>\n\t\t<dd>$text</dd>\n"; } $out = "<h2>Options for macro <em>$macroName()</em></h2>\n<dl>\n$out</dl>\n"; return $out; } // getMacroHelp //.................................................... public function getInvocationCounter($macroName) { if (!isset($this->invocationCounter[$macroName])) { $this->invocationCounter[$macroName] = 0; } $this->invocationCounter[$macroName]++; return $this->invocationCounter[$macroName]; } // getInvocationCounter //.................................................... public function adaptBraces($str) { return str_replace(['{||{','}||}'], ['{{', '}}'], $str); } // adaptBraces //.................................................... public function loadAllMacros() { $page = $this->page = new Page; $sys = '~/'.$this->config->systemPath; $macrosPath = $this->config->macrosPath; $macros = []; $files = getDir($this->config->macrosPath.'*.php'); foreach ($files as $file) { $moduleName = basename($file, '.php'); $info = ''; $lines = file($file); $l = array_filter($lines, function($v, $k) { return (strpos($v, '@info') !== false); }, ARRAY_FILTER_USE_BOTH); if ($l) { $info = preg_replace('/^[^\:]*\s*:\s*/', '', array_pop($l)); } $macros[$moduleName] = $info; } ksort($macros); $this->macroInfo = $macros; } // loadAllMacros //.................................................... private function loadMacro($macroName) { $sys = '~/'.$this->config->systemPath; // to be available inside marco $page = &$this->page; // to be available inside marco $file = $this->config->macrosPath.$macroName.'.php'; if (file_exists($file)) { // filename == macroname require_once($file); } else { $file = $this->config->extensionsPath."$macroName/code/".$macroName.'.php'; if (file_exists($file)) { // filename == macroname require_once($file); } else { // check user-code: if macro.php is in code/ folder: $file = $this->config->path_userCodePath . $macroName . '.php'; if (file_exists($file)) { if ($this->config->custom_permitUserCode) { $this->doUserCode($file); } else { fatalError("Execution of user macro '<strong>$macroName()</strong>' blocked.<br>". "You need to modify permission in <strong>config/config.yaml</strong> (&rarr; <code>custom_permitUserCode: true</code>)"); } } } } } // loadMacro //.................................................... public function readTransvarsFromFiles($file, $markSource = false) { // read from multiple files if (is_array($file)) { $a = $file; foreach ($a as $f) { $files = glob($f); foreach ($files as $ff) { if (substr(basename($ff), 0, 1) == '#') { continue; } $this->readTransvarsFromFile($ff, $markSource); } } } elseif (strpos($file, '*') !== false) { $files = glob($file); foreach ($files as $f) { if (substr(basename($f), 0, 1) == '#') { continue; } $this->readTransvarsFromFile($f, $markSource); } } else { $this->readTransvarsFromFile($file, $markSource); } } // readTransvarsFromFiles //.................................................... public function readTransvarsFromFile($file, $markSource = false) { if ($file[0] == '~') { $file = resolvePath($file); } if (!file_exists($file)) { fatalError("File not found: '$file'", 'File: '.__FILE__.' Line: '.__LINE__); } if (!in_array($file, $this->filesLoaded)) { // avoid multiple loading of transvar files $this->filesLoaded[] = $file; $newVars = getYamlFile($file); if (is_array($newVars)) { $markSource = true; if ($this->config->debug_showVariablesUnreplaced) { // for debugging array_walk($newVars, function (&$value, &$key, $file) { if ($key != 'page_title') { $value = "<span title='$file'>&#123;&#123; $key }}</span>"; } }, $file); $markSource = false; // no need to also mark source } if ($markSource) { foreach ($newVars as $key => $rec) { if (!is_array($rec)) { $v = $rec; unset($newVars[$key]); $newVars[$key]['_'] = $v; } $newVars[$key]['src'] = $file; }; } $this->transvars = array_merge($this->transvars, $newVars); } } } // readTransvarsFromFile //.................................................... public function addVariable($key, $value, $lang = '') { if ($lang === false) { // delete first $this->transvars[$key] = ''; } if ($lang) { if (!isset($this->transvars[$key][$lang])) { $this->transvars[$key][$lang] = $value; } else { $this->transvars[$key][$lang] .= $value; } } else { if (!isset($this->transvars[$key])) { $this->transvars[$key] = $value; } else { $this->transvars[$key] .= $value; } } } // addVariable public function addVariables($variables) { foreach ($variables as $key => $value) { $this->transvars[$key] = $value; } } // addVariables //.................................................... public function clearVariable($key) { if (isset($this->transvars[$key])) { $this->transvars[$key] = ''; } } // clearVariable //.................................................... public function addMacro($macroName, $func) { $this->macros[$macroName] = $func; } // addMacro //.................................................... public function getVariable($key, $lang = '') { $lang = ($lang) ? $lang : $this->config->lang; $out = false; if (isset($this->transvars[$key])) { $entry = $this->transvars[$key]; if (($key{0} != '_') && (!in_array($key, $this->sysVariables))) { $this->usedVars['@:'.$key] = $entry; } if ($this->config->debug_monitorUnusedVariables && is_array($entry)) { if (isset($entry['uu'])) { unset($this->transvars[$key]['uu']); } } if (!is_array($entry)) { $out = $entry; } elseif (isset($entry['dontCache']) && $entry['dontCache']) { $out = "{||{ $key }||}"; } elseif (isset($entry[$lang])) { $out = $entry[$lang]; } elseif (isset($entry[$lang]) && ($entry[$lang] === null)) { fatalError("Error: transvar with empty value: '$key'", 'File: '.__FILE__.' Line: '.__LINE__); } elseif (isset($entry['_'])) { $out = $entry['_']; } elseif (isset($entry['*'])) { $out = $entry['*']; } elseif (isset($entry[$this->config->site_defaultLanguage])) { // lang-rcs nor explicit default found -> use default-lang $out = $entry[$this->config->site_defaultLanguage]; } else { // this should only happen if a wrong value gets into $_SESSION fatalError("Error: transvar without propre value: '$key'", 'File: '.__FILE__.' Line: '.__LINE__); } } elseif ($this->config->debug_showUndefinedVariables) { if (!in_array($key, ['PageSource Load previous edition', 'PageSource Load next edition', 'PageSource cancel', 'PageSource activate edition', 'Page-History:'])) { $out = "<span class='mark-undefined-variable'>&#123;&#123; $key }}</span>"; $this->undefinedVars[] = $key; } } else { if ((strlen($key) > 0) && ($key{0} != '_') && (!in_array($key, $this->sysVariables))) { $this->usedVars['_@:'.$key] = ''; } } return $out; } // getVariable //.................................................... public function exportUsedVariables() { ksort($this->usedVars); return convertToYaml($this->usedVars); } // exportUsedVariables //.................................................... public function loadUserComputedVariables() { $code = USER_VAR_DEF_FILE; if ($this->config->custom_permitUserVarDefs && file_exists($code)) { $this->doUserCode( basename($code, '.php'), $this->config->custom_permitUserVarDefs ); } } // loadUserComputedVariables //.................................................... public function doUserCode($name, $execType = null, $breakOnError = false) { $out = false; if ($execType === null) { $execType = $this->config->custom_permitUserCode; } if ($execType) { $phpFile = $this->config->path_userCodePath.basename($name,'.php').'.php'; if (file_exists($phpFile)) { $page = &$this->page; if (($execType === 'true') || ($execType === true)) { // if ($execType == 'true') { $res = require($phpFile); if (is_array($res)) { foreach ($res as $key => $value) { $this->addVariable($key, $value); } } elseif (is_string($res)) { $out = $res; } } else { fatalError("PHP-Sandbox feature currently not supported."); // To re-enable, run // composer install corveda/php-sandbox $sandbox = new MySandbox(); $vars['this'] = $this; // feed $trans into sandbox return $sandbox->execute($phpFile, $this->config->configPath, $vars); } } elseif ($breakOnError) { return [false, "Requested file '$phpFile' not found."]; } } elseif ($breakOnError) { return [false, "User-Code not enabled in config/config.yaml (option 'custom_permitUserCode')"]; } return $out; } // doUserCode //.................................................... public function loadStandardVariables($siteStructure) { $this->siteStructure = $siteStructure; $this->addVariable('pagetitle', $siteStructure->currPageRec['name']); if (isset($this->siteStructure->currPageRec['inx'])) { $this->addVariable('numberofpages', $siteStructure->getNumberOfPages()); $this->addVariable('pagenumber', $siteStructure->currPageRec['inx'] + 1); } else { $this->addVariable('numberofpages', ''); $this->addVariable('pagenumber', ''); } } // loadStandardVariables //.................................................... public function readAll($lang = false) { $lang = ($lang) ? $lang : $this->lang; $vars = array(); foreach ($this->transvars as $key => $entry) { if (!is_array($entry)) { $vars[$key] = $entry; } elseif (isset($entry[$lang])) { $vars[$key] = $entry[$lang]; } elseif (isset($entry['_'])) { $vars[$key] = $entry['_']; } else { logError("Error: transvar without propre value: '$key'"); } } return $vars; } // readAll //.................................................... public function renderAllTranslationObjects($lang = false) { $this->loadAllMacros(); if ($lang) { $transvars = $this->readAll($lang); } else { $transvars = &$this->transvars; } $out = $this->renderAllVariables($transvars); $out .= $this->renderAllMacros(); return $out; } private function renderAllVariables($transvars) { uksort($transvars, "strnatcasecmp"); $str = "\n\t<div class='lzy-list-transvars'>\n\t\t<h1>Transvars:</h1>\n"; foreach ($transvars as $key => $rec) { if (isset($rec['uu'])) { $inactive = ' unused'; unset($rec['uu']); } else { $inactive = ''; } if (isset($rec['src'])) { $src = " <span class='lzy-list-src'>({$rec['src']})</span>"; unset($rec['src']); } else { $src = ''; } $str .= <<<EOT <div class='lzy-list-entry$inactive'> <div class='lzy-list-line'><span class='lzy-list-var'>$key:</span>$src</div> EOT; if (is_array($rec)) { foreach ($rec as $lang => $text) { $text = htmlentities($text); $str .= <<<EOT <div class='lzy-list-line'> <span class='lzy-list-attr-name'>$lang</span>: <span class='lzy-list-attr-value'>$text</span> </div> EOT; } } else { $rec = htmlentities($rec); $str .= <<<EOT <div class='lzy-list-line'> <span class='lzy-list-scalar-value'>$rec</span> </div> EOT; } $str .= <<<EOT </div> EOT; } $str .= "\t</div>\n"; return $str; } private function renderAllMacros() { $macros = $this->macroInfo; $out = ''; foreach($macros as $name => $info) { $out .= "<div><span class='lzy-macro-name'>$name()</span>: <span class='lzy-macro-info'>$info</span></div>\n"; } $out = "<h2>Macros</h2>$out\n"; return $out; } public function reset( $files ) { $this->processFiles($files, 'resetFile'); } private function resetFile($file) { copy($file, $file.'.0'); $lines = file($file); $out = ''; foreach ($lines as $i => $l) { $l1 = isset($lines[$i+1]) ? $lines[$i+1] : ''; if (preg_match('/^[^\#]*:\s*$/', $l) && (strpos($l1, 'uu: true') === false)) { $out .= "$l uu: true\n"; } else { $out .= $l; } } file_put_contents($file, $out); } public function postprocess() { $this->updateUndefinedVarsFile(); return $this->processFiles($GLOBALS['files'], 'updateTransvarFile'); } public function removeUnusedVariables() { return $this->processFiles($GLOBALS['files'], 'removeUnusedVariableFromFile'); } private function removeUnusedVariableFromFile($filename) { $lines = file($filename); $out = ''; $outInactive = ''; $var = false; $end = false; $modified = false; $note = ''; $rec = ''; $unused = false; foreach ($lines as $line) { if (strpos($line, '__END__') === 0) { $end = true; } if (preg_match('/^([^\#]*):\s*$/m', $line, $m)) { // beginning of var if ($unused) { // append previous rec: $note .= "<p>$var</p>\n"; $outInactive .= $rec; } else { $out .= $rec; } $var = $m[1]; $rec = ''; $unused = false; } if ((isset($line{0}) && ($line{0} != '/')) && (!$end && strpos($line, 'uu: true') !== false)) { if (isset($this->transvars[$var]['uu'])) { $unused = true; } } $rec .= $line; } if ($outInactive) { $out .= "\n\n__END__\n#############################################\n# Unused Variables:\n\n".$outInactive; $note = "<h2>File updated: $filename</h2>\n".$note; file_put_contents($filename . ".1", $out); } return $note; } public function renderUnusedVariables() { return $this->processFiles($GLOBALS['files'], 'renderUnusedInFile'); } private function renderUnusedInFile($filename) { return "<p>renderUnusedInFile() not implemented yet [$filename]</p>"; } private function updateTransvarFile($filename) { $lines = file($filename); $out = ''; $var = false; $end = false; $modified = false; $note = ''; foreach ($lines as $line) { if (strpos($line, '__END__') === 0) { $end = true; } if (preg_match('/^([^\#]*):\s*$/m', $line, $m)) { $var = $m[1]; } if ((isset($line{0}) && ($line{0} != '/')) && (!$end && strpos($line, 'uu: true') !== false)) { if (isset($this->transvars[$var]['uu'])) { $out .= $line; } else { $note .= "used var: $var<br>\n"; $modified = true; } } else { $out .= $line; } } if ($modified) { $note = "<h2>$filename</h2>\n".$note; file_put_contents($filename, $out); } return $note; } private function processFiles($filenames, $fun) { $note = ''; foreach($filenames as $file) { if (substr($file, -1) == '*') { $files2 = getDir($file); foreach ($files2 as $f) { if (fileExt($f) == 'yaml') { $note .= $this->$fun($f); } } } else { $note .= $this->$fun($file); } } return $note; } private function updateUndefinedVarsFile() { if (!$this->undefinedVars) { return; } $undefinedVars = getYamlFile(UNDEFINED_VARS_FILE); $rec = []; $supportedLanguages = explode(',', str_replace(' ', '', $this->config->site_supportedLanguages )); foreach ($supportedLanguages as $l) { $rec[$l] = ''; } foreach ($this->undefinedVars as $key) { $undefinedVars[$key] = $rec; } ksort($undefinedVars); writeToYamlFile(UNDEFINED_VARS_FILE, $undefinedVars); } public function getPageObject() { return $this->page; } private function handleModifers($var) { $c1 = $var{0}; if (strpos('#^!&', $c1) !== false) { // modifier? #, ^, !, & $var = trim(substr($var, 1)); if ($c1 == '#') { $this->commmented = true; } elseif ($c1 == '!') { $this->dontCache = true; } elseif ($c1 == '&') { $this->compileMd = true; } else { $this->optional = true; } } return $var; } private function shieldVariableInstance(&$str, $p1, $var, $p2) { return substr($str, 0, $p1) . "{||{ $var }||}" . substr($str, $p2 + 2); } public function shieldedVariablePresent($str) { return (strpos($str, '{||{') !== false); } public function unshieldVariables($str) { return str_replace(["{||{","}||}"], ['{{', '}}'], $str); } } // Transvar
zurisee/lizzycms
transvar.class.php
PHP
mit
30,747
// // BFDisplayEventProtocol.h // HomePage https://github.com/wans3112/BFDisplayEvent // // Created by wans on 2017/4/12. // Copyright © 2017年 wans,www.wans3112.cn All rights reserved. // #ifndef BFDisplayEventProtocol_h #define BFDisplayEventProtocol_h #import "BFEventModel.h" /** 参数传递block @param eventModel 参数model */ typedef void (^BFEventManagerBlock)(BFEventModel* eventModel); typedef void (^BFEventManagerDoneBlock)(); /** 显示数据协议 */ @protocol BFDisplayProtocol <NSObject> - (void)em_displayWithModel:(BFEventManagerBlock)eventBlock; @end /** 点击事件协议 */ @protocol BFEventManagerProtocol <NSObject> - (void)em_didSelectItemWithModel:(BFEventModel *)eventModel; - (void)em_didSelectItemWithModelBlock:(BFEventManagerBlock)eventBlock; @required - (NSString *)em_eventManagerWithPropertName; @end #endif /* BFDisplayEventProtocol_h */
wans3112/BFDisplayEvent
BFDisplayEvent/Classes/BFDisplayEventProtocol.h
C
mit
904
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Problem23SeriesOfLetters")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Problem23SeriesOfLetters")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("8a4b02de-bd6b-4309-8e80-b6d209949944")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
koravski/TelerikAcademy
02.C#2/06.StringsAndTextProcessing/Problem23SeriesOfLetters/Properties/AssemblyInfo.cs
C#
mit
1,424
<?php /* Unsafe sample input : get the field UserData from the variable $_POST sanitize : none construction : concatenation with simple quote */ /*Copyright 2015 Bertrand STIVALET Permission is hereby granted, without written agreement or royalty fee, to use, copy, modify, and distribute this software and its documentation for any purpose, provided that the above copyright notice and the following three paragraphs appear in all copies of this software. IN NO EVENT SHALL AUTHORS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. AUTHORS SPECIFICALLY DISCLAIM ANY WARRANTIES INCLUDING, BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THE SOFTWARE IS PROVIDED ON AN "AS-IS" BASIS AND AUTHORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.*/ $tainted = $_POST['UserData']; //no_sanitizing $query = "SELECT Trim(a.FirstName) & ' ' & Trim(a.LastName) AS employee_name, a.city, a.street & (' ' +a.housenum) AS address FROM Employees AS a WHERE a.supervisor='". $tainted . "'"; //flaw $conn = mysql_connect('localhost', 'mysql_user', 'mysql_password'); // Connection to the database (address, user, password) mysql_select_db('dbname') ; echo "query : ". $query ."<br /><br />" ; $res = mysql_query($query); //execution while($data =mysql_fetch_array($res)){ print_r($data) ; echo "<br />" ; } mysql_close($conn); ?>
stivalet/PHP-Vulnerability-test-suite
Injection/CWE_89/unsafe/CWE_89__POST__no_sanitizing__multiple_AS-concatenation_simple_quote.php
PHP
mit
1,634
<?php /* Safe sample input : backticks interpretation, reading the file /tmp/tainted.txt sanitize : use of intval construction : interpretation with simple quote */ /*Copyright 2015 Bertrand STIVALET Permission is hereby granted, without written agreement or royalty fee, to use, copy, modify, and distribute this software and its documentation for any purpose, provided that the above copyright notice and the following three paragraphs appear in all copies of this software. IN NO EVENT SHALL AUTHORS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. AUTHORS SPECIFICALLY DISCLAIM ANY WARRANTIES INCLUDING, BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THE SOFTWARE IS PROVIDED ON AN "AS-IS" BASIS AND AUTHORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.*/ $tainted = `cat /tmp/tainted.txt`; $tainted = intval($tainted); $var = require("pages/'$tainted'.php"); ?>
stivalet/PHP-Vulnerability-test-suite
Injection/CWE_98/safe/CWE_98__backticks__func_intval__require_file_id-interpretation_simple_quote.php
PHP
mit
1,189
/* * Don't change this. It's a template, so copy paste and adjust for your needs. */ package Servlets; import Beans.LoggedIn; import Models.PartyAnimalsModel; import Beans.PartyAnimalsBean; import java.io.IOException; import java.io.PrintWriter; import java.sql.SQLException; import java.util.logging.Level; import java.util.logging.Logger; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; /** * * @author Philipp */ @WebServlet(name = "PartyAnimalsServlet", urlPatterns = {"/PartyAnimals"}) public class PartyAnimalsServlet extends HttpServlet { /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); try (PrintWriter out = response.getWriter()) { /* TODO output your page here. You may use following sample code. */ out.println("<!DOCTYPE html>"); out.println("<html>"); out.println("<head>"); out.println("<title>Servlet PartyAnimalsServlet</title>"); out.println("</head>"); out.println("<body>"); out.println("<h1>Servlet PartyAnimalsServlet at " + request.getContextPath() + "</h1>"); out.println("</body>"); out.println("</html>"); } } @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("doGet in PartyAnimalsServlet.java."); PartyAnimalsModel PartyAnimalsModelObj = new PartyAnimalsModel(); try { // Retrieve the attribute that holds all data which was retrieved by the Model from the Database. request.setAttribute("JSONListAttribute", PartyAnimalsModelObj.getJSONObjectList() ); } catch (SQLException ex) { Logger.getLogger(PartyAnimalsServlet.class.getName()).log(Level.SEVERE, null, ex); } System.out.println("after try in doPost in PartyAnimalsServlet.java"); RequestDispatcher rd = request.getRequestDispatcher("/PartyAnimals.jsp"); rd.forward(request, response); } /** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //processRequest(request, response); System.out.println("doPost in PartyAnimalsServlet.java."); // None of this is done. HttpSession session = request.getSession(); LoggedIn loggedin = (LoggedIn) session.getAttribute("loggedin"); PartyAnimalsModel PartyAnimalsModelObj = new PartyAnimalsModel(); //if (request.getParameter("type").equals("To Philipp's Test Page")) // This is weird. "type"?? why not "value" ? //{ //request.setAttribute("type", "pos"); try { System.out.println("try in doPost in PartyAnimalsServlet.java"); //request. ? //session.setAttribute("PartyAnimalsAttribute", PartyAnimalsModelObj.getBeanList() ); // JSONObject request.setAttribute("JSONListAttribute", PartyAnimalsModelObj.getJSONObjectList() ); } catch (SQLException ex) { Logger.getLogger(PartyAnimalsServlet.class.getName()).log(Level.SEVERE, null, ex); System.out.println("catch in doPost in PartyAnimalsServlet.java"); } System.out.println("after try in doPost in PartyAnimalsServlet.java"); RequestDispatcher rd = request.getRequestDispatcher("/PartyAnimals.jsp"); rd.forward(request, response); //} } /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return "I like Servlets. - Sufea2k17"; }// </editor-fold> }
Team4-AC41004/YoYoString
src/java/Servlets/PartyAnimalsServlet.java
Java
mit
5,009
# encoding: utf-8 module QueryBuilder::CQL module Contexts # Describes the Cassandra table index # class Permission < Base attribute :name attribute :keyspace attribute :table # Returns the name of the context for permission # # @return [String] # def to_s return "TABLE #{table}" if table return "KEYSPACE #{keyspace}" if keyspace "ALL KEYSPACES" end # Builds the 'LIST PERMISSIONS' CQL statement # # @param [#to_s] name The name of either a user or role # # @return [QueryBuilder::Statements::ListPermissions] # def of(name) Statements::ListPermissions.new(context: self, name: name) end # Builds the 'GRANT' CQL statement # # @param [#to_s] name The name of either a user or role # # @return [QueryBuilder::Statements::Grant] # def grant_to(name) Statements::Grant.new(context: self, name: name) end # Builds the 'REVOKE' CQL statement # # @param [#to_s] name The name of either a user or role # # @return [QueryBuilder::Statements::Revoke] # def revoke_from(name) Statements::Revoke.new(context: self, name: name) end end # class Permission end # module Contexts end # module QueryBuilder::CQL
nepalez/query_builder
lib/query_builder/cql/contexts/permission.rb
Ruby
mit
1,375
--- id: conditional_evaluation title: Conditional Evaluation slug: conditional-evaluation.html --- There are several ways to disable tests. Some of these are hardcoded in your test, others are evaluated at runtime. ### By Config You can disable a test case simply by setting the config parameter `enabled` to `false`. If you're looking for something like JUnit's `@Ignore`, this is for you. ```kotlin "should do something".config(enabled = false) { ... } ``` You can use the same mechanism to run tests only under certain conditions. For example you could run certain tests only on Linux systems using [SystemUtils](http://commons.apache.org/proper/commons-lang/javadocs/api-release/org/apache/commons/lang3/SystemUtils.html#IS_OS_WINDOWS) .IS_OS_LINUX from [Apache Commons Lang](https://commons.apache.org/proper/commons-lang/). ```kotlin "should do something".config(enabled = IS_OS_LINUX) { ... } ``` `isLinux` and `isPostgreSQL` in the example are just expressions (values, variables, properties, function calls) that evaluate to `true` or `false`. If you want to use a function that is based on the test rather than a value, then you can use `enabledIf`. For example, if we wanted to disable all tests that begin with the word "danger" unless we were executing on Linux, then we could do this: ```kotlin val disableDangerOnWindows: EnabledIf = { !it.name.startsWith("danger") || IS_OS_LINUX } "danger will robinson".config(enabledIf = disableDangerOnWindows) { // test here } "very safe will".config(enabledIf = disableDangerOnWindows) { // test here } ``` ### Focus Kotest supports isolating a single **top level** test by preceding the test name with `f:`. Then only that test (and any subtests defined inside that scope) will be executed, with the rest being skipped. For example, in the following snippet only the middle test will be executed. ```kotlin class FocusExample : StringSpec({ "test 1" { // this will be skipped } "f:test 2" { // this will be executed } "test 3" { // this will be skipped } }) ``` :::note Focus mode **does not** work for nested tests due to the fact that nested tests are only discovered once the parent test has executed. ::: ### Bang The opposite of focus is possible, which is to prefix a test with an exclamation mark `!` and then that test (and any subtests defined inside that scope) will be skipped. In the next example we’ve disabled the first test by adding the “!” prefix. ```kotlin class BangExample : StringSpec({ "!test 1" { // this will be ignored } "test 2" { // this will run } "test 3" { // this will run too } }) ``` :::tip If you want to disable the use of ! then set the system property `kotest.bang.disable` to `true`. ::: ### X-Methods Many spec styles offer variants of their keywords that begin with `x` to disable execution. This is a popular approach with Javascript testing frameworks. The idea is you can quickly add the x character to the test declaration to (temporarily) disable it. For example, with describe spec we can do this: ```kotlin class XMethodsExample : DescribeSpec({ xdescribe("this block and it's children are now disabled") { it("will not run") { // disabled test } } }) ``` See which specs support this, and the syntax required on the [specs styles guide](styles.md). ### @Ignored If you wish to disable all tests in a Spec, we may use the @Ignored annotation. Then the spec will be skipped, and not even instantiated. ```kotlin @Ignored class IgnoredSpec : FunSpec() { init { error("boom") // spec will not be created so this error will not happen } } ``` :::note This is only available on the JVM target. ::: ### @EnabledIf Similar to @Ignored, we can use a function to determine if a spec should be created. The @EnabledIf annotation requires a class that implements `EnabledCondition`. For example, we may wish to only execute a test on Linux platforms if the name contains Linux. ```kotlin class LinuxOnlyCondition : EnabledCondition() { override fun enabled(specKlass: KClass<out Spec>): Boolean = if (specKlass.simpleName?.contains("Linux") == true) IS_OS_LINUX else true } ``` Then we can apply that to one or more specs ```kotlin @EnabledIf(LinuxOnlyCondition::class) class MyLinuxTest1 : FunSpec() { .. } @EnabledIf(LinuxOnlyCondition::class) class MyLinuxTest2 : DescribeSpec() { .. } ``` :::note This is only available on the JVM target. ::: ## Gradle Test Filtering When running Kotest via the JUnit Platform runner through gradle, Kotest supports the standard gradle syntax for test filtering. You can enable filtering either in the build script or via the --tests command-line option. For example, in the build script: ```groovy tasks.test { filter { //include all tests from package includeTestsMatching("com.sksamuel.somepackage.*") } } ``` Or via the command line: ```gradle test --tests 'com.sksamuel.somepackage*'``` ```gradle test --tests '*IntegrationTest'``` See full Gradle documentation [here](https://docs.gradle.org/6.2.2/userguide/java_testing.html#test_filtering). :::note Because gradle's test support is method/class based, we cannot filter tests down to the individual test level, only the class level. :::
sksamuel/ktest
documentation/docs/framework/conditional_evaluation.md
Markdown
mit
5,331
package org.telegram.api.functions.messages; import org.telegram.api.message.media.TLAbsMessageMedia; import org.telegram.tl.StreamingUtils; import org.telegram.tl.TLContext; import org.telegram.tl.TLMethod; import org.telegram.tl.TLObject; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; /** * The type TL request messages get web page preview. */ public class TLRequestMessagesGetWebPagePreview extends TLMethod<TLAbsMessageMedia> { /** * The constant CLASS_ID. */ public static final int CLASS_ID = 0x25223e24; private String message = ""; /** * Instantiates a new TL request messages get web page preview. */ public TLRequestMessagesGetWebPagePreview() { super(); } public int getClassId() { return CLASS_ID; } /** * Gets message. * * @return the message */ public String getMessage() { return this.message; } /** * Sets message. * * @param message the message */ public void setMessage(String message) { this.message = message; } public TLAbsMessageMedia deserializeResponse(InputStream stream, TLContext context) throws IOException { TLObject res = StreamingUtils.readTLObject(stream, context); if (res == null) throw new IOException("Unable to parse response"); if ((res instanceof TLAbsMessageMedia)) return (TLAbsMessageMedia) res; throw new IOException("Incorrect response type. Expected org.telegram.api.message.media.TLAbsMessageMedia, got: " + res.getClass().getCanonicalName()); } @Override public void serializeBody(OutputStream stream) throws IOException { StreamingUtils.writeTLString(this.message, stream); } @Override public void deserializeBody(InputStream stream, TLContext context) throws IOException { this.message = StreamingUtils.readTLString(stream); } public String toString() { return "messages.getWebPagePreview#25223e24"; } }
rubenlagus/TelegramApi
src/main/java/org/telegram/api/functions/messages/TLRequestMessagesGetWebPagePreview.java
Java
mit
2,110
# coding: utf-8 from __future__ import unicode_literals import re import os from django.shortcuts import render from django.conf import settings def index(request): p = re.compile(r'^app\d+_') apps = (a.split('_') for a in settings.INSTALLED_APPS if p.match(a)) return render(request, 'ignore_me/index.html', {"apps": sorted(apps), "settings": settings})
sametmax/Django--an-app-at-a-time
ignore_this_directory/ignore_me/views.py
Python
mit
391
using System; using DotNet.Globbing.Token; namespace DotNet.Globbing.Evaluation { public class AnyCharacterTokenEvaluator : IGlobTokenEvaluator { private readonly AnyCharacterToken _token; public AnyCharacterTokenEvaluator(AnyCharacterToken token) { _token = token; } #if SPAN public bool IsMatch(ReadOnlySpan<char> allChars, int currentPosition, out int newPosition) #else public bool IsMatch(string allChars, int currentPosition, out int newPosition) #endif { newPosition = currentPosition + 1; var currentChar = allChars[currentPosition]; if (GlobStringReader.IsPathSeparator(currentChar)) { return false; } return true; } public virtual int ConsumesMinLength { get { return 1; } } public bool ConsumesVariableLength { get { return false; } } } }
dazinator/DotNet.Glob
src/DotNet.Glob/Evaluation/AnyCharacterTokenEvaluator.cs
C#
mit
1,003
## 2020-01-11 #### all #### unknown * [yuanming-hu / difftaichi](https://github.com/yuanming-hu/difftaichi):10 differentiable physical simulators built with Taichi differentiable programming (DiffTaichi, ICLR 2020) * [aspittel / coding-cheat-sheets](https://github.com/aspittel/coding-cheat-sheets):Various cheat sheets on CS stuff * [wesbos / awesome-uses](https://github.com/wesbos/awesome-uses):A list of /uses pages detailing developer setups, gear, software and configs. * [infosecn1nja / Red-Teaming-Toolkit](https://github.com/infosecn1nja/Red-Teaming-Toolkit):A collection of open source and commercial tools that aid in red team operations. * [hakluke / how-to-exit-vim](https://github.com/hakluke/how-to-exit-vim):Below are some simple methods for exiting vim. * [lubosson / jetbrain-activation-code](https://github.com/lubosson/jetbrain-activation-code):jetbrain software全家桶激活码activation code, including intellij idea,pycharm,datagrip, webstorm... * [sindresorhus / awesome](https://github.com/sindresorhus/awesome):😎 Awesome lists about all kinds of interesting topics * [brillout / awesome-react-components](https://github.com/brillout/awesome-react-components):Curated List of React Components & Libraries. * [ankane / awesome-legal](https://github.com/ankane/awesome-legal):Awesome free legal documents for companies * [kelseyhightower / kubernetes-the-hard-way](https://github.com/kelseyhightower/kubernetes-the-hard-way):Bootstrap Kubernetes the hard way on Google Cloud Platform. No scripts. * [EbookFoundation / free-programming-books](https://github.com/EbookFoundation/free-programming-books):📚 Freely available programming books * [clovaai / stargan-v2](https://github.com/clovaai/stargan-v2):StarGAN v2 - Official PyTorch Implementation * [rshipp / awesome-malware-analysis](https://github.com/rshipp/awesome-malware-analysis):A curated list of awesome malware analysis tools and resources. * [Awesome-Windows / Awesome](https://github.com/Awesome-Windows/Awesome):💻 An awesome & curated list of best applications and tools for Windows. * [MunGell / awesome-for-beginners](https://github.com/MunGell/awesome-for-beginners):A list of awesome beginners-friendly projects. * [arduino / arduino-pro-ide](https://github.com/arduino/arduino-pro-ide):The Arduino IDE for advanced users and developers. Experimental alpha version. * [AnthonyCalandra / modern-cpp-features](https://github.com/AnthonyCalandra/modern-cpp-features):A cheatsheet of modern C++ language and library features. * [AdrienTorris / awesome-blazor](https://github.com/AdrienTorris/awesome-blazor):Resources for Blazor, a .NET web framework using C#/Razor and HTML that runs in the browser with WebAssembly. * [JetBrains / intellij-community](https://github.com/JetBrains/intellij-community):IntelliJ IDEA Community Edition * [imthenachoman / How-To-Secure-A-Linux-Server](https://github.com/imthenachoman/How-To-Secure-A-Linux-Server):An evolving how-to guide for securing a Linux server. * [joelparkerhenderson / architecture_decision_record](https://github.com/joelparkerhenderson/architecture_decision_record):Architecture decision record (ADR) examples for software planning, IT leadership, and template documenation * [philipwalton / flexbugs](https://github.com/philipwalton/flexbugs):A community-curated list of flexbox issues and cross-browser workarounds for them. * [ruanyf / free-books](https://github.com/ruanyf/free-books):互联网上的免费书籍 * [ktaranov / naming-convention](https://github.com/ktaranov/naming-convention):Templates for naming convention - TSQL, JavaScript, C#, R, Python, Powershell * [MiCode / Xiaomi_Kernel_OpenSource](https://github.com/MiCode/Xiaomi_Kernel_OpenSource):Xiaomi Mobile Phone Kernel OpenSource #### python * [django / django](https://github.com/django/django):The Web framework for perfectionists with deadlines. * [mlflow / mlflow](https://github.com/mlflow/mlflow):Open source platform for the machine learning lifecycle * [minimaxir / big-list-of-naughty-strings](https://github.com/minimaxir/big-list-of-naughty-strings):The Big List of Naughty Strings is a list of strings which have a high probability of causing issues when used as user-input data. * [psf / requests](https://github.com/psf/requests):A simple, yet elegant HTTP library. * [irfanICMLL / CoupleGenerator](https://github.com/irfanICMLL/CoupleGenerator):Generate your lover with your photo * [google-research / ALBERT](https://github.com/google-research/ALBERT):ALBERT: A Lite BERT for Self-supervised Learning of Language Representations * [dask / dask](https://github.com/dask/dask):Parallel computing with task scheduling * [zpoint / CPython-Internals](https://github.com/zpoint/CPython-Internals):Dive into CPython internals, trying to illustrate every detail of CPython implementation | CPython 源码阅读笔记, 多图展示底层实现细节 * [OWASP / CheatSheetSeries](https://github.com/OWASP/CheatSheetSeries):The OWASP Cheat Sheet Series was created to provide a concise collection of high value information on specific application security topics. * [Qiskit / qiskit-terra](https://github.com/Qiskit/qiskit-terra):Terra provides the foundations for Qiskit. It allows the user to write quantum circuits easily, and takes care of the constraints of real hardware. * [graphql-python / graphene-django](https://github.com/graphql-python/graphene-django):Integrate GraphQL into your Django project. * [encode / django-rest-framework](https://github.com/encode/django-rest-framework):Web APIs for Django. 🎸 * [tiangolo / fastapi](https://github.com/tiangolo/fastapi):FastAPI framework, high performance, easy to learn, fast to code, ready for production * [floodsung / Deep-Learning-Papers-Reading-Roadmap](https://github.com/floodsung/Deep-Learning-Papers-Reading-Roadmap):Deep Learning papers reading roadmap for anyone who are eager to learn this amazing tech! * [plotly / dash](https://github.com/plotly/dash):Analytical Web Apps for Python & R. No JavaScript Required. * [gto76 / python-cheatsheet](https://github.com/gto76/python-cheatsheet):Comprehensive Python Cheatsheet * [OpenMined / PySyft](https://github.com/OpenMined/PySyft):A library for encrypted, privacy preserving machine learning * [ray-project / ray](https://github.com/ray-project/ray):A fast and simple framework for building and running distributed applications. Ray is packaged with RLlib, a scalable reinforcement learning library, and Tune, a scalable hyperparameter tuning library. * [facebookresearch / SlowFast](https://github.com/facebookresearch/SlowFast):PySlowFast: video understanding codebase from FAIR for reproducing state-of-the-art video models. * [Entromorgan / Autoticket](https://github.com/Entromorgan/Autoticket):大麦网自动抢票工具 * [matplotlib / matplotlib](https://github.com/matplotlib/matplotlib):matplotlib: plotting with Python * [0xAX / linux-insides](https://github.com/0xAX/linux-insides):A little bit about a linux kernel * [apache / incubator-tvm](https://github.com/apache/incubator-tvm):Open deep learning compiler stack for cpu, gpu and specialized accelerators * [docker / docker-py](https://github.com/docker/docker-py):A Python library for the Docker Engine API * [localstack / localstack](https://github.com/localstack/localstack):💻 A fully functional local AWS cloud stack. Develop and test your cloud & Serverless apps offline! #### swift * [iina / iina](https://github.com/iina/iina):The modern video player for macOS. * [daltoniam / Starscream](https://github.com/daltoniam/Starscream):Websockets in swift for iOS and OSX * [ashleymills / Reachability.swift](https://github.com/ashleymills/Reachability.swift):Replacement for Apple's Reachability re-written in Swift with closures * [ReactiveX / RxSwift](https://github.com/ReactiveX/RxSwift):Reactive Programming in Swift * [bizz84 / SwiftyStoreKit](https://github.com/bizz84/SwiftyStoreKit):Lightweight In App Purchases Swift framework for iOS 8.0+, tvOS 9.0+ and macOS 10.10+ ⛺ * [airbnb / lottie-ios](https://github.com/airbnb/lottie-ios):An iOS library to natively render After Effects vector animations * [RxSwiftCommunity / RxDataSources](https://github.com/RxSwiftCommunity/RxDataSources):UITableView and UICollectionView Data Sources for RxSwift (sections, animated updates, editing ...) * [danielgindi / Charts](https://github.com/danielgindi/Charts):Beautiful charts for iOS/tvOS/OSX! The Apple side of the crossplatform MPAndroidChart. * [kean / Nuke](https://github.com/kean/Nuke):Powerful image loading and caching system * [Juanpe / SkeletonView](https://github.com/Juanpe/SkeletonView):☠️ An elegant way to show users that something is happening and also prepare them to which contents he is waiting * [Alamofire / Alamofire](https://github.com/Alamofire/Alamofire):Elegant HTTP Networking in Swift * [Swinject / Swinject](https://github.com/Swinject/Swinject):Dependency injection framework for Swift with iOS/macOS/Linux * [mxcl / PromiseKit](https://github.com/mxcl/PromiseKit):Promises for Swift & ObjC. * [nicklockwood / SwiftFormat](https://github.com/nicklockwood/SwiftFormat):A code library and command-line formatting tool for reformatting Swift code * [airbnb / AloeStackView](https://github.com/airbnb/AloeStackView):A simple class for laying out a collection of views with a convenient API, while leveraging the power of Auto Layout. * [SwifterSwift / SwifterSwift](https://github.com/SwifterSwift/SwifterSwift):A handy collection of more than 500 native Swift extensions to boost your productivity. * [cbpowell / MarqueeLabel](https://github.com/cbpowell/MarqueeLabel):A drop-in replacement for UILabel, which automatically adds a scrolling marquee effect when the label's text does not fit inside the specified frame * [jonkykong / SideMenu](https://github.com/jonkykong/SideMenu):Simple side/slide menu control for iOS, no code necessary! Lots of customization. Add it to your project in 5 minutes or less. * [slackhq / PanModal](https://github.com/slackhq/PanModal):An elegant and highly customizable presentation API for constructing bottom sheet modals on iOS. * [SnapKit / SnapKit](https://github.com/SnapKit/SnapKit):A Swift Autolayout DSL for iOS & OS X * [stephencelis / SQLite.swift](https://github.com/stephencelis/SQLite.swift):A type-safe, Swift-language layer over SQLite3. * [Moya / Moya](https://github.com/Moya/Moya):Network abstraction layer written in Swift. * [ArtSabintsev / Siren](https://github.com/ArtSabintsev/Siren):Notify users when a new version of your app is available and prompt them to upgrade. * [marmelroy / PhoneNumberKit](https://github.com/marmelroy/PhoneNumberKit):A Swift framework for parsing, formatting and validating international phone numbers. Inspired by Google's libphonenumber. * [xmartlabs / Eureka](https://github.com/xmartlabs/Eureka):Elegant iOS form builder in Swift #### objective-c * [expo / expo](https://github.com/expo/expo):An open-source platform for making universal native apps with React. Expo runs on Android, iOS, and the web. * [wix / react-native-notifications](https://github.com/wix/react-native-notifications):React Native Notifications * [renzifeng / ZFPlayer](https://github.com/renzifeng/ZFPlayer):Support customization of any player SDK and control layer(支持定制任何播放器SDK和控制层) * [hackiftekhar / IQKeyboardManager](https://github.com/hackiftekhar/IQKeyboardManager):Codeless drop-in universal library allows to prevent issues of keyboard sliding up and cover UITextField/UITextView. Neither need to write any code nor any setup required and much more. * [apache / cordova-plugin-inappbrowser](https://github.com/apache/cordova-plugin-inappbrowser):Apache Cordova Plugin inappbrowser * [robbiehanson / CocoaAsyncSocket](https://github.com/robbiehanson/CocoaAsyncSocket):Asynchronous socket networking library for Mac and iOS * [firebase / firebase-ios-sdk](https://github.com/firebase/firebase-ios-sdk):Firebase iOS SDK * [Flipboard / FLAnimatedImage](https://github.com/Flipboard/FLAnimatedImage):Performant animated GIF engine for iOS * [SnapKit / Masonry](https://github.com/SnapKit/Masonry):Harness the power of AutoLayout NSLayoutConstraints with a simplified, chainable and expressive syntax. Supports iOS and OSX Auto Layout * [luggit / react-native-config](https://github.com/luggit/react-native-config):Bring some 12 factor love to your mobile apps! * [eczarny / spectacle](https://github.com/eczarny/spectacle):Spectacle allows you to organize your windows without using a mouse. * [joeferraro / react-native-cookies](https://github.com/joeferraro/react-native-cookies):Cookie manager for React Native * [uber / ios-snapshot-test-case](https://github.com/uber/ios-snapshot-test-case):Snapshot view unit tests for iOS * [TimOliver / TOCropViewController](https://github.com/TimOliver/TOCropViewController):A view controller for iOS that allows users to crop portions of UIImage objects * [Instagram / IGListKit](https://github.com/Instagram/IGListKit):A data-driven UICollectionView framework for building fast and flexible lists. * [aws-amplify / aws-sdk-ios](https://github.com/aws-amplify/aws-sdk-ios):AWS SDK for iOS. For more information, see our web site: * [viccalexander / Chameleon](https://github.com/viccalexander/Chameleon):Color framework for Swift & Objective-C (Gradient colors, hexcode support, colors from images & more). * [react-native-community / react-native-push-notification-ios](https://github.com/react-native-community/react-native-push-notification-ios):React Native Push Notification API for iOS. * [blinksh / blink](https://github.com/blinksh/blink):Blink Mobile Shell for iOS (Mosh based) * [SVProgressHUD / SVProgressHUD](https://github.com/SVProgressHUD/SVProgressHUD):A clean and lightweight progress HUD for your iOS and tvOS app. * [react-native-community / react-native-maps](https://github.com/react-native-community/react-native-maps):React Native Mapview component for iOS + Android * [facebook / facebook-ios-sdk](https://github.com/facebook/facebook-ios-sdk):Used to integrate the Facebook Platform with your iOS & tvOS apps. * [cloudwebrtc / flutter-webrtc](https://github.com/cloudwebrtc/flutter-webrtc):WebRTC plugin for Flutter Mobile/Desktop/Web * [swisspol / GCDWebServer](https://github.com/swisspol/GCDWebServer):The #1 HTTP server for iOS, macOS & tvOS (also includes web based uploader & WebDAV server) * [ivpusic / react-native-image-crop-picker](https://github.com/ivpusic/react-native-image-crop-picker):iOS/Android image picker with support for camera, video, configurable compression, multiple images and cropping #### javascript * [getredash / redash](https://github.com/getredash/redash):Make Your Company Data Driven. Connect to any data source, easily visualize, dashboard and share your data. * [uber / manifold](https://github.com/uber/manifold):A model-agnostic visual debugging tool for machine learning * [yangshun / tech-interview-handbook](https://github.com/yangshun/tech-interview-handbook):💯 Materials to help you rock your next coding interview * [porsager / postgres](https://github.com/porsager/postgres):Postgres.js - The Fastest full featured PostgreSQL client for Node.js * [ryanmcdermott / clean-code-javascript](https://github.com/ryanmcdermott/clean-code-javascript):🛁 Clean Code concepts adapted for JavaScript * [ly525 / luban-h5](https://github.com/ly525/luban-h5):[WIP]en: web design tool || mobile page builder/editor || mini webflow for mobile page. zh: 类似易企秀的H5制作、建站工具. * [strapi / strapi](https://github.com/strapi/strapi):🚀 Open source Node.js Headless CMS to easily build customisable APIs * [alpinejs / alpine](https://github.com/alpinejs/alpine):A rugged, minimal framework for composing JavaScript behavior in your markup. * [unbug / codelf](https://github.com/unbug/codelf):A search tool helps dev to solve the naming things problem. * [OwlCarousel2 / OwlCarousel2](https://github.com/OwlCarousel2/OwlCarousel2):DEPRECATED jQuery Responsive Carousel. * [trekhleb / javascript-algorithms](https://github.com/trekhleb/javascript-algorithms):📝 Algorithms and data structures implemented in JavaScript with explanations and links to further readings * [nolimits4web / swiper](https://github.com/nolimits4web/swiper):Most modern mobile touch slider with hardware accelerated transitions * [airbnb / lottie-web](https://github.com/airbnb/lottie-web):Render After Effects animations natively on Web, Android and iOS, and React Native. http://airbnb.io/lottie/ * [material-components / material-components-web](https://github.com/material-components/material-components-web):Modular and customizable Material Design UI components for the web * [facebook / docusaurus](https://github.com/facebook/docusaurus):Easy to maintain open source documentation websites. * [CanopyTax / single-spa](https://github.com/CanopyTax/single-spa):Microfrontends made easy * [zeit / next.js](https://github.com/zeit/next.js):The React Framework * [pikapkg / snowpack](https://github.com/pikapkg/snowpack):📦 ✨ Run npm packages directly in the browser. No Webpack, Parcel, or bundlers required. * [openlayers / openlayers](https://github.com/openlayers/openlayers):OpenLayers * [paulhodel / jexcel](https://github.com/paulhodel/jexcel):jExcel is a lightweight vanilla javascript plugin to create amazing web-based interactive tables and spreadsheets compatible with Excel or any other spreadsheet software. * [airbnb / javascript](https://github.com/airbnb/javascript):JavaScript Style Guide * [dherault / serverless-offline](https://github.com/dherault/serverless-offline):Emulate AWS λ and API Gateway locally when developing your Serverless project * [d3 / d3](https://github.com/d3/d3):Bring data to life with SVG, Canvas and HTML. 📊 📈 🎉 * [LisaDziuba / Awesome-Design-Tools](https://github.com/LisaDziuba/Awesome-Design-Tools):The best design tools and plugins for everything 👉 * [0wczar / airframe-react](https://github.com/0wczar/airframe-react):Free Open Source High Quality Dashboard based on Bootstrap 4 & React 16: http://dashboards.webkom.co/react/airframe #### go * [elastic / beats](https://github.com/elastic/beats):🐠 Beats - Lightweight shippers for Elasticsearch & Logstash * [stretchr / testify](https://github.com/stretchr/testify):A toolkit with common assertions and mocks that plays nicely with the standard library * [kubernetes / autoscaler](https://github.com/kubernetes/autoscaler):Autoscaling components for Kubernetes * [hashicorp / terraform](https://github.com/hashicorp/terraform):Terraform enables you to safely and predictably create, change, and improve infrastructure. It is an open source tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned. * [helm / charts](https://github.com/helm/charts):Curated applications for Kubernetes * [cortexproject / cortex](https://github.com/cortexproject/cortex):A horizontally scalable, highly available, multi-tenant, long term Prometheus. * [kubernetes-sigs / kind](https://github.com/kubernetes-sigs/kind):Kubernetes IN Docker - local clusters for testing Kubernetes * [dgraph-io / dgraph](https://github.com/dgraph-io/dgraph):Fast, Distributed Graph DB * [streadway / amqp](https://github.com/streadway/amqp):Go client for AMQP 0.9.1 * [kubernetes-sigs / kustomize](https://github.com/kubernetes-sigs/kustomize):Customization of kubernetes YAML configurations * [argoproj / argo](https://github.com/argoproj/argo):Argo Workflows: Get stuff done with Kubernetes. * [hyperledger / fabric](https://github.com/hyperledger/fabric):Hyperledger Fabric is an enterprise-grade permissioned distributed ledger framework for developing solutions and applications. Its modular and versatile design satisfies a broad range of industry use cases. It offers a unique approach to consensus that enables performance at scale while preserving privacy. * [tektoncd / pipeline](https://github.com/tektoncd/pipeline):A K8s-native Pipeline resource. * [prometheus / client_golang](https://github.com/prometheus/client_golang):Prometheus instrumentation library for Go applications * [grpc / grpc-go](https://github.com/grpc/grpc-go):The Go language implementation of gRPC. HTTP/2 based RPC * [cortexlabs / cortex](https://github.com/cortexlabs/cortex):Deploy machine learning models in production * [gorilla / mux](https://github.com/gorilla/mux):A powerful HTTP router and URL matcher for building Go web servers with 🦍 * [golang / go](https://github.com/golang/go):The Go programming language * [uber / cadence](https://github.com/uber/cadence):Cadence is a distributed, scalable, durable, and highly available orchestration engine to execute asynchronous long-running business logic in a scalable and resilient way. * [concourse / concourse](https://github.com/concourse/concourse):Concourse is a container-based continuous thing-doer written in Go and Elm. * [terraform-providers / terraform-provider-azurerm](https://github.com/terraform-providers/terraform-provider-azurerm):Terraform provider for Azure Resource Manager * [gruntwork-io / terragrunt](https://github.com/gruntwork-io/terragrunt):Terragrunt is a thin wrapper for Terraform that provides extra tools for working with multiple Terraform modules. * [prometheus / alertmanager](https://github.com/prometheus/alertmanager):Prometheus Alertmanager * [nginxinc / kubernetes-ingress](https://github.com/nginxinc/kubernetes-ingress):NGINX and NGINX Plus Ingress Controllers for Kubernetes * [golang / mock](https://github.com/golang/mock):GoMock is a mocking framework for the Go programming language. #### java * [micrometer-metrics / micrometer](https://github.com/micrometer-metrics/micrometer):An application metrics facade for the most popular monitoring tools. Think SLF4J, but for metrics. * [prestosql / presto](https://github.com/prestosql/presto):Official home of the community managed version of Presto, the distributed SQL query engine for big data, under the auspices of the Presto Software Foundation. * [CarGuo / GSYVideoPlayer](https://github.com/CarGuo/GSYVideoPlayer):视频播放器(IJKplayer、ExoPlayer、MediaPlayer),HTTPS,支持弹幕,外挂字幕,支持滤镜、水印、gif截图,片头广告、中间广告,多个同时播放,支持基本的拖动,声音、亮度调节,支持边播边缓存,支持视频自带rotation的旋转(90,270之类),重力旋转与手动旋转的同步支持,支持列表播放 ,列表全屏动画,视频加载速度,列表小窗口支持拖动,动画效果,调整比例,多分辨率切换,支持切换播放器,进度条小窗口预览,列表切换详情页面无缝播放,rtsp、concat、mpeg。 * [SeleniumHQ / selenium](https://github.com/SeleniumHQ/selenium):A browser automation framework and ecosystem. * [eugenp / tutorials](https://github.com/eugenp/tutorials):Just Announced - "Learn Spring Security OAuth": * [square / javapoet](https://github.com/square/javapoet):A Java API for generating .java source files. * [SonarSource / sonarqube](https://github.com/SonarSource/sonarqube):Continuous Inspection * [bethrobson / Head-First-Design-Patterns](https://github.com/bethrobson/Head-First-Design-Patterns):Code for Head First Design Patterns book (2014) * [intuit / karate](https://github.com/intuit/karate):Test Automation Made Simple * [reactor / reactor-core](https://github.com/reactor/reactor-core):Non-Blocking Reactive Foundation for the JVM * [prestodb / presto](https://github.com/prestodb/presto):The official home of the Presto distributed SQL query engine for big data * [react-native-community / react-native-video](https://github.com/react-native-community/react-native-video):A <Video /> component for react-native * [aws / aws-sdk-java](https://github.com/aws/aws-sdk-java):The official AWS SDK for Java. * [DrKLO / Telegram](https://github.com/DrKLO/Telegram):Telegram for Android source * [jacoco / jacoco](https://github.com/jacoco/jacoco):🔬 JaCoCo - Java Code Coverage Library * [zuihou / zuihou-admin-cloud](https://github.com/zuihou/zuihou-admin-cloud):基于SpringCloud(Hoxton.SR1) + SpringBoot(2.2.2.RELEASE) 的SaaS 微服务脚手架,具有统一授权、认证后台管理系统,其中包含具备用户管理、资源权限管理、网关API、分布式事务、大文件断点分片续传等多个模块,支持多业务系统并行开发,可以作为后端服务的开发脚手架。代码简洁,架构清晰,适合学习和直接项目中使用。核心技术采用Nacos、Fegin、Ribbon、Zuul、Hystrix、JWT Token、Mybatis、SpringBoot、Redis、RibbitMQ等主要框架和中间件。 * [apache / dubbo](https://github.com/apache/dubbo):Apache Dubbo is a high-performance, java based, open source RPC framework. * [robolectric / robolectric](https://github.com/robolectric/robolectric):Android Unit Testing Framework * [Activiti / Activiti](https://github.com/Activiti/Activiti):Activiti is a light-weight workflow and Business Process Management (BPM) Platform targeted at business people, developers and system admins. Its core is a super-fast and rock-solid BPMN 2 process engine for Java. It's open-source and distributed under the Apache license. Activiti runs in any Java application, on a server, on a cluster or in the… * [antlr / antlr4](https://github.com/antlr/antlr4):ANTLR (ANother Tool for Language Recognition) is a powerful parser generator for reading, processing, executing, or translating structured text or binary files. * [apollographql / apollo-android](https://github.com/apollographql/apollo-android):📟 A strongly-typed, caching GraphQL client for Android and the JVM * [Netflix / Hystrix](https://github.com/Netflix/Hystrix):Hystrix is a latency and fault tolerance library designed to isolate points of access to remote systems, services and 3rd party libraries, stop cascading failure and enable resilience in complex distributed systems where failure is inevitable. * [H07000223 / FlycoTabLayout](https://github.com/H07000223/FlycoTabLayout):An Android TabLayout Lib * [zo0r / react-native-push-notification](https://github.com/zo0r/react-native-push-notification):React Native Local and Remote Notifications #### html * [ripienaar / free-for-dev](https://github.com/ripienaar/free-for-dev):A list of SaaS, PaaS and IaaS offerings that have free tiers of interest to devops and infradev * [battlecode / battlecode20](https://github.com/battlecode/battlecode20):Battlecode 2020 🍜 * [GoogleCloudPlatform / professional-services](https://github.com/GoogleCloudPlatform/professional-services):Common solutions and tools developed by Google Cloud's Professional Services team * [sindresorhus / github-markdown-css](https://github.com/sindresorhus/github-markdown-css):The minimal amount of CSS to replicate the GitHub Markdown style * [MoeClub / OneList](https://github.com/MoeClub/OneList):Simple index for onedrive * [kubernetes / website](https://github.com/kubernetes/website):Kubernetes website and documentation repo: * [ng-alain / ng-alain](https://github.com/ng-alain/ng-alain):NG-ZORRO admin panel front-end framework (netlify mirror https://netlify.ng-alain.com/ ) * [kangax / compat-table](https://github.com/kangax/compat-table):ECMAScript 5/6/7 compatibility tables * [DefectDojo / django-DefectDojo](https://github.com/DefectDojo/django-DefectDojo):DefectDojo is an open-source application vulnerability correlation and security orchestration tool. * [olivierlacan / keep-a-changelog](https://github.com/olivierlacan/keep-a-changelog):If you build software, keep a changelog. * [coreui / coreui-free-bootstrap-admin-template](https://github.com/coreui/coreui-free-bootstrap-admin-template):CoreUI is free bootstrap admin template * [kristoferjoseph / flexboxgrid](https://github.com/kristoferjoseph/flexboxgrid):Grid based on CSS3 flexbox * [BlackrockDigital / startbootstrap-sb-admin-2](https://github.com/BlackrockDigital/startbootstrap-sb-admin-2):A free, open source, Bootstrap admin theme created by Start Bootstrap * [swagger-api / swagger-codegen](https://github.com/swagger-api/swagger-codegen):swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition. * [nshalabi / ATTACK-Tools](https://github.com/nshalabi/ATTACK-Tools):Utilities for MITRE™ ATT&CK * [ganlanyuan / tiny-slider](https://github.com/ganlanyuan/tiny-slider):Vanilla javascript slider for all purposes. * [luizdepra / hugo-coder](https://github.com/luizdepra/hugo-coder):A minimalist blog theme for hugo. * [me115 / linuxtools_rst](https://github.com/me115/linuxtools_rst):Linux工具快速教程 * [froala / wysiwyg-editor](https://github.com/froala/wysiwyg-editor):The next generation Javascript WYSIWYG HTML Editor. * [shishan100 / Java-Interview-Advanced](https://github.com/shishan100/Java-Interview-Advanced):中华石杉--互联网Java进阶面试训练营 * [cypress-io / cypress-example-kitchensink](https://github.com/cypress-io/cypress-example-kitchensink):This is an example app used to showcase Cypress.io testing. * [apachecn / fe4ml-zh](https://github.com/apachecn/fe4ml-zh):📖 [译] 面向机器学习的特征工程 * [w3c / csswg-drafts](https://github.com/w3c/csswg-drafts):CSS Working Group Editor Drafts * [foundation / foundation-sites](https://github.com/foundation/foundation-sites):The most advanced responsive front-end framework in the world. Quickly create prototypes and production code for sites that work on any kind of device. * [octocat / Spoon-Knife](https://github.com/octocat/Spoon-Knife):This repo is for demonstration purposes only. #### kotlin * [yairm210 / Unciv](https://github.com/yairm210/Unciv):Open-source Android/Desktop remake of Civ V * [android / plaid](https://github.com/android/plaid):An Android app which provides design news & inspiration as well as being an example of implementing material design. * [android / architecture-samples](https://github.com/android/architecture-samples):A collection of samples to discuss and showcase different architectural tools and patterns for Android apps. * [Tencent / bk-ci](https://github.com/Tencent/bk-ci):蓝鲸CI平台(BlueKing CI) * [InsertKoinIO / koin](https://github.com/InsertKoinIO/koin):Koin - a pragmatic lightweight dependency injection framework for Kotlin * [igorwojda / android-showcase](https://github.com/igorwojda/android-showcase):💎 Android application following best practices: Kotlin, coroutines, Clean Architecture, feature modules, tests, MVVM, static analysis... * [JetBrains / Exposed](https://github.com/JetBrains/Exposed):Kotlin SQL Framework * [corda / corda](https://github.com/corda/corda):Corda is an open source blockchain project, designed for business from the start. Only Corda allows you to build interoperable blockchain networks that transact in strict privacy. Corda's smart contract technology allows businesses to transact directly, with value. * [dropbox / Store](https://github.com/dropbox/Store):Kotlin Library for Async Data Loading and Caching * [JetBrains / kotlinconf-app](https://github.com/JetBrains/kotlinconf-app):KotlinConf Schedule Application * [pinterest / ktlint](https://github.com/pinterest/ktlint):An anti-bikeshedding Kotlin linter with built-in formatter * [JetBrains / kotlin](https://github.com/JetBrains/kotlin):The Kotlin Programming Language * [ktorio / ktor](https://github.com/ktorio/ktor):Framework for quickly creating connected applications in Kotlin with minimal effort * [square / leakcanary](https://github.com/square/leakcanary):LeakCanary is a memory leak detection library for Android. * [sanogueralorenzo / Android-Kotlin-Clean-Architecture](https://github.com/sanogueralorenzo/Android-Kotlin-Clean-Architecture):Android Sample Clean Architecture App written in Kotlin * [izhangzhihao / intellij-rainbow-brackets](https://github.com/izhangzhihao/intellij-rainbow-brackets):🌈 Rainbow Brackets / Rainbow Parentheses for IntelliJ based IDEs * [edvin / tornadofx](https://github.com/edvin/tornadofx):Lightweight JavaFX Framework for Kotlin * [Kotlin / kotlinx.coroutines](https://github.com/Kotlin/kotlinx.coroutines):Library support for Kotlin coroutines * [material-components / material-components-android-examples](https://github.com/material-components/material-components-android-examples):Companion example apps and code for MDC-Android. * [mockk / mockk](https://github.com/mockk/mockk):mocking library for Kotlin * [google / flexbox-layout](https://github.com/google/flexbox-layout):Flexbox for Android * [Kotlin / dokka](https://github.com/Kotlin/dokka):Documentation Engine for Kotlin * [Triple-T / gradle-play-publisher](https://github.com/Triple-T/gradle-play-publisher):GPP is Android's unofficial release automation Gradle Plugin. It can do anything from building, uploading, and then promoting your App Bundle or APK to publishing app listings and other metadata. * [android / databinding-samples](https://github.com/android/databinding-samples): * [google-developer-training / android-kotlin-fundamentals-apps](https://github.com/google-developer-training/android-kotlin-fundamentals-apps):android-kotlin-fundamentals-apps #### shell * [dylanaraps / pure-bash-bible](https://github.com/dylanaraps/pure-bash-bible):📖 A collection of pure bash alternatives to external processes. * [lyft / flyte](https://github.com/lyft/flyte):develop, execute, and monitor distributed workflows reliably at scale. * [tfutils / tfenv](https://github.com/tfutils/tfenv):Terraform version manager * [dotnet / core](https://github.com/dotnet/core):Home repository for .NET Core * [nvm-sh / nvm](https://github.com/nvm-sh/nvm):Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions * [vulhub / vulhub](https://github.com/vulhub/vulhub):Pre-Built Vulnerable Environments Based on Docker-Compose * [elastic / stack-docker](https://github.com/elastic/stack-docker):The Elastic Stack, on Docker, right now. * [linrunner / TLP](https://github.com/linrunner/TLP):Advanced Power Management for Linux * [StackExchange / blackbox](https://github.com/StackExchange/blackbox):Safely store secrets in Git/Mercurial/Subversion * [mathiasbynens / dotfiles](https://github.com/mathiasbynens/dotfiles):🔧 .files, including ~/.macos — sensible hacker defaults for macOS * [dylanaraps / neofetch](https://github.com/dylanaraps/neofetch):🖼️ A command-line system information tool written in bash 3.2+ * [kaldi-asr / kaldi](https://github.com/kaldi-asr/kaldi):This is the official location of the Kaldi project. * [drwetter / testssl.sh](https://github.com/drwetter/testssl.sh):Testing TLS/SSL encryption anywhere on any port * [getsentry / onpremise](https://github.com/getsentry/onpremise):Sentry On-Premise setup * [1N3 / Sn1per](https://github.com/1N3/Sn1per):Automated pentest framework for offensive security experts * [graphql / graphql-spec](https://github.com/graphql/graphql-spec):GraphQL is a query language and execution engine tied to any backend service. * [puckel / docker-airflow](https://github.com/puckel/docker-airflow):Docker Apache Airflow * [hyperledger / fabric-samples](https://github.com/hyperledger/fabric-samples): * [ubuntu / microk8s](https://github.com/ubuntu/microk8s):MicroK8s is a small, fast, single-package Kubernetes for developers, IoT and edge. * [bioconda / bioconda-recipes](https://github.com/bioconda/bioconda-recipes):Conda recipes for the bioconda channel. * [PaperMC / Paper](https://github.com/PaperMC/Paper):High performance Spigot fork that aims to fix gameplay and mechanics inconsistencies * [P3TERX / aria2.conf](https://github.com/P3TERX/aria2.conf):Aria2 配置文件 | Onedrive、Google Drvive 离线下载解决方案 | 百度网盘不限速转存解决方案 * [robcowart / elastiflow](https://github.com/robcowart/elastiflow):Network flow Monitoring (Netflow, sFlow and IPFIX) with the Elastic Stack * [OpenVPN / easy-rsa](https://github.com/OpenVPN/easy-rsa):easy-rsa - Simple shell based CA utility * [ansible / ansible-examples](https://github.com/ansible/ansible-examples):A few starter examples of ansible playbooks, to show features and how they work together. See http://galaxy.ansible.com for example roles from the Ansible community for deploying many popular applications. #### scala * [apache / openwhisk](https://github.com/apache/openwhisk):Apache OpenWhisk is an open source serverless cloud platform * [zio / zio](https://github.com/zio/zio):ZIO — A type-safe, composable library for asynchronous and concurrent programming in Scala * [lampepfl / dotty](https://github.com/lampepfl/dotty):Research compiler that will become Scala 3 * [twitter / finagle](https://github.com/twitter/finagle):A fault tolerant, protocol-agnostic RPC system * [snowplow / snowplow](https://github.com/snowplow/snowplow):Cloud-native web, mobile and event analytics, running on AWS and GCP * [spotify / scio](https://github.com/spotify/scio):A Scala API for Apache Beam and Google Cloud Dataflow. * [yahoo / kafka-manager](https://github.com/yahoo/kafka-manager):A tool for managing Apache Kafka. * [lagom / lagom](https://github.com/lagom/lagom):Reactive Microservices for the JVM * [gatling / gatling](https://github.com/gatling/gatling):Async Scala-Akka-Netty based Load Test Tool * [apache / spark](https://github.com/apache/spark):Apache Spark * [broadinstitute / cromwell](https://github.com/broadinstitute/cromwell):Scientific workflow engine designed for simplicity & scalability. Trivially transition between one off use cases to massive scale production environments * [chipsalliance / rocket-chip](https://github.com/chipsalliance/rocket-chip):Rocket Chip Generator * [gitbucket / gitbucket](https://github.com/gitbucket/gitbucket):A Git platform powered by Scala with easy installation, high extensibility & GitHub API compatibility * [Azure / mmlspark](https://github.com/Azure/mmlspark):Microsoft Machine Learning for Apache Spark * [bkro961 / AshBryanShadiPeter](https://github.com/bkro961/AshBryanShadiPeter): * [sungiant / sdf](https://github.com/sungiant/sdf):Sphere tracing signed distance functions. * [sksamuel / elastic4s](https://github.com/sksamuel/elastic4s):Elasticsearch Scala Client - Reactive, Non Blocking, Type Safe, HTTP Client * [sbt / sbt](https://github.com/sbt/sbt):sbt, the interactive build tool * [freechipsproject / chisel3](https://github.com/freechipsproject/chisel3):Chisel 3: A Modern Hardware Design Language * [typelevel / cats](https://github.com/typelevel/cats):Lightweight, modular, and extensible library for functional programming. #### rust * [starship / starship](https://github.com/starship/starship):☄ 🌌️ The cross-shell prompt for astronauts * [dtolnay / cxx](https://github.com/dtolnay/cxx):Safe interop between Rust and C++ * [Rigellute / spotify-tui](https://github.com/Rigellute/spotify-tui):Spotify for the terminal written in Rust 🚀 * [Spotifyd / spotifyd](https://github.com/Spotifyd/spotifyd):A spotify daemon * [nushell / nushell](https://github.com/nushell/nushell):A modern shell written in Rust * [bytecodealliance / cranelift](https://github.com/bytecodealliance/cranelift):Cranelift code generator * [rust-lang / rust](https://github.com/rust-lang/rust):Empowering everyone to build reliable and efficient software. * [BurntSushi / ripgrep](https://github.com/BurntSushi/ripgrep):ripgrep recursively searches directories for a regex pattern * [elastic / elasticsearch-rs](https://github.com/elastic/elasticsearch-rs):Elasticsearch Rust Client * [paritytech / substrate](https://github.com/paritytech/substrate):Substrate: The platform for blockchain innovators * [firecracker-microvm / firecracker](https://github.com/firecracker-microvm/firecracker):Secure and fast microVMs for serverless computing. * [timberio / vector](https://github.com/timberio/vector):A utility for building high performance observability pipelines. * [sharkdp / fd](https://github.com/sharkdp/fd):A simple, fast and user-friendly alternative to 'find' * [input-output-hk / jormungandr](https://github.com/input-output-hk/jormungandr):aspiring blockchain node * [rayon-rs / rayon](https://github.com/rayon-rs/rayon):Rayon: A data parallelism library for Rust * [tokio-rs / tokio](https://github.com/tokio-rs/tokio):A runtime for writing reliable asynchronous applications with Rust. Provides I/O, networking, scheduling, timers, ... * [rusoto / rusoto](https://github.com/rusoto/rusoto):AWS SDK for Rust * [Michael-F-Bryan / arcs](https://github.com/Michael-F-Bryan/arcs):A Rust CAD System * [Geal / nom](https://github.com/Geal/nom):Rust parser combinator framework * [ogham / exa](https://github.com/ogham/exa):A modern version of ‘ls’. * [dtolnay / proc-macro-workshop](https://github.com/dtolnay/proc-macro-workshop):Learn to write Rust procedural macros  [Rust Latam conference, Montevideo Uruguay, March 2019] * [libp2p / rust-libp2p](https://github.com/libp2p/rust-libp2p):The Rust Implementation of libp2p networking stack. * [benfred / py-spy](https://github.com/benfred/py-spy):Sampling profiler for Python programs * [rust-lang / book](https://github.com/rust-lang/book):The Rust Programming Language * [tokio-rs / tracing](https://github.com/tokio-rs/tracing):Application level tracing for Rust.
tzpBingo/github-trending
2020/2020-01-11.md
Markdown
mit
41,446
--- layout: docs authors: - blairanderson date: 2014-08-12 22:22:22 title: jQuery.Callbacks() in Javascript - without jQuery description: A multi-purpose callbacks list object that provides a powerful way to manage callback lists. method: jQuery.Callbacks href: "docs/jQuery.Callbacks.html" status: "inactive" --- #### Sorry, we do not have code examples for implementing [jQuery.Callbacks](http://api.jquery.com/jQuery.Callbacks/) in vanilla javascript. It would be great if you submitted code on [github](https://github.com/blairanderson/without-jquery/blob/master/docs/jQuery.Callbacks.md) ### Example: ```javascript //jQuery var i = jQuery.Callbacks(taco); //Javascript var i = document[somethingOtherThanjQuery.Callbacks](taco); ``` **REASONS:** > Faster, and creates an event upon xyz *example is computer generated, obviously not real.*
blairanderson/without-jquery
docs/jQuery.Callbacks.md
Markdown
mit
862
# - Find Box2D # Find the native Box2D includes and libraries # # BOX2D_INCLUDE_DIR - where to find TmxParser/Config.hpp, etc. # BOX2D_LIBRARIES - List of libraries when using libTmxParser. # BOX2D_FOUND - True if libTmxParser found. find_path(BOX2D_INCLUDE_DIR Box2D/Box2D.h PATH_SUFFIXES include PATHS ~/Library/Frameworks /Library/Frameworks /usr/local /usr /sw # Fink /opt/local # DarwinPorts /opt/csw # Blastwave /opt ${CRAP_LIBRARIES_PATH}/Box2D/Box2D ${CRAP_LIBRARIES_PATH}/Box2D ${BOX2DDIR} $ENV{BOX2DDIR}) find_library(BOX2D_LIBRARY_DEBUG Box2D-d PATH_SUFFIXES lib64 lib PATHS ~/Library/Frameworks /Library/Frameworks /usr/local /usr /sw # Fink /opt/local # DarwinPorts /opt/csw # Blastwave /opt ${CMAKE_BIN_DIR}/Box2D/Build ${CMAKE_BIN_DIR}/Box2D/Build/Debug ${BOX2DDIR} $ENV{BOX2DDIR}) find_library(BOX2D_LIBRARY_RELEASE Box2D PATH_SUFFIXES lib64 lib PATHS ~/Library/Frameworks /Library/Frameworks /usr/local /usr /sw # Fink /opt/local # DarwinPorts /opt/csw # Blastwave /opt ${CMAKE_BIN_DIR}/Box2D/Build ${CMAKE_BIN_DIR}/Box2D/Build/Release ${BOX2DDIR} $ENV{BOX2DDIR}) if(BOX2D_LIBRARY_DEBUG OR BOX2D_LIBRARY_RELEASE) # Library found set(BOX2D_FOUND TRUE) # If both were found, set BOX2D_LIBRARY to the release version if(BOX2D_LIBRARY_DEBUG AND BOX2D_LIBRARY_RELEASE) set(BOX2D_LIBRARY ${BOX2D_LIBRARY_RELEASE}) endif() if(BOX2D_LIBRARY_DEBUG AND NOT BOX2D_LIBRARY_RELEASE) set(BOX2D_LIBRARY ${BOX2D_LIBRARY_DEBUG}) endif() if(NOT BOX2D_LIBRARY_DEBUG AND BOX2D_LIBRARY_RELEASE) set(BOX2D_LIBRARY ${BOX2D_LIBRARY_RELEASE}) endif() else() set(BOX2D_FOUND FALSE) endif() # Handle the QUIETLY and REQUIRED arguments and set SNDFILE_FOUND to TRUE if # all listed variables are TRUE. include(FindPackageHandleStandardArgs) find_package_handle_standard_args(BOX2D DEFAULT_MSG BOX2D_LIBRARY BOX2D_INCLUDE_DIR) if(BOX2D_FOUND) set(BOX2D_LIBRARIES ${BOX2D_LIBRARY}) else(BOX2D_FOUND) set(BOX2D_LIBRARIES) endif(BOX2D_FOUND)
stevenblaster/crapengine
CMake/FindBox2D.cmake
CMake
mit
1,938
// To check if a library is compiled with CocoaPods you // can use the `COCOAPODS` macro definition which is // defined in the xcconfigs so it is available in // headers also when they are imported in the client // project. // AFNetworking #define COCOAPODS_POD_AVAILABLE_AFNetworking #define COCOAPODS_VERSION_MAJOR_AFNetworking 2 #define COCOAPODS_VERSION_MINOR_AFNetworking 4 #define COCOAPODS_VERSION_PATCH_AFNetworking 1 // AFNetworking/NSURLConnection #define COCOAPODS_POD_AVAILABLE_AFNetworking_NSURLConnection #define COCOAPODS_VERSION_MAJOR_AFNetworking_NSURLConnection 2 #define COCOAPODS_VERSION_MINOR_AFNetworking_NSURLConnection 4 #define COCOAPODS_VERSION_PATCH_AFNetworking_NSURLConnection 1 // AFNetworking/NSURLSession #define COCOAPODS_POD_AVAILABLE_AFNetworking_NSURLSession #define COCOAPODS_VERSION_MAJOR_AFNetworking_NSURLSession 2 #define COCOAPODS_VERSION_MINOR_AFNetworking_NSURLSession 4 #define COCOAPODS_VERSION_PATCH_AFNetworking_NSURLSession 1 // AFNetworking/Reachability #define COCOAPODS_POD_AVAILABLE_AFNetworking_Reachability #define COCOAPODS_VERSION_MAJOR_AFNetworking_Reachability 2 #define COCOAPODS_VERSION_MINOR_AFNetworking_Reachability 4 #define COCOAPODS_VERSION_PATCH_AFNetworking_Reachability 1 // AFNetworking/Security #define COCOAPODS_POD_AVAILABLE_AFNetworking_Security #define COCOAPODS_VERSION_MAJOR_AFNetworking_Security 2 #define COCOAPODS_VERSION_MINOR_AFNetworking_Security 4 #define COCOAPODS_VERSION_PATCH_AFNetworking_Security 1 // AFNetworking/Serialization #define COCOAPODS_POD_AVAILABLE_AFNetworking_Serialization #define COCOAPODS_VERSION_MAJOR_AFNetworking_Serialization 2 #define COCOAPODS_VERSION_MINOR_AFNetworking_Serialization 4 #define COCOAPODS_VERSION_PATCH_AFNetworking_Serialization 1 // AFNetworking/UIKit #define COCOAPODS_POD_AVAILABLE_AFNetworking_UIKit #define COCOAPODS_VERSION_MAJOR_AFNetworking_UIKit 2 #define COCOAPODS_VERSION_MINOR_AFNetworking_UIKit 4 #define COCOAPODS_VERSION_PATCH_AFNetworking_UIKit 1 // JGProgressHUD #define COCOAPODS_POD_AVAILABLE_JGProgressHUD #define COCOAPODS_VERSION_MAJOR_JGProgressHUD 1 #define COCOAPODS_VERSION_MINOR_JGProgressHUD 2 #define COCOAPODS_VERSION_PATCH_JGProgressHUD 2 // Mantle #define COCOAPODS_POD_AVAILABLE_Mantle #define COCOAPODS_VERSION_MAJOR_Mantle 1 #define COCOAPODS_VERSION_MINOR_Mantle 5 #define COCOAPODS_VERSION_PATCH_Mantle 0 // Mantle/extobjc #define COCOAPODS_POD_AVAILABLE_Mantle_extobjc #define COCOAPODS_VERSION_MAJOR_Mantle_extobjc 1 #define COCOAPODS_VERSION_MINOR_Mantle_extobjc 5 #define COCOAPODS_VERSION_PATCH_Mantle_extobjc 0 // RedditKit #define COCOAPODS_POD_AVAILABLE_RedditKit #define COCOAPODS_VERSION_MAJOR_RedditKit 1 #define COCOAPODS_VERSION_MINOR_RedditKit 3 #define COCOAPODS_VERSION_PATCH_RedditKit 0
r29arora/RedditApp
RedditApplication/Pods/Pods-environment.h
C
mit
2,785
export default Ember.ObjectController.extend({ actions: { cancel: function() { this.transitionToRoute('books'); } } });
twar59/ember-jquery-datatables
app/controllers/books/show.js
JavaScript
mit
138
from __future__ import print_function, division, absolute_import from george import kernels, GP import numpy as np from kglib import fitters from scipy.integrate import quad from scipy.optimize import minimize class HistFitter(fitters.Bayesian_LS): def __init__(self, mcmc_samples, bin_edges): """ Histogram Inference a la Dan Foreman-Mackey Parameters: =========== - mcmc_samples: numpy array of shape (Nobs, Nsamples) MCMC samples for the thing you want to histogram - bin_edges: numpy.ndarray array The edges of the histogram bins to use. """ self.mcmc_samples = mcmc_samples self.bin_edges = bin_edges self.bin_centers = (self.bin_edges[:-1] + self.bin_edges[1:]) / 2 self.bin_widths = np.diff(self.bin_edges) self.Nbins = self.bin_widths.size self.Nobs = self.mcmc_samples.shape[0] # Find which bin each q falls in self.bin_idx = np.digitize(self.mcmc_samples, self.bin_edges) - 1 # Determine the censoring function for each bin (used in the integral) self.censor_integrals = np.array([quad(func=self.censoring_fcn, a=left, b=right)[0] for (left, right) in zip(self.bin_edges[:-1], self.bin_edges[1:])]) # Set values needed for multinest fitting self.n_params = self.Nbins self.param_names = [r'$\theta_{}$'.format(i) for i in range(self.Nbins)] def lnlike(self, pars): # Pull theta out of pars theta = pars[:self.Nbins] # Generate the inner summation gamma = np.ones_like(self.bin_idx) * np.nan good = (self.bin_idx < self.Nbins) & (self.bin_idx >= 0) # nans in q get put in nonexistent bins gamma[good] = self.Nobs * self.censoring_fcn(self.mcmc_samples[good]) * theta[self.bin_idx[good]] summation = np.nanmean(gamma, axis=1) # Calculate the integral I = self._integral_fcn(theta) # Generate the log-likelihood ll = -I + np.nansum(np.log(summation)) return ll def lnprior(self, pars): """ Override this if you want to set a better prior on the bin heights. """ if all([p > 0 and p < 10 for p in pars]): return 0 return -np.inf def lnprob(self, pars): lp = self.lnprior(pars) return lp + self.lnlike(pars) if np.isfinite(lp) else -np.inf def _integral_fcn(self, theta): return np.sum(theta * self.censor_integrals) * self.Nobs def censoring_fcn(self, value): """ Censoring function. This should return the completeness of your survey to the given value. """ return 1.0 def guess_fit(self): def errfcn(pars): ll = self.lnprob(pars) return -ll initial_guess = np.ones_like(self.bin_centers) bounds = [[1e-3, None] for p in initial_guess] out = minimize(errfcn, initial_guess, bounds=bounds) return out.x def mnest_prior(self, cube, ndim, nparams): # All bins are in the range (0, 10) for i in range(self.Nbins): cube[i] *= 10 return class CensoredHistFitter(HistFitter): """ Inherits from HistFitter, but actually defines the censoring function """ def censoring_fcn(self, val, alpha=40, beta=0.25): # sigmoid censoring function. Change this for the real deal! return 1.0 / (1.0 + np.exp(-alpha * (val - beta))) class SmoothHistFitter(CensoredHistFitter): """ A subclass of HistogramFitter that puts a gaussian process smoothing prior on the bin heights """ def __init__(self, *args, **kwargs): super(SmoothHistFitter, self).__init__(*args, **kwargs) self.smoothing = self.mcmc_samples.shape[0] / self.Nbins self.n_params = self.Nbins + 4 self.param_names = [r'$\theta_{}$'.format(i) for i in range(self.Nbins)] self.param_names.extend(('lna', 'lntau', 'lnerr', 'mean')) def lnprior(self, pars): """ Smoothing prior using gaussian process. We will learn the hyperparameters and marginalize over them. """ theta = pars[:self.Nbins] if np.any(theta < 0): return -np.inf a, tau, err = np.exp(pars[self.Nbins:-1]) mean = pars[-1] kernel = a * kernels.ExpSquaredKernel(tau) gp = GP(kernel, mean=mean) gp.compute(self.bin_centers, yerr=err) return gp.lnlikelihood(theta) / self.smoothing def guess_fit(self): """ This doesn't work too great, but the full MCMC fit looks good. """ def errfcn(pars): ll = self.lnprob(pars) return -ll # Set up initial guesses initial_guess = np.ones(self.bin_centers.size + 4) initial_guess[-4] = 0.0 initial_guess[-3] = -0.25 initial_guess[-2] = -1.0 initial_guess[-1] = -1.0 # Set up bounds bounds = [[1e-3, None] for p in self.bin_centers] bounds.append([-10, 20]) bounds.append([-10, 10]) bounds.append((-1, 5)) bounds.append((-10, 10)) # Minimize out = minimize(errfcn, initial_guess, bounds=bounds) return out.x def _lnlike(self, pars): return self.lnprob(pars) def mnest_prior(self, cube, ndim, nparams): for i in range(self.Nbins): cube[i] *= 10 cube[self.Nbins] = cube[self.Nbins] * 30 - 10 cube[self.Nbins + 1] = cube[self.Nbins + 1] * 20 - 10 cube[self.Nbins + 2] = cube[self.Nbins + 2] * 7 - 2 cube[self.Nbins + 3] = cube[self.Nbins + 3] * 20 - 10 return
kgullikson88/gullikson-scripts
kglib/fitters/histogram.py
Python
mit
5,838
-- Elevent 1.0 -- Licensed under The MIT License (MIT) -- Copyright (c) 2013 Qais "qaisjp" Patankar local eventList, renderList = { }, { } local Event = { } Event.AddEvent = function(event) if (type(event) ~= "string") or (event == "") then error("Invalid `event` parameter supplied", 2) end if not eventList[event:lower()] then eventList[event:lower()] = { } renderList[event:lower()] = { } end local fn fn = function(...) for i, v in ipairs(renderList[event]) do if eventList[event][v] and eventList[event][v].callback then eventList[event][v].callback(event, ...) end end end return fn end Event.AddHandler = function(event, callback, ref, priority) if (type(event) ~= "string") or (event == "") then error("Invalid `event` parameter supplied", 2) end if (type(callback)) ~= "function" then error("Invalid `callback` parameter supplied", 2) end event = event:lower() priority = tonumber(priority) or 100 ref = ref or callback if not eventList[event] then Event.AddEvent(event) end if eventList[event][ref] then error("Reference already exists for this event!", 2) end eventList[event][ref] = { callback = callback, priority = priority } table.insert(renderList[event], ref) return table.sort(renderList[event], function(a, b) if not a then return false elseif not b then return true end local ea, eb = eventList[event][a], eventList[event][b] if (not ea) or (not eb) then return true end return ea.priority < eb.priority end) end Event.RemoveHandler = function(event, ref) if not ref then error("Invalid parameter supplied for `ref`", 2) end if (type(event) ~= "string") or (event == "") then error("Invalid `event` parameter supplied", 2) end event = event:lower() if not eventList[event] then error("Event supplied doesn't exist", 2) end if not eventList[event][ref] then return false end eventList[event][ref] = nil for i, v in ipairs(renderList[event]) do if v == ref then table.remove(renderList, i) break end end end Event.RemoveAllHandlers = function(ref) if not ref then error("Invalid parameter supplied for `ref`", 2) end for event, events in pairs(eventList) do for eventref in pairs(events) do if eventref == ref then Event.RemoveHandler(event, eventref) end end end end for i, v in ipairs({ "draw", "errhand", "focus", "joystickpressed", "joystickreleased", "keypressed", "keyreleased", "load", "mousepressed", "mousereleased", "quit", "run", "update" }) do love[v] = Event.AddEvent(v) end return Event
qaisjp/elevent
elevent.lua
Lua
mit
2,706
module URLComponents URL_CHARS = ('0'..'9').to_a + %w(b c d f g h j k l m n p q r s t v w x y z) + %w(B C D F G H J K L M N P Q R S T V W X Y Z - _) URL_BASE = URL_CHARS.size def generate_slug(text, delimiter = '-') slug = text.downcase.gsub(/[^0-9a-z_ -]/i, '') slug = slug.gsub(/\s+/, delimiter) slug end def generate_tiny_url(id_number = self.id) local_count = id_number result = ''; while local_count != 0 rem = local_count % URL_BASE local_count = (local_count - rem) / URL_BASE result = URL_CHARS[rem] + result end return result end end
devjj/wikiby
lib/url_components.rb
Ruby
mit
613
<?php namespace TwbBundleTest; use TwbBundle\ConfigProvider; /** * Config Provider Test * * @package TwbBundleTest */ class ConfigProviderTest extends \PHPUnit_Framework_TestCase { /** * The zend-component config provider * * @var \TwbBundle\ConfigProvider */ protected $configProvider; /** * @see \PHPUnit_Framework_TestCase::setUp() */ public function setUp() { $this->configProvider = new ConfigProvider(); } /** * Tests valid return values */ public function testInvokeReturnValues() { $config = $this->configProvider->__invoke(); $this->assertArrayHasKey('twbbundle', $config); $this->assertArrayHasKey('dependencies', $config); $this->assertArrayHasKey('view_helpers', $config); $this->assertNotEmpty($config['twbbundle']); $this->assertNotEmpty($config['dependencies']); $this->assertNotEmpty($config['view_helpers']); } }
neilime/zf2-twb-bundle
tests/TwbBundleTest/ConfigProviderTest.php
PHP
mit
984
# ------------------------------------------------------ # current.py # # Plot a current field at fixed depth # Modified from the spermplot example # # Bjørn Ådlandsvik <bjorn@imr.no> # 2020-03-27 # ------------------------------------------------------ # ------------- # Imports # ------------- import numpy as np import matplotlib.pyplot as plt from netCDF4 import Dataset from roppy import SGrid from roppy.mpl_util import landmask from roppy.trajectories import curly_vectors # ------------------------- # User settings # ------------------------ ncfile = "data/ocean_avg_example.nc" timeframe = 3 # Fourth time frame # subgrid = (1,-1,1,-1) # whole grid except boundary cells subgrid = (110, 170, 35, 90) # Depth level [m] z = 25 # Distance between vectors stride = 2 # Speed level (isotachs) speedlevels = np.linspace(0, 0.5, 6) # 0.0, 0.1, ...., 0.5 # Colormap for speed speedcolors = "YlOrRd" # -------------------- # Read the data # -------------------- f = Dataset(ncfile) grid = SGrid(f, subgrid=subgrid) # Read 3D current for the subgrid U0 = f.variables["u"][timeframe, :, grid.Ju, grid.Iu] V0 = f.variables["v"][timeframe, :, grid.Jv, grid.Iv] Mu = f.variables["mask_u"][grid.Ju, grid.Iu] Mv = f.variables["mask_v"][grid.Jv, grid.Iv] # f.close() # ---------------------- # Handle the data # ---------------------- # Interpolate to rho-points U1 = 0.5 * (U0[:, :, :-1] + U0[:, :, 1:]) V1 = 0.5 * (V0[:, :-1, :] + V0[:, 1:, :]) # Interpolate to correct depth level U = grid.zslice(U1, z) V = grid.zslice(V1, z) # Remove velocity at land and below bottom U[grid.h < z] = np.nan V[grid.h < z] = np.nan # Compute the current speed Speed = np.sqrt(U * U + V * V) # Impose the stride X = grid.X[::stride] Y = grid.Y[::stride] U = U[::stride, ::stride] V = V[::stride, ::stride] # -------------------- # Make the plot # -------------------- # Contour plot of current speed plt.contourf(grid.X, grid.Y, Speed, levels=speedlevels, cmap=speedcolors) plt.colorbar() # Make the vector plot plt.quiver(X, Y, U, V, width=0.003) # Plot green land mask landmask(grid, "LightGreen") # Set correct aspect ratio and axis limits plt.axis("image") plt.axis((grid.i0 + 0.5, grid.i1 - 1.5, grid.j0 + 0.5, grid.j1 - 1.5)) # Display the plot plt.show()
bjornaa/roppy
examples/plot_current25.py
Python
mit
2,273
# Acknowledgements This application makes use of the following third party libraries: ## AFNetworking Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ## FMDB If you are using FMDB in your project, I'd love to hear about it. Let Gus know by sending an email to gus@flyingmeat.com. And if you happen to come across either Gus Mueller or Rob Ryan in a bar, you might consider purchasing a drink of their choosing if FMDB has been useful to you. Finally, and shortly, this is the MIT License. Copyright (c) 2008-2014 Flying Meat Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ## MBProgressHUD Copyright (c) 2009-2015 Matej Bukovinski Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ## SBJson Copyright (C) 2007-2014 Stig Brautaset. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ## SVPullToRefresh Copyright (C) 2012 Sam Vermette Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Generated by CocoaPods - http://cocoapods.org
anlong2008/WeatherCast
WeatherCast/Pods/Target Support Files/Pods/Pods-acknowledgements.markdown
Markdown
mit
6,323
<?php /** * Configuration overrides for WP_ENV === 'staging' */ use Roots\WPConfig\Config; /** * You should try to keep staging as close to production as possible. However, * should you need to, you can always override production configuration values * with `Config::define`. * * Example: `Config::define('WP_DEBUG', true);` * Example: `Config::define('DISALLOW_FILE_MODS', false);` */ Config::define('WP_DEBUG', false); Config::define('WP_DEBUG_DISPLAY', false); Config::define('SCRIPT_DEBUG', false); /** Disable all file modifications including updates and update notifications */ Config::define('DISALLOW_FILE_MODS', true); Config::define('WP_CACHE', true); Config::define('WP_POST_REVISIONS', 2); // Get proxy host to fix redirect loop when multisite is enabled. if (!empty($_SERVER['HTTP_X_FORWARDED_HOST'])) { $_SERVER['HTTP_HOST'] = $_SERVER['HTTP_X_FORWARDED_HOST']; }
newshour/newshour-wordpress-skeleton
config/environments/staging.php
PHP
mit
896
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Runtime.CompilerServices; using System.Collections.Generic; using Internal.Runtime.Augments; using System.Diagnostics; namespace System.Runtime.InteropServices { /// <summary> /// Hooks for System.Private.Interop.dll code to access internal functionality in System.Private.CoreLib.dll. /// /// Methods added to InteropExtensions should also be added to the System.Private.CoreLib.InteropServices contract /// in order to be accessible from System.Private.Interop.dll. /// </summary> [CLSCompliant(false)] public static class InteropExtensions { // Converts a managed DateTime to native OLE datetime // Used by MCG marshalling code public static double ToNativeOleDate(DateTime dateTime) { return dateTime.ToOADate(); } // Converts native OLE datetime to managed DateTime // Used by MCG marshalling code public static DateTime FromNativeOleDate(double nativeOleDate) { return new DateTime(DateTime.DoubleDateToTicks(nativeOleDate)); } // Used by MCG's SafeHandle marshalling code to initialize a handle public static void InitializeHandle(SafeHandle safeHandle, IntPtr win32Handle) { safeHandle.InitializeHandle(win32Handle); } // Used for methods in System.Private.Interop.dll that need to work from offsets on boxed structs public static unsafe void PinObjectAndCall(Object obj, Action<IntPtr> del) { fixed (IntPtr* pEEType = &obj.m_pEEType) { del((IntPtr)pEEType); } } public static int GetElementSize(this Array array) { return array.EETypePtr.ComponentSize; } internal static bool MightBeBlittable(this EETypePtr eeType) { // // This is used as the approximate implementation of MethodTable::IsBlittable(). It will err in the direction of declaring // things blittable since it is used for argument validation only. // return !eeType.HasPointers; } public static bool IsBlittable(this RuntimeTypeHandle handle) { return handle.ToEETypePtr().MightBeBlittable(); } public static bool IsBlittable(this Object obj) { return obj.EETypePtr.MightBeBlittable(); } public static bool IsGenericType(this RuntimeTypeHandle handle) { EETypePtr eeType = handle.ToEETypePtr(); return eeType.IsGeneric; } public static bool IsGenericTypeDefinition(this RuntimeTypeHandle handle) { EETypePtr eeType = handle.ToEETypePtr(); return eeType.IsGenericTypeDefinition; } public static unsafe int GetGenericArgumentCount(this RuntimeTypeHandle genericTypeDefinitionHandle) { Debug.Assert(IsGenericTypeDefinition(genericTypeDefinitionHandle)); return genericTypeDefinitionHandle.ToEETypePtr().ToPointer()->GenericArgumentCount; } //TODO:Remove Delegate.GetNativeFunctionPointer public static IntPtr GetNativeFunctionPointer(this Delegate del) { return del.GetNativeFunctionPointer(); } public static IntPtr GetFunctionPointer(this Delegate del, out RuntimeTypeHandle typeOfFirstParameterIfInstanceDelegate) { return del.GetFunctionPointer(out typeOfFirstParameterIfInstanceDelegate, out bool _, out bool _); } // // Returns the raw function pointer for a open static delegate - if the function has a jump stub // it returns the jump target. Therefore the function pointer returned // by two delegates may NOT be unique // public static IntPtr GetRawFunctionPointerForOpenStaticDelegate(this Delegate del) { //If it is not open static then return IntPtr.Zero if (!del.IsOpenStatic) return IntPtr.Zero; RuntimeTypeHandle typeOfFirstParameterIfInstanceDelegate; IntPtr funcPtr = del.GetFunctionPointer(out typeOfFirstParameterIfInstanceDelegate, out bool _, out bool _); // if the function pointer points to a jump stub return the target return RuntimeImports.RhGetJmpStubCodeTarget(funcPtr); } public static IntPtr GetRawValue(this RuntimeTypeHandle handle) { return handle.RawValue; } /// <summary> /// Comparing RuntimeTypeHandle with an object's RuntimeTypeHandle, avoiding going through expensive Object.GetType().TypeHandle path /// </summary> public static bool IsOfType(this Object obj, RuntimeTypeHandle handle) { RuntimeTypeHandle objType = new RuntimeTypeHandle(obj.EETypePtr); return handle.Equals(objType); } public static bool IsNull(this RuntimeTypeHandle handle) { return handle.IsNull; } public static Type GetTypeFromHandle(IntPtr typeHandle) { return Type.GetTypeFromHandle(new RuntimeTypeHandle(new EETypePtr(typeHandle))); } public static Type GetTypeFromHandle(RuntimeTypeHandle typeHandle) { return Type.GetTypeFromHandle(typeHandle); } public static int GetValueTypeSize(this RuntimeTypeHandle handle) { return (int)handle.ToEETypePtr().ValueTypeSize; } public static bool IsValueType(this RuntimeTypeHandle handle) { return handle.ToEETypePtr().IsValueType; } public static bool IsClass(this RuntimeTypeHandle handle) { return handle.ToEETypePtr().IsDefType && !handle.ToEETypePtr().IsInterface && !handle.ToEETypePtr().IsValueType && !handle.IsDelegate(); } public static bool IsEnum(this RuntimeTypeHandle handle) { return handle.ToEETypePtr().IsEnum; } public static bool IsInterface(this RuntimeTypeHandle handle) { return handle.ToEETypePtr().IsInterface; } public static bool IsPrimitive(this RuntimeTypeHandle handle) { return handle.ToEETypePtr().IsPrimitive; } public static bool IsDelegate(this RuntimeTypeHandle handle) { return InteropExtensions.AreTypesAssignable(handle, typeof(MulticastDelegate).TypeHandle) || InteropExtensions.AreTypesAssignable(handle, typeof(Delegate).TypeHandle); } public static bool AreTypesAssignable(RuntimeTypeHandle sourceType, RuntimeTypeHandle targetType) { return RuntimeImports.AreTypesAssignable(sourceType.ToEETypePtr(), targetType.ToEETypePtr()); } public static unsafe void Memcpy(IntPtr destination, IntPtr source, int bytesToCopy) { Buffer.Memmove((byte*)destination, (byte*)source, (uint)bytesToCopy); } public static bool RuntimeRegisterGcCalloutForGCStart(IntPtr pCalloutMethod) { return RuntimeImports.RhRegisterGcCallout(RuntimeImports.GcRestrictedCalloutKind.StartCollection, pCalloutMethod); } public static bool RuntimeRegisterGcCalloutForGCEnd(IntPtr pCalloutMethod) { return RuntimeImports.RhRegisterGcCallout(RuntimeImports.GcRestrictedCalloutKind.EndCollection, pCalloutMethod); } public static bool RuntimeRegisterGcCalloutForAfterMarkPhase(IntPtr pCalloutMethod) { return RuntimeImports.RhRegisterGcCallout(RuntimeImports.GcRestrictedCalloutKind.AfterMarkPhase, pCalloutMethod); } public static bool RuntimeRegisterRefCountedHandleCallback(IntPtr pCalloutMethod, RuntimeTypeHandle pTypeFilter) { return RuntimeImports.RhRegisterRefCountedHandleCallback(pCalloutMethod, pTypeFilter.ToEETypePtr()); } public static void RuntimeUnregisterRefCountedHandleCallback(IntPtr pCalloutMethod, RuntimeTypeHandle pTypeFilter) { RuntimeImports.RhUnregisterRefCountedHandleCallback(pCalloutMethod, pTypeFilter.ToEETypePtr()); } /// <summary> /// The type of a RefCounted handle /// A ref-counted handle is a handle that acts as strong if the callback returns true, and acts as /// weak handle if the callback returns false, which is perfect for controlling lifetime of a CCW /// </summary> internal const int RefCountedHandleType = 5; public static IntPtr RuntimeHandleAllocRefCounted(Object value) { return RuntimeImports.RhHandleAlloc(value, (GCHandleType)RefCountedHandleType); } public static void RuntimeHandleSet(IntPtr handle, Object value) { RuntimeImports.RhHandleSet(handle, value); } public static void RuntimeHandleFree(IntPtr handle) { RuntimeImports.RhHandleFree(handle); } public static IntPtr RuntimeHandleAllocDependent(object primary, object secondary) { return RuntimeImports.RhHandleAllocDependent(primary, secondary); } public static bool RuntimeIsPromoted(object obj) { return RuntimeImports.RhIsPromoted(obj); } public static void RuntimeHandleSetDependentSecondary(IntPtr handle, Object secondary) { RuntimeImports.RhHandleSetDependentSecondary(handle, secondary); } public static T UncheckedCast<T>(object obj) where T : class { return Unsafe.As<T>(obj); } public static bool IsArray(RuntimeTypeHandle type) { return type.ToEETypePtr().IsArray; } public static RuntimeTypeHandle GetArrayElementType(RuntimeTypeHandle arrayType) { return new RuntimeTypeHandle(arrayType.ToEETypePtr().ArrayElementType); } /// <summary> /// Whether the type is a single dimension zero lower bound array /// </summary> /// <param name="type">specified type</param> /// <returns>true iff it is a single dimension zeo lower bound array</returns> public static bool IsSzArray(RuntimeTypeHandle type) { return type.ToEETypePtr().IsSzArray; } public static RuntimeTypeHandle GetTypeHandle(this object target) { return new RuntimeTypeHandle(target.EETypePtr); } public static bool IsInstanceOf(object obj, RuntimeTypeHandle typeHandle) { return (null != RuntimeImports.IsInstanceOf(obj, typeHandle.ToEETypePtr())); } public static bool IsInstanceOfClass(object obj, RuntimeTypeHandle classTypeHandle) { return (null != RuntimeImports.IsInstanceOfClass(obj, classTypeHandle.ToEETypePtr())); } public static bool IsInstanceOfInterface(object obj, RuntimeTypeHandle interfaceTypeHandle) { return (null != RuntimeImports.IsInstanceOfInterface(obj, interfaceTypeHandle.ToEETypePtr())); } public static bool GuidEquals(ref Guid left, ref Guid right) { return left.Equals(ref right); } public static bool ComparerEquals<T>(T left, T right) { return EqualOnlyComparer<T>.Equals(left, right); } public static object RuntimeNewObject(RuntimeTypeHandle typeHnd) { return RuntimeImports.RhNewObject(typeHnd.ToEETypePtr()); } public static unsafe void UnsafeCopyTo(this System.Text.StringBuilder stringBuilder, char* destination) { stringBuilder.UnsafeCopyTo(destination); } public static unsafe void ReplaceBuffer(this System.Text.StringBuilder stringBuilder, char* newBuffer) { stringBuilder.ReplaceBuffer(newBuffer); } public static void ReplaceBuffer(this System.Text.StringBuilder stringBuilder, char[] newBuffer) { stringBuilder.ReplaceBuffer(newBuffer); } public static char[] GetBuffer(this System.Text.StringBuilder stringBuilder, out int len) { return stringBuilder.GetBuffer(out len); } public static IntPtr RuntimeHandleAllocVariable(Object value, uint type) { return RuntimeImports.RhHandleAllocVariable(value, type); } public static uint RuntimeHandleGetVariableType(IntPtr handle) { return RuntimeImports.RhHandleGetVariableType(handle); } public static void RuntimeHandleSetVariableType(IntPtr handle, uint type) { RuntimeImports.RhHandleSetVariableType(handle, type); } public static uint RuntimeHandleCompareExchangeVariableType(IntPtr handle, uint oldType, uint newType) { return RuntimeImports.RhHandleCompareExchangeVariableType(handle, oldType, newType); } public static void SetExceptionErrorCode(Exception exception, int hr) { exception.SetErrorCode(hr); } public static void SetExceptionMessage(Exception exception, string message) { exception.SetMessage(message); } public static Exception CreateDataMisalignedException(string message) { return new DataMisalignedException(message); } public static Delegate CreateDelegate(RuntimeTypeHandle typeHandleForDelegate, IntPtr ldftnResult, Object thisObject, bool isStatic, bool isVirtual, bool isOpen) { return Delegate.CreateDelegate(typeHandleForDelegate.ToEETypePtr(), ldftnResult, thisObject, isStatic, isOpen); } public enum VariableHandleType { WeakShort = 0x00000100, WeakLong = 0x00000200, Strong = 0x00000400, Pinned = 0x00000800, } public static void AddExceptionDataForRestrictedErrorInfo(Exception ex, string restrictedError, string restrictedErrorReference, string restrictedCapabilitySid, object restrictedErrorObject) { ex.AddExceptionDataForRestrictedErrorInfo(restrictedError, restrictedErrorReference, restrictedCapabilitySid, restrictedErrorObject); } public static bool TryGetRestrictedErrorObject(Exception ex, out object restrictedErrorObject) { return ex.TryGetRestrictedErrorObject(out restrictedErrorObject); } public static bool TryGetRestrictedErrorDetails(Exception ex, out string restrictedError, out string restrictedErrorReference, out string restrictedCapabilitySid) { return ex.TryGetRestrictedErrorDetails(out restrictedError, out restrictedErrorReference, out restrictedCapabilitySid); } public static TypeInitializationException CreateTypeInitializationException(string message) { return new TypeInitializationException(message); } public static unsafe IntPtr GetObjectID(object obj) { fixed (void* p = &obj.m_pEEType) { return (IntPtr)p; } } public static bool RhpETWShouldWalkCom() { return RuntimeImports.RhpETWShouldWalkCom(); } public static void RhpETWLogLiveCom(int eventType, IntPtr CCWHandle, IntPtr objectID, IntPtr typeRawValue, IntPtr IUnknown, IntPtr VTable, Int32 comRefCount, Int32 jupiterRefCount, Int32 flags) { RuntimeImports.RhpETWLogLiveCom(eventType, CCWHandle, objectID, typeRawValue, IUnknown, VTable, comRefCount, jupiterRefCount, flags); } public static bool SupportsReflection(this Type type) { return RuntimeAugments.Callbacks.SupportsReflection(type); } public static void SuppressReentrantWaits() { RuntimeThread.SuppressReentrantWaits(); } public static void RestoreReentrantWaits() { RuntimeThread.RestoreReentrantWaits(); } public static IntPtr GetCriticalHandle(CriticalHandle criticalHandle) { return criticalHandle.GetHandleInternal(); } public static void SetCriticalHandle(CriticalHandle criticalHandle, IntPtr handle) { criticalHandle.SetHandleInternal(handle); } } }
shrah/corert
src/System.Private.CoreLib/src/System/Runtime/InteropServices/InteropExtensions.cs
C#
mit
16,834
<?php function curl($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5'); $result = curl_exec($ch); curl_close($ch); return $result; } function getListOfTimesToLookUp($timestring) { $timeArray = explode(":", $timestring); $hour = $timeArray[0]; $minute = $timeArray[1]; if (intval($hour) >= 12) { $hourIn12HrSystem = strval($hour - 12); } else { $hourIn12HrSystem = $hour; } if (strlen($hourIn12HrSystem) == 1) { $hourIn12HrSystem = "0" . $hourIn12HrSystem; } $time12HrSystem = $hourIn12HrSystem . ":" . $minute; if ($hour == $hourIn12HrSystem) { $timesToLookUp = array($time12HrSystem); } else { $time24HrSystem = $hour . ":" . $minute; $timesToLookUp = array($time12HrSystem, $time24HrSystem); } return $timesToLookUp; } function makeACategoryNameOutOfTime($time) { return "Time_" . $time; } function getAllCategoryMembers($categoryName) { $base = "https://commons.wikimedia.org/w/api.php?action=query&list=categorymembers&format=json&cmtype=file&cmtitle=Category:"; $url = $base . $categoryName; $res = json_decode(curl($url), true); $categorymembers = $res["query"]["categorymembers"]; return $categorymembers; } function getAllThePicturesForOneOrMoreTime($timesToLookUp) { $allThePictures = array(); foreach ($timesToLookUp as $time) { $categorymembers = getAllCategoryMembers(makeACategoryNameOutOfTime($time)); foreach ($categorymembers as $member) { array_push($allThePictures, $member); } } return $allThePictures; } function getRandomArrayMember($array) { if (count($array) == 1) { return $array[0]; } else { return $array[array_rand($array)]; } } function getRandomPic($arrayOfPics) { $pic = getRandomArrayMember($arrayOfPics); $pageid = $pic["pageid"]; $title = str_replace(" ", "_", $pic["title"]); $creditUrl = "https://commons.wikimedia.org/wiki/" . $title; $thumbUrl = "https://commons.wikimedia.org/w/api.php?action=query&format=json&prop=imageinfo&iiprop=url&iiurlwidth=640&titles=" . $title; $thumb = json_decode(curl($thumbUrl), true); $result = array($creditUrl, $thumb["query"]["pages"][$pageid]["imageinfo"][0]["thumburl"]); return json_encode($result); } $time = $_POST["time"]; $timesToLookUp = getListOfTimesToLookUp($time); $allThePictures = getAllThePicturesForOneOrMoreTime($timesToLookUp); echo getRandomPic($allThePictures);
Vesihiisi/WikiClock
getPics.php
PHP
mit
2,720
class AddIndexToPrecincts < ActiveRecord::Migration[5.0] def self.up add_index :precincts, :precinct_identifier end def self.down remove_index :precincts, :precinct_identifier end end
greenvault/wahlbezirke
db/migrate/20170509102110_add_index_to_precincts.rb
Ruby
mit
201
package kmz import ( "bytes" "log" "github.com/twpayne/go-kml" ) func ExampleNewKMZ() { kmz := NewKMZ( kml.Placemark( kml.Name("Simple placemark"), kml.Description("Attached to the ground. Intelligently places itself at the height of the underlying terrain."), kml.Point( kml.Coordinates(kml.Coordinate{Lon: -122.0822035425683, Lat: 37.42228990140251}), ), ), ) w := &bytes.Buffer{} if err := kmz.WriteIndent(w, "", "\t"); err != nil { log.Fatal(err) } }
twpayne/go-kmz
kmz_test.go
GO
mit
488
module Raml class QueryParameter attr_accessor :name, :description, :type, :example, :required def initialize(name) @name = name @required = false end end end
jpb/raml-rb
lib/raml/query_parameter.rb
Ruby
mit
189
#if VOUCHERIFYSERVER using Newtonsoft.Json; using Voucherify.Core.DataModel; namespace Voucherify.DataModel.Contexts { [JsonObject] public class SkuUpdate { [JsonProperty(PropertyName = "sku")] public string SkuValue { get; set; } [JsonProperty(PropertyName = "price")] public long? Price { get; set; } [JsonProperty(PropertyName = "attributes")] public Metadata Attributes { get; set; } [JsonProperty(PropertyName = "metadata")] public Metadata Metadata { get; set; } private SkuUpdate() { Metadata = new Metadata(); Attributes = new Metadata(); } public static SkuUpdate FromEmpty() { return new SkuUpdate(); } public static SkuUpdate FromSku(Sku sku) { Metadata metadata = null; if (sku.Metadata != null) { metadata = new Metadata(); foreach (var key in sku.Metadata.Keys) { metadata.Add(key, sku.Metadata[key]); } } Metadata attributes = null; if (sku.Attributes != null) { attributes = new Metadata(); foreach (var key in sku.Attributes.Keys) { attributes.Add(key, sku.Attributes[key]); } } return new SkuUpdate() { SkuValue = sku.SkuValue, Price = sku.Price, Attributes = attributes, Metadata = metadata }; } public SkuUpdate WithSkuValue(string skuValue) { this.SkuValue = skuValue; return this; } public SkuUpdate WithPrice(long? price) { this.Price = price; return this; } public SkuUpdate WithAttributes(Metadata attributes) { this.Attributes = attributes; return this; } public SkuUpdate WithMetadata(Metadata metadata) { this.Metadata = metadata; return this; } } } #endif
voucherifyio/voucherify-dotNET-sdk
src/Voucherify/DataModel/Contexts/SkuUpdate.cs
C#
mit
2,247
{% if page.author and site.data.authors[page.author] %} {% assign author = site.data.authors[page.author] %} {% else %} {% assign author = site.author %} {% endif %} <div itemscope itemtype="http://schema.org/Person"> {% if author.avatar %} <div class="author__avatar"> {% if author.avatar contains "://" %} <img src="{{ author.avatar }}" alt="{{ author.name }}" itemprop="image"> {% else %} <img src="{{ author.avatar | absolute_url }}" class="author__avatar" alt="{{ author.name }}" itemprop="image"> {% endif %} </div> {% endif %} <div class="author__content"> <h3 class="author__name" itemprop="name">{{ author.name }}</h3> {% if author.bio %} <p class="author__bio" itemprop="description"> {{ author.bio }} </p> {% endif %} </div> <div class="author__urls-wrapper"> <button class="btn btn--inverse">{{ site.data.ui-text[site.locale].follow_label | remove: ":" | default: "Follow" }}</button> <ul class="author__urls social-icons"> {% if author.location %} <li itemprop="homeLocation" itemscope itemtype="http://schema.org/Place"> <i class="fa fa-fw fa-map-marker" aria-hidden="true"></i> <span itemprop="name"> {{ author.location }} </span> </li> {% endif %} {% if author.uri %} <li> <a href="{{ author.uri }}" itemprop="url"> <i class="fa fa-fw fa-chain" aria-hidden="true"></i> {{ site.data.ui-text[site.locale].website_label | default: "Website" }} </a> </li> {% endif %} {% if author.email %} <li> <a href="mailto:{{ author.email }}"> <i class="fa fa-fw fa-envelope-square" aria-hidden="true"></i> <meta itemprop="email" content="{{ author.email }}" /> {{ site.data.ui-text[site.locale].email_label | default: "Email" }} </a> </li> {% endif %} {% if author.keybase %} <li><a href="https://keybase.io/{{ author.keybase }} " itemprop="sameAs"> <i class="fa fa-fw fa-key" aria-hidden="true"></i> Keybase </a></li> {% endif %} {% if author.twitter %} <li><a href="https://twitter.com/{{ author.twitter }}" itemprop="sameAs"> <i class="fa fa-fw fa-twitter-square" aria-hidden="true"></i> Twitter </a></li> {% endif %} {% if author.reddit %} <li><a href="https:///www.reddit.com/user/{{ author.reddit }}" itemprop="sameAs"> <i class="fa fa-fw fa-reddit-square" aria-hidden="true"></i> Reddit </a></li> {% endif %} {% if author.facebook %} <li><a href="https://www.facebook.com/{{ author.facebook }}" itemprop="sameAs"> <i class="fa fa-fw fa-facebook-square" aria-hidden="true"></i> Facebook </a></li> {% endif %} {% if author.google_plus %} <li><a href="https://plus.google.com/+{{ author.google_plus }}" itemprop="sameAs"> <i class="fa fa-fw fa-google-plus-square" aria-hidden="true"></i> Google+ </a></li> {% endif %} {% if author.linkedin %} <li><a href="https://www.linkedin.com/in/{{ author.linkedin }}" itemprop="sameAs"> <i class="fa fa-fw fa-linkedin-square" aria-hidden="true"></i> LinkedIn </a></li> {% endif %} {% if author.xing %} <li><a href="https://www.xing.com/profile/{{ author.xing }}" itemprop="sameAs"> <i class="fa fa-fw fa-xing-square" aria-hidden="true"></i> XING </a></li> {% endif %} {% if author.instagram %} <li><a href="https://instagram.com/{{ author.instagram }}" itemprop="sameAs"> <i class="fa fa-fw fa-instagram" aria-hidden="true"></i> Instagram </a></li> {% endif %} {% if author.tumblr %} <li><a href="https://{{ author.tumblr }}.tumblr.com" itemprop="sameAs"> <i class="fa fa-fw fa-tumblr-square" aria-hidden="true"></i> Tumblr </a></li> {% endif %} {% if author.bitbucket %} <li><a href="https://bitbucket.org/{{ author.bitbucket }}" itemprop="sameAs"> <i class="fa fa-fw fa-bitbucket" aria-hidden="true"></i> Bitbucket </a></li> {% endif %} {% if author.github %} <li><a href="https://github.com/{{ author.github }}" itemprop="sameAs"> <i class="fa fa-fw fa-github" aria-hidden="true"></i> Github </a></li> {% endif %} {% if author.stackoverflow %} <li><a href="https://www.stackoverflow.com/users/{{ author.stackoverflow }}" itemprop="sameAs"> <i class="fa fa-fw fa-stack-overflow" aria-hidden="true"></i> Stackoverflow </a></li> {% endif %} {% if author.lastfm %} <li><a href="https://last.fm/user/{{ author.lastfm }}" itemprop="sameAs"> <i class="fa fa-fw fa-lastfm-square" aria-hidden="true"></i> Last.fm </a></li> {% endif %} {% if author.dribbble %} <li><a href="https://dribbble.com/{{ author.dribbble }}" itemprop="sameAs"> <i class="fa fa-fw fa-dribbble" aria-hidden="true"></i> Dribbble </a></li> {% endif %} {% if author.pinterest %} <li><a href="https://www.pinterest.com/{{ author.pinterest }}" itemprop="sameAs"> <i class="fa fa-fw fa-pinterest" aria-hidden="true"></i> Pinterest </a></li> {% endif %} {% if author.foursquare %} <li><a href="https://foursquare.com/{{ author.foursquare }}" itemprop="sameAs"> <i class="fa fa-fw fa-foursquare" aria-hidden="true"></i> Foursquare </a></li> {% endif %} {% if author.steam %} <li><a href="https://steamcommunity.com/id/{{ author.steam }}" itemprop="sameAs"> <i class="fa fa-fw fa-steam-square" aria-hidden="true"></i> Steam </a></li> {% endif %} {% if author.youtube %} <li><a href="https://www.youtube.com/user/{{ author.youtube }}" itemprop="sameAs"> <i class="fa fa-fw fa-youtube-square" aria-hidden="true"></i> YouTube </a></li> {% endif %} {% if author.soundcloud %} <li><a href="https://soundcloud.com/{{ author.soundcloud }}" itemprop="sameAs"> <i class="fa fa-fw fa-soundcloud" aria-hidden="true"></i> Soundcloud </a></li> {% endif %} {% if author.weibo %} <li><a href="https://www.weibo.com/{{ author.weibo }}" itemprop="sameAs"> <i class="fa fa-fw fa-weibo" aria-hidden="true"></i> Weibo </a></li> {% endif %} {% if author.flickr %} <li><a href="https://www.flickr.com/{{ author.flickr }}" itemprop="sameAs"> <i class="fa fa-fw fa-flickr" aria-hidden="true"></i> Flickr </a></li> {% endif %} {% if author.codepen %} <li><a href="https://codepen.io/{{ author.codepen }}" itemprop="sameAs"> <i class="fa fa-fw fa-codepen" aria-hidden="true"></i> CodePen </a></li> {% endif %} {% if author.vine %} <li><a href="https://vine.co/u/{{ author.vine }}" itemprop="sameAs"> <i class="fa fa-fw fa-vine" aria-hidden="true"></i> Vine </a></li> {% endif %} </ul> </div> </div>
RimWorldMod/RimWorldMod.github.io
_includes/author-profile.html
HTML
mit
7,543
//////////////////////////////////////////////// /* Provided Code - Please Don't Edit */ //////////////////////////////////////////////// 'use strict'; function getInput() { console.log("Please choose either 'rock', 'paper', or 'scissors'.") return prompt(); } function randomPlay() { var randomNumber = Math.random(); if (randomNumber < 0.33) { return "rock"; } else if (randomNumber < 0.66) { return "paper"; } else { return "scissors"; } } //////////////////////////////////////////////// /* Write Your Code Below */ //////////////////////////////////////////////// function getPlayerMove(move) { // Write an expression that operates on a variable called `move` // If a `move` has a value, your expression should evaluate to that value. // However, if `move` is not specified / is null, your expression should equal `getInput()`. return move || getInput(); } function getComputerMove(move) { // Write an expression that operates on a variable called `move` // If a `move` has a value, your expression should evaluate to that value. // However, if `move` is not specified / is null, your expression should equal `randomPlay()`. return move || randomPlay(); } function getWinner(playerMove,computerMove) { var winner; // Write code that will set winner to either 'player', 'computer', or 'tie' based on the values of playerMove and computerMove. // Assume that the only values playerMove and computerMove can have are 'rock', 'paper', and 'scissors'. // The rules of the game are that 'rock' beats 'scissors', 'scissors' beats 'paper', and 'paper' beats 'rock'. if (playerMove === computerMove){ winner = 'tie'; } else if(playerMove === 'rock' && computerMove === 'scissors'){ winner = 'player'; } else if(playerMove === 'scissors' && computerMove === 'rock'){ winner = 'computer'; } else if(playerMove === 'paper' && computerMove === 'rock'){ winner = 'player'; } else if(playerMove === 'rock' && computerMove === 'paper'){ winner = 'computer'; } else if(playerMove === 'paper' && computerMove === 'scissors'){ winner = 'computer'; } else if(playerMove === 'scissors' && computerMove === 'paper'){ winner = 'player'; } return winner; } function playToFive() { console.log("Let's play Rock, Paper, Scissors"); var playerWins = 0; var computerWins = 0; // Write code that plays 'Rock, Paper, Scissors' until either the player or the computer has won five times. /* YOUR CODE HERE */ while (playerWins < 5 && computerWins < 5) { var playerMove = getPlayerMove(); var computerMove = getComputerMove(); var winner = getWinner(playerMove,computerMove); if (winner === 'player') { playerWins += 1; } else if ( winner === 'computer') { computerWins += 1; } else { playerWins += 0; computerWins += 0; console.log("It's a tie!") } console.log('Player chose ' + playerMove + ' while Computer chose ' + computerMove); console.log('The score is currently ' + playerWins + ' to ' + computerWins); } if (playerWins > computerWins) { console.log('Player won! Congrats!') } else { console.log('Computer won....Game Over!') } } //call function playToFive();
aleongithub/wdi-fundamentals-rps
app/js/rockpaperscissors.js
JavaScript
mit
3,448
# ReadCounts Read Grouping The counts for aligned reads are tabulated by BAM file and, if desired, by a group identifier extracted from each alignment record. Usecases include cell-barcodes added for single-cell sequencing. Read groups can be extracted from read headers by regular expression, splitting lines according to some separator character, or directly from BAM alignment headers. Aligned reads without a group identifier can be assigned a specific identifier or omitted from the output. The available read-grouping strategies are defined in the file `group.ini` in the ReadCounts distribution. New or modified read-grouping strategies can be created, using the same format, in a `group.ini` file in the current working directory. Named grouping strategies in the current working directory override those with the same name in the ReadCounts distribution. ## Read-Grouping Strategies ### UMI-tools > Pick out cell barcodes from read name/identifier added by umi_tools. ### STARsolo > Cell barcodes added by STARsolo as CB tag in aligned read, reads without a CB tag dropped. ## Read-Grouping Operations ### ReadNameWord > Parameters: field_index field_sep=_ missing=None > Split the read name into words according to `field_sep` (default: "_"), and retain word with index `field_index` (required). Field index starts at 0. If the read name does not have enough words, use the read group identifier specified by `missing` (default: not specified). If `missing` is not specified, drop the read. ### ReadNameRegex > Parameters: regex regexgrp=1 missing=None > Apply (Python) regular expression `regex` (required) to the read name and extract matching group number `regexgrp` (default: 1). If the regular expression doesn't match, use the read group identifier specified by `missing` (default: not specified). If `missing` is not specified, drop the read. ### ReadTagValue > Parameters: tag missing=None > Use the value in the BAM tag `tag` (required). If `tag` is missing, use the read group specified by identifier `missing` (default: not specified). If `missing` is not specified, drop the read. ### RGTag > Parameters: missing=None > Use the value in the BAM read-group tag "RG". If "RG" is missing, use the read group specified by identifier `missing` (default: not specified). If `missing` is not specified, drop the read. ## Examples ### UMI-tools ``` [UMI-tools] Description: Pick out cell barcodes from read name/identifier added by umi_tools. ReadNameWord: field_index=1 field_sep=_ ``` ### STARsolo ``` [STARsolo] Description: Cell barcodes added by STARsolo in CB tag in aligned read, reads without a CB tag dropped. ReadTagValue: tag='CB' ``` ### UMI-tools_Regex ``` [UMI-tools_Regex] Description: Pick out cell barcodes from read name/identifier added by umi_tools using a regular expression. ReadNameRegex: regex='_([ACGT]{16})_' regexgrp=1 ``` ### UB-Tag ``` [UB-Tag] Description: UB tag from aligned read, reads without a UB tag get value "XXXXXXXX" ReadTagValue: tag='UB' missing='XXXXXXXX' ```
HorvathLab/NGS
ReadCounts/docs/Grouping.md
Markdown
mit
3,040
require 'test_helper' class InterleaveRegistryAffiliateTest < ActiveSupport::TestCase # test "the truth" do # assert true # end end
NUBIC/interleave
test/models/interleave_registry_affiliate_test.rb
Ruby
mit
141
/* Navicat Premium Data Transfer Source Server : localmysql Source Server Type : MySQL Source Server Version : 50544 Source Host : 192.168.26.130 Source Database : SurveyAPP Target Server Type : MySQL Target Server Version : 50544 File Encoding : utf-8 Date: 09/22/2015 12:30:14 PM */ SET NAMES utf8; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for `Answers` -- ---------------------------- DROP TABLE IF EXISTS `Answers`; CREATE TABLE `Answers` ( `id` int(11) NOT NULL, `text` varchar(255) DEFAULT NULL, `question_id` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `fk_Answers_questions_1` (`question_id`), CONSTRAINT `fk_Answers_questions_1` FOREIGN KEY (`question_id`) REFERENCES `questions` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Table structure for `Brand` -- ---------------------------- DROP TABLE IF EXISTS `Brand`; CREATE TABLE `Brand` ( `ID` int(11) NOT NULL, `Name` varchar(255) DEFAULT NULL, PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Table structure for `Products` -- ---------------------------- DROP TABLE IF EXISTS `Products`; CREATE TABLE `Products` ( `id` int(11) NOT NULL, `name` varchar(255) DEFAULT NULL, `description` varchar(255) DEFAULT NULL, `features` varchar(255) DEFAULT NULL, `barcode` varchar(255) DEFAULT NULL, `topic_id` int(11) DEFAULT NULL, `Picture` longblob, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Table structure for `companies` -- ---------------------------- DROP TABLE IF EXISTS `companies`; CREATE TABLE `companies` ( `id` int(11) NOT NULL AUTO_INCREMENT, `Name` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Table structure for `events` -- ---------------------------- DROP TABLE IF EXISTS `events`; CREATE TABLE `events` ( `id` int(11) NOT NULL AUTO_INCREMENT, `Name` varchar(255) DEFAULT NULL, `Date_start` date DEFAULT NULL, `Date_end` date DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Table structure for `events_questions` -- ---------------------------- DROP TABLE IF EXISTS `events_questions`; CREATE TABLE `events_questions` ( `event_id` int(11) NOT NULL, `question_id` int(11) NOT NULL, `day` int(11) DEFAULT NULL, PRIMARY KEY (`event_id`,`question_id`), KEY `fk_events_questions_questions_1` (`question_id`), CONSTRAINT `fk_events_questions_events_1` FOREIGN KEY (`event_id`) REFERENCES `events` (`id`), CONSTRAINT `fk_events_questions_questions_1` FOREIGN KEY (`question_id`) REFERENCES `questions` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Table structure for `questions` -- ---------------------------- DROP TABLE IF EXISTS `questions`; CREATE TABLE `questions` ( `id` int(11) NOT NULL AUTO_INCREMENT, `TEXT` text, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Table structure for `statement_type` -- ---------------------------- DROP TABLE IF EXISTS `statement_type`; CREATE TABLE `statement_type` ( `id` int(11) NOT NULL, `type` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Table structure for `statements` -- ---------------------------- DROP TABLE IF EXISTS `statements`; CREATE TABLE `statements` ( `id` int(11) NOT NULL, `text` varchar(255) DEFAULT NULL, `type_id` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `fk_statements_statement_type_1` (`type_id`), CONSTRAINT `fk_statements_statement_type_1` FOREIGN KEY (`type_id`) REFERENCES `statement_type` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Table structure for `users` -- ---------------------------- DROP TABLE IF EXISTS `users`; CREATE TABLE `users` ( `id` int(11) NOT NULL AUTO_INCREMENT, `fname` varchar(255) DEFAULT NULL, `lname` varchar(255) DEFAULT NULL, `user` varchar(255) DEFAULT NULL, `password` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; SET FOREIGN_KEY_CHECKS = 1;
hyperted/blub
sql/SurveyAPP.sql
SQL
mit
4,334
from __init__ import redis_db from werkzeug.security import generate_password_hash, check_password_hash from os import urandom from base64 import b64encode class User(object): def __init__(self): self.username = "" # required self.password_hash = "" # required self.phone_number = "" # required self.emergency_contact = "" # not required self.secret_key = b64encode(urandom(64)).decode("utf-8") self.contacts = set() # can be empty def set_password(self, password): self.password_hash = generate_password_hash(password, method="pbkdf2:sha256", salt_length=32) def verify_password(self, password): return check_password_hash(self.password_hash, password) def write_to_db(self): user_dict = {"password_hash": self.password_hash, "phone_number": self.phone_number, "secret_key": self.secret_key, "emergency_contact": self.emergency_contact} redis_db.hmset(self.username, user_dict) redis_db.delete(self.username + ":contacts") if len(self.contacts): redis_db.sadd(self.username + ":contacts", *self.contacts) def deauthenticate(self): self.secret_key = b64encode(urandom(64)).decode("utf-8") @classmethod def get_from_db(cls, username): user_dict = redis_db.hmget(username, ["password_hash", "phone_number", "secret_key", "emergency_contact"]) fetched_user = User() fetched_user.username = username fetched_user.password_hash = user_dict[0] fetched_user.phone_number = user_dict[1] fetched_user.secret_key = user_dict[2] fetched_user.emergency_contact = user_dict[3] if not fetched_user.password_hash or not fetched_user.phone_number or not fetched_user.secret_key: return None else: fetched_user.contacts = redis_db.smembers(fetched_user.username + ":contacts") return fetched_user
BrambleLLC/HackAZ-2016
server/webapp/models.py
Python
mit
1,957
var express = require('express'), server = express(); server.use('/', express.static(__dirname + '/public')); server.use('/shaders', express.static(__dirname + '/lessons/shaders')); server.use('/assets', express.static(__dirname + '/lessons/assets')); server.listen(9000); console.log('Listening on port 9000');
ranerp/webgl-sissejuhatus
server.js
JavaScript
mit
317
var assert = require('assert'); var _ = require('lodash'); var Client = require('./lib/client'); describe('cgminer-api', function () { describe('@parser', function () { }); describe('@client', function () { var client; before(function (done) { client = new Client({ host: process.env.CGMINER_HOST, port: process.env.CGMINER_PORT }); client.connect() .then(function (client) { assert(client instanceof Client); done(); }) .catch(function (err) { done(err); }); }); it('can double-connect without error', function (done) { client.connect() .then(function (client) { assert(client instanceof Client); done(); }) .catch(function (err) { done(err); }); }); describe('#_commands', function () { it('should be an object', function () { //console.log(client._commands); assert(_.isObject(client._commands)); }); }); describe('#version()', function (done) { it('should return a validated object', function (done) { assert(_.isFunction(client.version), 'client.version() is not a function'); client.version().then(function (result) { assert(_.isObject(result)); assert(_.isString(result.API)); done(); }) .catch(done); }); }); describe.skip('#stats()', function (done) { it('should return a validated object', function (done) { assert(_.isFunction(client.stats), 'client.stats() is not a function'); client.stats().then(function (stats) { assert(_.isObject(stats)); done(); }) .catch(done); }); }); describe('#summary()', function (done) { it('should return a validated object', function (done) { assert(_.isFunction(client.summary), 'client.summary() is not a function'); client.summary().then(function (summary) { assert(_.isObject(summary)); done(); }) .catch(done); }); }); describe('#pools()', function (done) { it('should return a validated object', function (done) { assert(_.isFunction(client.summary), 'client.pools() is not a function'); client.pools().then(function (pools) { //console.log(pools); assert(_.isArray(pools)); done(); }) .catch(done); }); }); describe('#devs()', function (done) { it('should return a validated object', function (done) { assert(_.isFunction(client.summary), 'client.devs() is not a function'); client.devs().then(function (devices) { console.log(devices); assert(_.isArray(devices)); done(); }) .catch(done); }); }); describe('#config()', function (done) { it('should return a validated object', function (done) { assert(_.isFunction(client.summary), 'client.config() is not a function'); client.config().then(function (config) { assert(_.isObject(config)); done(); }) .catch(done); }); }); describe('#addpool()', function (done) { var poolCount = 0; before(function (done) { client.pools().then(function (pools) { assert(_.isArray(pools)); poolCount = pools.length; done(); }) .catch(done); }); it('should return a validated object', function (done) { var pool = [ 'stratum+tcp://us1.ghash.io:3333', 'abshnasko.ephemeral1', 'x' ]; assert(_.isFunction(client.addpool), 'client.addpool() is not a function'); client.addpool(pool).then(function (status) { console.log(status); assert(_.isObject(status)); assert(/added pool/i.test(status.Msg)); done(); }) .catch(done); }); it('should add a pool', function (done) { client.pools().then(function (pools) { assert(_.isArray(pools)); assert(pools.length === poolCount + 1, 'pool count should be ' + (poolCount + 1) + ' but is actually '+ pools.length); done(); }) .catch(done); }); }); describe('#enablepool()', function (done) { it('should return a validated object', function (done) { client.enablepool(0).then(function (status) { assert(_.isObject(status)); done(); }) .catch(done); }); it('should enable pool', function (done) { client.enablepool(0).then(function (status) { //console.log(status); assert(/already enabled/.test(status.Msg), status.Msg); done(); }) .catch(done); }); }); describe('#disablepool()', function (done) { it('should return a validated object', function (done) { client.disablepool(0) .then(function (status) { assert(/Disabling pool/.test(status.Msg), status.Msg); assert(_.isObject(status)); done(); }) .catch(done); }); it('should disable pool', function (done) { client.disablepool(0) .then(function (status) { assert(/already disabled/.test(status.Msg), status.Msg); done(); }) .catch(done); }); }); describe('#removepool()', function (done) { it('should disable and remove pool', function (done) { client.removepool(0) .then(function (status) { //console.log(status); if (/Cannot remove active pool/.test(status.Msg)) { // should throw a warning here, but this is not an exception return client.disablepool(0); } else { assert(/Removed pool 0/.test(status.Msg), status.Msg); } }) .then(function (status) { //console.log(status); done(); }) .catch(done); }); }); describe('#switchpool()', function (done) { it('should switch pool 0 to highest priority', function (done) { client.switchpool(0) .then(function (status) { assert(_.isObject(status)); assert(_.any([ /Switching to pool 0/.test(status.Msg), /Cannot remove active pool/.test(status.Msg) ]), status.Msg ); done(); }) .catch(done); }); }); describe('#save()', function (done) { it('should save config without error', function (done) { client.save() .then(function (status) { assert(/Configuration saved to file/.test(status.Msg)); assert(_.isObject(status)); done(); }) .catch(done); }); }); describe('#privileged()', function (done) { it('should return success, indicating we have privileged access', function (done) { client.privileged() .then(function (status) { assert(/Privileged access OK/.test(status.Msg)); assert(_.isObject(status)); done(); }) .catch(done); }); }); describe('#check()', function (done) { it('should check summary command', function (done) { client.check('summary') .then(function (cmd) { assert(_.isObject(cmd)); assert(cmd.Exists === 'Y'); assert(cmd.Access === 'Y'); done(); }) .catch(done); }); it('should check bogus command', function (done) { client.check('bogus') .then(function (cmd) { assert(_.isObject(cmd)); assert(cmd.Exists === 'N'); assert(cmd.Access === 'N'); done(); }) .catch(done); }); }); describe('#restart()', function (done) { it('should restart', function (done) { client.restart() .then(function (status) { assert(_.isObject(status)); done(); }) .catch(done); }); }); }); });
hashpanel/node-cgminer
test.js
JavaScript
mit
8,424
package com.waylau.spring.boot.blog.domain; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import org.springframework.security.core.GrantedAuthority; /** * 权限. * * @since 1.0.0 2017年3月14日 * @author <a href="https://waylau.com">Way Lau</a> */ @Entity // 实体 public class Authority implements GrantedAuthority { private static final long serialVersionUID = 1L; @Id // 主键 @GeneratedValue(strategy = GenerationType.IDENTITY) // 自增长策略 private Long id; // 用户的唯一标识 @Column(nullable = false) // 映射为字段,值不能为空 private String name; public Long getId() { return id; } public void setId(Long id) { this.id = id; } /* * (non-Javadoc) * * @see org.springframework.security.core.GrantedAuthority#getAuthority() */ @Override public String getAuthority() { return name; } public void setName(String name) { this.name = name; } }
waylau/spring-boot-tutorial
samples/blog-auth/src/main/java/com/waylau/spring/boot/blog/domain/Authority.java
Java
mit
1,052
package epi import ( "testing" "github.com/stretchr/testify/assert" ) // Write a function to calculate the parity // returns 1 if odd number of bits // return 0 if even number of bits func parity(n uint64) int { count := 0 for i := 0; i < 64; i++ { if (n & (1 << uint64(i))) > 0 { count++ } } if count%2 == 0 { return 0 } return 1 } func TestGoParity(t *testing.T) { assert.Equal(t, 0, parity(3)) assert.Equal(t, 1, parity(1)) }
mb-dev/algorithms
epi/5.0-parity_test.go
GO
mit
452
import functions import heapq import vtbase ### Classic stream iterator registered = True class StreamExcept(vtbase.VT): def BestIndex(self, constraints, orderbys): return (None, 0, None, True, 1000) def VTiter(self, *parsedArgs, **envars): largs, dictargs = self.full_parse(parsedArgs) if len(largs) < 1: raise functions.OperatorError(__name__.rsplit('.')[-1], "Not defined union tables ") streams = str(largs[0]).split(",") if len(streams) < 2: raise functions.OperatorError(__name__.rsplit('.')[-1], "Union tables must be more than one ") cursors = [] execs = [] for stream in streams: cursors.append(envars['db'].cursor()) execs.append(cursors[-1].execute("select * from " + str(stream) + ";")) comparedcursor = str(cursors[0].getdescriptionsafe()) # for cursor in cursors: # if str(cursor.getdescriptionsafe()) != comparedcursor: # raise functions.OperatorError(__name__.rsplit('.')[-1],"Union tables with different schemas ") if 'cols' in dictargs: try: cols = int(dictargs['cols']) except ValueError: try: cols = [y[0] for y in cursors[0].getdescriptionsafe()].index(dictargs['cols']) except ValueError: raise functions.OperatorError(__name__.rsplit('.')[-1], "Column name does not exists ") else: cols = 0 if cols >= len(cursors[0].getdescriptionsafe()): raise functions.OperatorError(__name__.rsplit('.')[-1], "Column position does not exists ") for x in range(0, len(streams)): if x is 0: execs[0] = ((v[cols], (0,) + v) for v in execs[0]) elif x is 1: execs[1] = ((v[cols], (1,) + v) for v in execs[1]) elif x is 2: execs[2] = ((v[cols], (2,) + v) for v in execs[2]) elif x is 3: execs[3] = ((v[cols], (3,) + v) for v in execs[3]) elif x is 4: execs[4] = ((v[cols], (4,) + v) for v in execs[4]) try: yield list(cursors[0].getdescriptionsafe()) except StopIteration: try: raise finally: try: for cur in cursors: cur.close() except: pass currentgroup = None lists = [[]] * len(streams) for k, v in heapq.merge(*execs): if currentgroup is None or currentgroup != k: unionset = set().union(*lists[1:]) for t in (set(lists[0]) - unionset): yield t lists = [[]] * len(streams) lists[v[0]] = lists[v[0]] + [tuple(v[1:])] currentgroup = k unionset = set().union(*lists[1:]) for t in list(set(lists[0]) - unionset): yield t def Source(): return vtbase.VTGenerator(StreamExcept) if not ('.' in __name__): """ This is needed to be able to test the function, put it at the end of every new function you create """ import sys from functions import * testfunction() if __name__ == "__main__": reload(sys) sys.setdefaultencoding('utf-8') import doctest doctest.testmod()
madgik/exareme
Exareme-Docker/src/exareme/exareme-tools/madis/src/functions/vtable/streamexcept.py
Python
mit
3,449
package com.helpsumo.api.ticketing.ticket.Adapter; import android.content.Context; import android.content.Intent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; import com.helpsumo.api.ticketing.R; import com.helpsumo.api.ticketing.ticket.Activities.ViewTicket; import com.helpsumo.api.ticketing.ticket.ClassObjects.TicketObject; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.Locale; public class ListAdapter extends BaseAdapter { Context context; ArrayList<TicketObject> list = new ArrayList<TicketObject>(); TextView user, status, message, date, staff; public ListAdapter(Context ctx, ArrayList<TicketObject> objects) { context = ctx; this.list = objects; } @Override public int getCount() { return list.size(); } @Override public Object getItem(int position) { return this.list.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(final int position, View convertView, ViewGroup parent) { if (convertView == null) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.ticket_list_row, parent, false); } status = (TextView) convertView.findViewById(R.id.status); user = (TextView) convertView.findViewById(R.id.user); message = (TextView) convertView.findViewById(R.id.message); date = (TextView) convertView.findViewById(R.id.reportdate); staff = (TextView) convertView.findViewById(R.id.staffname); user.setVisibility(View.GONE); message.setText(list.get(position).getMessage()); String data= list.get(position).getDate(); DateFormat df = new SimpleDateFormat("MMM d, yyyy HH:mm", Locale.ENGLISH); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss",Locale.ENGLISH); Date startDate; String newDateString = ""; try { startDate = sdf.parse(data); newDateString = df.format(startDate); } catch (ParseException e) { e.printStackTrace(); } date.setText("on "+newDateString); staff.setText("Assigned to: "+list.get(position).getStaffname()); String statu = list.get(position).getStatus(); if (statu.equals("1")) { status.setText("New"); } else if (statu.equals("like")) { status.setText("Open"); } else if (statu.equals("3")) { status.setText("Progress"); } else if (statu.equals("4")) { status.setText("Fixed"); } else if (statu.equals("5")) { status.setText("Closed"); } else if (statu.equals("6")) { status.setText("Archive"); } final String id = list.get(position).getTicketId(); convertView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { Intent i = new Intent(context, ViewTicket.class); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.putExtra("TicketId", id); context.startActivity(i); } catch (Exception e) { e.printStackTrace(); } } }); return convertView; } }
HelpSumo/HelpSumo-Android
src/main/java/com/helpsumo/api/ticketing/ticket/Adapter/ListAdapter.java
Java
mit
3,697
var mongoose = require('mongoose'); var Schema = mongoose.Schema; var schema = new Schema({ name: { type: String, required: true }, position: { type: String }, marketValue: { type: Number }, jerseyNumber: { type: Number }, dateOfBirth: { type: Date }, contractedUntil: { type: Date }, club_id: { type: Schema.Types.ObjectId, ref: 'Club' }, nation_name: { type: String, ref: 'Nation' }, attributes: { physical: { Acceleration: { type: Number }, Agility: { type: Number }, Balance: { type: Number }, JumpingReach: { type: Number }, NaturalFitness: { type: Number }, Pace: { type: Number }, Stamina: { type: Number }, Strength: { type: Number }, GoalkeeperRating:{ type: Number } }, mental: { Aggression: { type: Number }, Anticipation: { type: Number }, Bravery: { type: Number }, Composure: { type: Number }, Concentration: { type: Number }, Decision: { type: Number }, Determination: { type: Number }, Flair: { type: Number }, Leadership: { type: Number }, OfftheBall: { type: Number }, Positioning: { type: Number }, Teamwork: { type: Number }, Vision: { type: Number }, WorkRate:{ type: Number } }, technical: { Crossing: { type: Number }, Dribbling: { type: Number }, Finishing: { type: Number }, FirstTouch: { type: Number }, FreeKickTaking: { type: Number }, Heading: { type: Number }, LongShots: { type: Number }, LongThrows: { type: Number }, Marking: { type: Number }, Passing: { type: Number }, PenaltyTaking: { type: Number }, Tackling: { type: Number }, Technique:{ type: Number } } } }) module.exports = mongoose.model('Player', schema);
demirdagemir/falsenine
models/player.js
JavaScript
mit
1,812
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using OxyPlot; namespace MouseTester { using System.Drawing; using System.Drawing.Imaging; using OxyPlot.WindowsForms; using OxyPlot.Annotations; using OxyPlot.Axes; using OxyPlot.Series; public partial class MousePlot : Form { private MouseLog mlog; private int last_start; private int last_end; double x_min; double x_max; double y_min; double y_max; private string xlabel = ""; private string ylabel = ""; public MousePlot(MouseLog Mlog) { InitializeComponent(); this.mlog = new MouseLog(); this.mlog.Desc = Mlog.Desc; this.mlog.Cpi = Mlog.Cpi; int i = 1; int x = Mlog.Events[0].lastx; int y = Mlog.Events[0].lasty; ushort buttonflags = Mlog.Events[0].buttonflags; double ts = Mlog.Events[0].ts; while (i < Mlog.Events.Count) { this.mlog.Add(new MouseEvent(buttonflags, x, y, ts)); x = Mlog.Events[i].lastx; y = Mlog.Events[i].lasty; buttonflags = Mlog.Events[i].buttonflags; ts = Mlog.Events[i].ts; i++; } this.mlog.Add(new MouseEvent(buttonflags, x, y, ts)); this.last_start = 0; this.last_end = this.mlog.Events.Count - 1; initialize_plot(); this.comboBoxPlotType.SelectedIndex = 0; this.comboBoxPlotType.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged); this.numericUpDownStart.Minimum = 0; this.numericUpDownStart.Maximum = this.mlog.Events.Count - 1; this.numericUpDownStart.Value = last_start; this.numericUpDownStart.ValueChanged += new System.EventHandler(this.numericUpDownStart_ValueChanged); this.numericUpDownEnd.Minimum = 0; this.numericUpDownEnd.Maximum = this.mlog.Events.Count - 1; this.numericUpDownEnd.Value = last_end; this.numericUpDownEnd.ValueChanged += new System.EventHandler(this.numericUpDownEnd_ValueChanged); this.checkBoxStem.Checked = false; this.checkBoxStem.CheckedChanged += new System.EventHandler(this.checkBoxStem_CheckedChanged); this.checkBoxLines.Checked = false; this.checkBoxLines.CheckedChanged += new System.EventHandler(this.checkBoxLines_CheckedChanged); refresh_plot(); } private void initialize_plot() { var pm = new PlotModel(this.mlog.Desc.ToString()) { PlotType = PlotType.Cartesian, Background = OxyColors.White, Subtitle = this.mlog.Cpi.ToString() + " cpi" }; plot1.Model = pm; } private void refresh_plot() { PlotModel pm = plot1.Model; pm.Series.Clear(); pm.Axes.Clear(); OxyColor singleLineColor = OxyColors.Green; var scatterSeries1 = new ScatterSeries { BinSize = 8, MarkerFill = OxyColors.Blue, MarkerSize = 1.5, MarkerStroke = OxyColors.Blue, MarkerStrokeThickness = 1.0, MarkerType = MarkerType.Circle }; var scatterSeries2 = new ScatterSeries { BinSize = 8, MarkerFill = OxyColors.Red, MarkerSize = 1.5, MarkerStroke = OxyColors.Red, MarkerStrokeThickness = 1.0, MarkerType = MarkerType.Circle }; var lineSeries1 = new LineSeries { Color = OxyColors.Blue, LineStyle = LineStyle.Solid, StrokeThickness = 2.0, Smooth = true }; var lineSeries2 = new LineSeries { Color = OxyColors.Red, LineStyle = LineStyle.Solid, StrokeThickness = 2.0, Smooth = true }; if (checkBoxLines.Checked) { lineSeries1.Smooth = false; lineSeries2.Smooth = false; } var stemSeries1 = new StemSeries { Color = OxyColors.Blue, StrokeThickness = 1.0, }; var stemSeries2 = new StemSeries { Color = OxyColors.Red, StrokeThickness = 1.0 }; if (comboBoxPlotType.Text.Contains("xyCount")) { plot_xycounts_vs_time(scatterSeries1, scatterSeries2, stemSeries1, stemSeries2, lineSeries1, lineSeries2); pm.Series.Add(scatterSeries1); pm.Series.Add(scatterSeries2); if (!checkBoxLines.Checked) { plot_fit(scatterSeries1, lineSeries1); plot_fit(scatterSeries2, lineSeries2); } pm.Series.Add(lineSeries1); pm.Series.Add(lineSeries2); if (checkBoxStem.Checked) { pm.Series.Add(stemSeries1); pm.Series.Add(stemSeries2); } } else if (comboBoxPlotType.Text.Contains("xCount")) { plot_xcounts_vs_time(scatterSeries1, stemSeries1, lineSeries1); pm.Series.Add(scatterSeries1); if (!checkBoxLines.Checked) { plot_fit(scatterSeries1, lineSeries1); lineSeries1.Color = singleLineColor; } pm.Series.Add(lineSeries1); if (checkBoxStem.Checked) { pm.Series.Add(stemSeries1); } } else if (comboBoxPlotType.Text.Contains("yCount")) { plot_ycounts_vs_time(scatterSeries1, stemSeries1, lineSeries1); pm.Series.Add(scatterSeries1); if (!checkBoxLines.Checked) { plot_fit(scatterSeries1, lineSeries1); lineSeries1.Color = singleLineColor; } pm.Series.Add(lineSeries1); if (checkBoxStem.Checked) { pm.Series.Add(stemSeries1); } } else if (comboBoxPlotType.Text.Contains("Interval")) { plot_interval_vs_time(scatterSeries1, stemSeries1, lineSeries1); pm.Series.Add(scatterSeries1); if (!checkBoxLines.Checked) { plot_fit(scatterSeries1, lineSeries1); lineSeries1.Color = singleLineColor; } pm.Series.Add(lineSeries1); if (checkBoxStem.Checked) { pm.Series.Add(stemSeries1); } } else if (comboBoxPlotType.Text.Contains("xyVelocity")) { plot_xyvelocity_vs_time(scatterSeries1, scatterSeries2, stemSeries1, stemSeries2, lineSeries1, lineSeries2); pm.Series.Add(scatterSeries1); pm.Series.Add(scatterSeries2); if (!checkBoxLines.Checked) { plot_fit(scatterSeries1, lineSeries1); plot_fit(scatterSeries2, lineSeries2); } pm.Series.Add(lineSeries1); pm.Series.Add(lineSeries2); if (checkBoxStem.Checked) { pm.Series.Add(stemSeries1); pm.Series.Add(stemSeries2); } } else if (comboBoxPlotType.Text.Contains("xVelocity")) { plot_xvelocity_vs_time(scatterSeries1, stemSeries1, lineSeries1); pm.Series.Add(scatterSeries1); if (!checkBoxLines.Checked) { plot_fit(scatterSeries1, lineSeries1); lineSeries1.Color = singleLineColor; } pm.Series.Add(lineSeries1); if (checkBoxStem.Checked) { pm.Series.Add(stemSeries1); } } else if (comboBoxPlotType.Text.Contains("yVelocity")) { plot_yvelocity_vs_time(scatterSeries1, stemSeries1, lineSeries1); pm.Series.Add(scatterSeries1); if (!checkBoxLines.Checked) { plot_fit(scatterSeries1, lineSeries1); lineSeries1.Color = singleLineColor; } pm.Series.Add(lineSeries1); if (checkBoxStem.Checked) { pm.Series.Add(stemSeries1); } } else if (comboBoxPlotType.Text.Contains("X vs. Y")) { plot_x_vs_y(scatterSeries1, lineSeries1); pm.Series.Add(scatterSeries1); if (checkBoxLines.Checked) { pm.Series.Add(lineSeries1); lineSeries1.Color = singleLineColor; } } var linearAxis1 = new LinearAxis(); linearAxis1.AbsoluteMinimum = x_min - (x_max - x_min) / 20.0; linearAxis1.AbsoluteMaximum = x_max + (x_max - x_min) / 20.0; linearAxis1.MajorGridlineColor = OxyColor.FromArgb(40, 0, 0, 139); linearAxis1.MajorGridlineStyle = LineStyle.Solid; linearAxis1.MinorGridlineColor = OxyColor.FromArgb(20, 0, 0, 139); linearAxis1.MinorGridlineStyle = LineStyle.Solid; linearAxis1.Position = AxisPosition.Bottom; linearAxis1.Title = xlabel; pm.Axes.Add(linearAxis1); var linearAxis2 = new LinearAxis(); linearAxis2.AbsoluteMinimum = y_min - (y_max - y_min) / 20.0; linearAxis2.AbsoluteMaximum = y_max + (y_max - y_min) / 20.0; linearAxis2.MajorGridlineColor = OxyColor.FromArgb(40, 0, 0, 139); linearAxis2.MajorGridlineStyle = LineStyle.Solid; linearAxis2.MinorGridlineColor = OxyColor.FromArgb(20, 0, 0, 139); linearAxis2.MinorGridlineStyle = LineStyle.Solid; linearAxis2.Title = ylabel; pm.Axes.Add(linearAxis2); plot1.RefreshPlot(true); } private void reset_minmax() { x_min = double.MaxValue; x_max = double.MinValue; y_min = double.MaxValue; y_max = double.MinValue; } private void update_minmax(double x, double y) { if (x < x_min) { x_min = x; } if (x > x_max) { x_max = x; } if (y < y_min) { y_min = y; } if (y > y_max) { y_max = y; } } private void plot_xcounts_vs_time(ScatterSeries scatterSeries1, StemSeries stemSeries1, LineSeries lineSeries1) { xlabel = "Time (ms)"; ylabel = "xCounts"; reset_minmax(); for (int i = last_start; i <= last_end; i++) { double x = this.mlog.Events[i].ts; double y = this.mlog.Events[i].lastx; update_minmax(x, y); scatterSeries1.Points.Add(new ScatterPoint(x, y)); lineSeries1.Points.Add(new DataPoint(x, y)); stemSeries1.Points.Add(new DataPoint(x, y)); } } private void plot_ycounts_vs_time(ScatterSeries scatterSeries1, StemSeries stemSeries1, LineSeries lineSeries1) { xlabel = "Time (ms)"; ylabel = "yCounts"; reset_minmax(); for (int i = last_start; i <= last_end; i++) { double x = this.mlog.Events[i].ts; double y = this.mlog.Events[i].lasty; update_minmax(x, y); scatterSeries1.Points.Add(new ScatterPoint(x, y)); lineSeries1.Points.Add(new DataPoint(x, y)); stemSeries1.Points.Add(new DataPoint(x, y)); } } private void plot_xycounts_vs_time(ScatterSeries scatterSeries1, ScatterSeries scatterSeries2, StemSeries stemSeries1, StemSeries stemSeries2, LineSeries lineSeries1, LineSeries lineSeries2) { xlabel = "Time (ms)"; ylabel = "Counts [x = Blue, y = Red]"; reset_minmax(); for (int i = last_start; i <= last_end; i++) { double x = this.mlog.Events[i].ts; double y = this.mlog.Events[i].lastx; update_minmax(x, y); scatterSeries1.Points.Add(new ScatterPoint(x, y)); lineSeries1.Points.Add(new DataPoint(x, y)); stemSeries1.Points.Add(new DataPoint(x, y)); } for (int i = last_start; i <= last_end; i++) { double x = this.mlog.Events[i].ts; double y = this.mlog.Events[i].lasty; update_minmax(x, y); scatterSeries2.Points.Add(new ScatterPoint(x, y)); lineSeries2.Points.Add(new DataPoint(x, y)); stemSeries2.Points.Add(new DataPoint(x, y)); } } private void plot_interval_vs_time(ScatterSeries scatterSeries1, StemSeries stemSeries1, LineSeries lineSeries1) { xlabel = "Time (ms)"; ylabel = "Update Time (ms)"; reset_minmax(); for (int i = last_start; i <= last_end; i++) { double x = this.mlog.Events[i].ts; double y; if (i == 0) { y = 0.0; } else { y = this.mlog.Events[i].ts - this.mlog.Events[i - 1].ts; } update_minmax(x, y); scatterSeries1.Points.Add(new ScatterPoint(x, y)); lineSeries1.Points.Add(new DataPoint(x, y)); stemSeries1.Points.Add(new DataPoint(x, y)); } } private void plot_xvelocity_vs_time(ScatterSeries scatterSeries1, StemSeries stemSeries1, LineSeries lineSeries1) { xlabel = "Time (ms)"; ylabel = "xVelocity (m/s)"; reset_minmax(); if (this.mlog.Cpi > 0) { for (int i = last_start; i <= last_end; i++) { double x = this.mlog.Events[i].ts; double y; if (i == 0) { y = 0.0; } else { y = (this.mlog.Events[i].lastx) / (this.mlog.Events[i].ts - this.mlog.Events[i - 1].ts) / this.mlog.Cpi * 25.4; } update_minmax(x, y); scatterSeries1.Points.Add(new ScatterPoint(x, y)); lineSeries1.Points.Add(new DataPoint(x, y)); stemSeries1.Points.Add(new DataPoint(x, y)); } } else { MessageBox.Show("CPI value is invalid, please run Measure"); } } private void plot_yvelocity_vs_time(ScatterSeries scatterSeries1, StemSeries stemSeries1, LineSeries lineSeries1) { xlabel = "Time (ms)"; ylabel = "yVelocity (m/s)"; reset_minmax(); if (this.mlog.Cpi > 0) { for (int i = last_start; i <= last_end; i++) { double x = this.mlog.Events[i].ts; double y; if (i == 0) { y = 0.0; } else { y = (this.mlog.Events[i].lasty) / (this.mlog.Events[i].ts - this.mlog.Events[i - 1].ts) / this.mlog.Cpi * 25.4; } update_minmax(x, y); scatterSeries1.Points.Add(new ScatterPoint(x, y)); lineSeries1.Points.Add(new DataPoint(x, y)); stemSeries1.Points.Add(new DataPoint(x, y)); } } else { MessageBox.Show("CPI value is invalid, please run Measure"); } } private void plot_xyvelocity_vs_time(ScatterSeries scatterSeries1, ScatterSeries scatterSeries2, StemSeries stemSeries1, StemSeries stemSeries2, LineSeries lineSeries1, LineSeries lineSeries2) { xlabel = "Time (ms)"; ylabel = "Velocity (m/s) [x = Blue, y = Red]"; reset_minmax(); if (this.mlog.Cpi > 0) { for (int i = last_start; i <= last_end; i++) { double x = this.mlog.Events[i].ts; double y; if (i == 0) { y = 0.0; } else { y = (this.mlog.Events[i].lastx) / (this.mlog.Events[i].ts - this.mlog.Events[i - 1].ts) / this.mlog.Cpi * 25.4; } update_minmax(x, y); scatterSeries1.Points.Add(new ScatterPoint(x, y)); lineSeries1.Points.Add(new DataPoint(x, y)); stemSeries1.Points.Add(new DataPoint(x, y)); } for (int i = last_start; i <= last_end; i++) { double x = this.mlog.Events[i].ts; double y; if (i == 0) { y = 0.0; } else { y = (this.mlog.Events[i].lasty) / (this.mlog.Events[i].ts - this.mlog.Events[i - 1].ts) / this.mlog.Cpi * 25.4; } update_minmax(x, y); scatterSeries2.Points.Add(new ScatterPoint(x, y)); lineSeries2.Points.Add(new DataPoint(x, y)); stemSeries2.Points.Add(new DataPoint(x, y)); } } else { MessageBox.Show("CPI value is invalid, please run Measure"); } } private void plot_x_vs_y(ScatterSeries scatterSeries1, LineSeries lineSeries1) { xlabel = "xCounts"; ylabel = "yCounts"; reset_minmax(); double x = 0.0; double y = 0.0; for (int i = last_start; i <= last_end; i++) { x += this.mlog.Events[i].lastx; y += this.mlog.Events[i].lasty; update_minmax(x, x); update_minmax(y, y); scatterSeries1.Points.Add(new ScatterPoint(x, y)); lineSeries1.Points.Add(new DataPoint(x, y)); } } #if false // Window based smoothing private void plot_fit(ScatterSeries scatterSeries1, LineSeries lineSeries1) { double sum = 0.0; lineSeries1.Points.Clear(); for (int i = 0; ((i < 8) && (i < scatterSeries1.Points.Count)); i++) //for (int i = 0; ((i < 4) && (i < scatterSeries1.Points.Count)); i++) { sum = sum + scatterSeries1.Points[i].Y; } for (int i = 3; i < scatterSeries1.Points.Count - 5; i++) //for (int i = 1; i < scatterSeries1.Points.Count - 3; i++) { double x = (scatterSeries1.Points[i].X + scatterSeries1.Points[i + 1].X) / 2.0; double y = sum; lineSeries1.Points.Add(new DataPoint(x, y / 8.0)); sum = sum - scatterSeries1.Points[i - 3].Y; sum = sum + scatterSeries1.Points[i + 5].Y; //lineSeries1.Points.Add(new DataPoint(x, y / 4.0)); //sum = sum - scatterSeries1.Points[i - 1].Y; //sum = sum + scatterSeries1.Points[i + 3].Y; } } #else // Time based smoothing private void plot_fit(ScatterSeries scatterSeries1, LineSeries lineSeries1) { double hz = 125; double ms = 1000.0 / hz; lineSeries1.Points.Clear(); int ind = 0; for (double x = ms; x <= scatterSeries1.Points[scatterSeries1.Points.Count - 1].X; x += ms) { double sum = 0.0; int count = 0; while (scatterSeries1.Points[ind].X <= x) { sum += scatterSeries1.Points[ind++].Y; count++; } lineSeries1.Points.Add(new DataPoint(x - (ms / 2.0), sum / count)); } } #endif private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { refresh_plot(); } private void numericUpDownStart_ValueChanged(object sender, EventArgs e) { if (numericUpDownStart.Value >= numericUpDownEnd.Value) { numericUpDownStart.Value = last_start; } else { last_start = (int)numericUpDownStart.Value; refresh_plot(); } } private void numericUpDownEnd_ValueChanged(object sender, EventArgs e) { if (numericUpDownEnd.Value <= numericUpDownStart.Value) { numericUpDownEnd.Value = last_end; } else { last_end = (int)numericUpDownEnd.Value; refresh_plot(); } } private void checkBoxStem_CheckedChanged(object sender, EventArgs e) { refresh_plot(); } private void checkBoxLines_CheckedChanged(object sender, EventArgs e) { refresh_plot(); } private void buttonSavePNG_Click(object sender, EventArgs e) { SaveFileDialog saveFileDialog1 = new SaveFileDialog(); saveFileDialog1.Filter = "PNG Files (*.png)|*.png"; saveFileDialog1.FilterIndex = 1; if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { MousePlot.Export(this.plot1.Model, saveFileDialog1.FileName, 800, 600); } } public static void Export(PlotModel model, string fileName, int width, int height, Brush background = null) { using (var bm = new Bitmap(width, height)) { using (Graphics g = Graphics.FromImage(bm)) { if (background != null) { g.FillRectangle(background, 0, 0, width, height); } var rc = new GraphicsRenderContext { RendersToScreen = false }; rc.SetGraphicsTarget(g); model.Update(); model.Render(rc, width, height); bm.Save(fileName, ImageFormat.Png); } } } } }
microe1/MouseTester
MouseTester/MouseTester/MousePlot.cs
C#
mit
24,156
package be.ordina.jworks.rpsls.controller; import be.ordina.jworks.rpsls.game.*; import be.ordina.jworks.rpsls.game.pubsub.ChatEventPublisher; import be.ordina.jworks.rpsls.game.pubsub.GameEventPublisher; import be.ordina.jworks.rpsls.game.websocket.ChatMessage; import be.ordina.jworks.rpsls.game.websocket.GameMessage; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.messaging.handler.annotation.MessageMapping; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.security.Principal; import java.time.LocalDateTime; import java.util.Collections; import java.util.List; import java.util.Optional; import java.util.stream.Collectors; import static org.springframework.util.Assert.notNull; @Slf4j @RestController public class GameController { private final GameRepository gameRepository; private final GameLogic gameLogic; private final ChatEventPublisher chatEventPublisher; private final GameEventPublisher gameEventPublisher; @Autowired public GameController(final GameRepository gameRepository, final GameLogic gameLogic, ChatEventPublisher chatEventPublisher, final GameEventPublisher gameEventPublisher) { this.gameRepository = gameRepository; this.gameLogic = gameLogic; this.chatEventPublisher = chatEventPublisher; this.gameEventPublisher = gameEventPublisher; } @RequestMapping("/game/player") public Player getPlayer() { return (Player) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); } @MessageMapping("/chat") public void chat(final ChatMessage chatMessage, final Principal principal) throws Exception { log.info("Chat >> [{}] >> [{}]", principal.getName(), chatMessage.getMessage()); ChatMessage message = ChatMessage.builder() .message(chatMessage.getMessage()) .username(principal.getName()) .build(); this.chatEventPublisher.publish(message); } @MessageMapping("/game") public void event(final GameMessage gameMessage, final Principal principal) throws Exception { log.info("Player [{}] >> [{}]", principal.getName(), gameMessage.getEvent()); switch (gameMessage.getEvent()) { case PLAYER_ONE_JOINED: publish(playerOneJoined(principal.getName(), gameMessage)); break; case PLAYER_ONE_LIZARD: case PLAYER_ONE_PAPER: case PLAYER_ONE_ROCK: case PLAYER_ONE_SCISSORS: case PLAYER_ONE_SPOCK: publish(playerOneMoved(principal.getName(), gameMessage)); break; case PLAYER_TWO_JOINED: publish(playerTwoJoined(principal.getName(), gameMessage)); break; case PLAYER_TWO_LIZARD: case PLAYER_TWO_PAPER: case PLAYER_TWO_ROCK: case PLAYER_TWO_SCISSORS: case PLAYER_TWO_SPOCK: publish(playerTwoMoved(principal.getName(), gameMessage)); break; case SPECTATOR_JOINED: publish(spectatorJoined(principal.getName(), gameMessage)); break; default: throw new IllegalStateException("GameEvent [" + gameMessage.getEvent() + "] is not allowed!"); } } private void publish(final GameMessage gameMessage) { this.gameEventPublisher.publish(gameMessage); } private GameMessage playerOneJoined(final String username, final GameMessage gameMessage) { Optional<Game> latestGame = findLatestGame(); if (latestGame.isPresent()) { Game latestGameInRepo = latestGame.get(); if (latestGameInRepo.getEnd() == null) { throw new IllegalStateException("Game [" + latestGameInRepo.getId() + "] has already started"); } } Game game = this.gameRepository.save( Game.builder() .playerOne(username) .playerOneImage(gameMessage.getImage()) .start(LocalDateTime.now()) .build()); log.info("Game [{}] >> [{}] >> JOINED (P1)", game.getId(), username); return GameMessage.of(gameMessage).game(game).build(); } private GameMessage playerTwoJoined(final String username, final GameMessage gameMessage) { notNull(gameMessage.getGame(), "Game object should at least contain the Game ID"); Game currentGame = findRequiredGame(gameMessage.getGame().getId()); if (currentGame.getPlayerOne().equals(username)) { throw new IllegalStateException("GAME [{" + gameMessage.getGame().getId() + "}] cannot be the same as PLAYER_ONE"); } currentGame.setPlayerTwo(username); currentGame.setPlayerTwoImage(gameMessage.getImage()); log.info("Game [{}] >> [{}] >> JOINED (P2)", currentGame.getId(), username); Game game = this.gameRepository.save(currentGame); return GameMessage.of(gameMessage).game(game).build(); } private GameMessage playerOneMoved(final String username, final GameMessage gameMessage) { notNull(gameMessage.getGame(), "Game object should at least contain the Game ID"); Game currentGame = findRequiredGame(gameMessage.getGame().getId()); if (currentGame.getPlayerOne().equals(username)) { currentGame.setPlayerOneMove(gameMessage.getEvent().value()); log.info("Game [{}] >> [{}] >> [{}]", currentGame.getId(), username, gameMessage.getEvent()); currentGame = this.gameRepository.save(currentGame); GameEvent gameEvent = gameLogic.decideWinner(currentGame); currentGame = decideGame(currentGame, gameEvent); return GameMessage.of(gameMessage).event(gameEvent).game(currentGame).build(); } throw new IllegalStateException("Game [{}]: Player [" + username + "] is not PLAYER_ONE and cannot make this move"); } private GameMessage playerTwoMoved(final String username, final GameMessage gameMessage) { notNull(gameMessage.getGame(), "Game object should at least contain the Game ID"); Game currentGame = findRequiredGame(gameMessage.getGame().getId()); if (currentGame.getPlayerTwo().equals(username)) { currentGame.setPlayerTwoMove(gameMessage.getEvent().value()); log.info("Game [{}] >> [{}] >> [{}]", currentGame.getId(), username, gameMessage.getEvent()); currentGame = this.gameRepository.save(currentGame); GameEvent gameEvent = gameLogic.decideWinner(currentGame); currentGame = decideGame(currentGame, gameEvent); return GameMessage.of(gameMessage).event(gameEvent).game(currentGame).build(); } throw new IllegalStateException("Player [" + username + "] is not PLAYER_TWO and cannot make this move!"); } private Game decideGame(Game currentGame, final GameEvent gameEvent) { // don't want to send the moves to the client before both of them moved if (gameEvent == GameEvent.NO_WINNER_YET) { currentGame.setPlayerOneMove(0); currentGame.setPlayerTwoMove(0); } else { currentGame.setEnd(LocalDateTime.now()); currentGame = this.gameRepository.save(currentGame); } return currentGame; } private GameMessage spectatorJoined(final String username, final GameMessage gameMessage) { Optional<Game> latestGame = findLatestGame(); return GameMessage.of(gameMessage).username(username).game(latestGame.isPresent() ? latestGame.get() : null).build(); } private Game findRequiredGame(String id) { Game game = this.gameRepository.findOne(id); if (game == null) { throw new IllegalStateException("Could not find game with ID [" + id + "]"); } return game; } private Optional<Game> findLatestGame() { List<Game> games = this.gameRepository.findAll(); log.debug("Found [{}] games in the Redis repository", games.size()); if (games.isEmpty()) { return Optional.empty(); } List<Game> sortedGames = games.stream() .filter((game -> game != null && game.getId() != null)) .collect(Collectors.toList()); Collections.sort(sortedGames); return sortedGames.isEmpty() ? Optional.empty() : Optional.ofNullable(sortedGames.get(0)); } }
Turbots/SpringOne2016
rock-paper-scissors-lizard-spock/src/main/java/be/ordina/jworks/rpsls/controller/GameController.java
Java
mit
8,774
using System; using System.Runtime.InteropServices; namespace Examples { class Program { [STAThread] static void Main(string[] args) { SolidEdgeFramework.Application application = null; try { // See "Handling 'Application is Busy' and 'Call was Rejected By Callee' errors" topic. OleMessageFilter.Register(); // Attempt to connect to a running instance of Solid Edge. application = (SolidEdgeFramework.Application)Marshal.GetActiveObject("SolidEdge.Application"); var usableWidth = application.UsableWidth; } catch (System.Exception ex) { Console.WriteLine(ex); } finally { OleMessageFilter.Unregister(); } } } }
SolidEdgeCommunity/docs
docfx_project/snippets/SolidEdgeFramework.Application.UsableWidth.cs
C#
mit
895
"use strict"; const filterable = require("@lerna/filter-options"); /** * @see https://github.com/yargs/yargs/blob/master/docs/advanced.md#providing-a-command-module */ exports.command = "bootstrap"; exports.describe = "Link local packages together and install remaining package dependencies"; exports.builder = yargs => { yargs .example( "$0 bootstrap -- --no-optional", "# execute `npm install --no-optional` in bootstrapped packages" ) .parserConfiguration({ "populate--": true, }) .options({ hoist: { group: "Command Options:", describe: "Install external dependencies matching [glob] to the repo root", defaultDescription: "'**'", }, nohoist: { group: "Command Options:", describe: "Don't hoist external dependencies matching [glob] to the repo root", type: "string", requiresArg: true, }, mutex: { hidden: true, // untyped and hidden on purpose }, "ignore-prepublish": { group: "Command Options:", describe: "Don't run prepublish lifecycle scripts in bootstrapped packages.", type: "boolean", }, "ignore-scripts": { group: "Command Options:", describe: "Don't run _any_ lifecycle scripts in bootstrapped packages", type: "boolean", }, "npm-client": { group: "Command Options:", describe: "Executable used to install dependencies (npm, yarn, pnpm, ...)", type: "string", requiresArg: true, }, registry: { group: "Command Options:", describe: "Use the specified registry for all npm client operations.", type: "string", requiresArg: true, }, strict: { group: "Command Options:", describe: "Don't allow warnings when hoisting as it causes longer bootstrap times and other issues.", type: "boolean", }, "use-workspaces": { group: "Command Options:", describe: "Enable integration with Yarn workspaces.", type: "boolean", }, "force-local": { group: "Command Options:", describe: "Force local sibling links regardless of version range match", type: "boolean", }, contents: { group: "Command Options:", describe: "Subdirectory to use as the source of any links. Must apply to ALL packages.", type: "string", defaultDescription: ".", }, }); return filterable(yargs); }; exports.handler = function handler(argv) { return require(".")(argv); };
sebmck/lerna
commands/bootstrap/command.js
JavaScript
mit
2,616
/* * Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license */ ( function() { // Add to collection with DUP examination. // @param {Object} collection // @param {Object} element // @param {Object} database function addSafely( collection, element, database ) { // 1. IE doesn't support customData on text nodes; // 2. Text nodes never get chance to appear twice; if ( !element.is || !element.getCustomData( 'block_processed' ) ) { element.is && CKEDITOR.dom.element.setMarker( database, element, 'block_processed', true ); collection.push( element ); } } // Dialog reused by both 'creatediv' and 'editdiv' commands. // @param {Object} editor // @param {String} command The command name which indicate what the current command is. function divDialog( editor, command ) { // Definition of elements at which div operation should stopped. var divLimitDefinition = ( function() { // Customzie from specialize blockLimit elements var definition = CKEDITOR.tools.extend( {}, CKEDITOR.dtd.$blockLimit ); if ( editor.config.div_wrapTable ) { delete definition.td; delete definition.th; } return definition; } )(); // DTD of 'div' element var dtd = CKEDITOR.dtd.div; // Get the first div limit element on the element's path. // @param {Object} element function getDivContainer( element ) { var container = editor.elementPath( element ).blockLimit; // Never consider read-only (i.e. contenteditable=false) element as // a first div limit (https://dev.ckeditor.com/ticket/11083). if ( container.isReadOnly() ) container = container.getParent(); // Dont stop at 'td' and 'th' when div should wrap entire table. if ( editor.config.div_wrapTable && container.is( [ 'td', 'th' ] ) ) { var parentPath = editor.elementPath( container.getParent() ); container = parentPath.blockLimit; } return container; } // Init all fields' setup/commit function. // @memberof divDialog function setupFields() { this.foreach( function( field ) { // Exclude layout container elements if ( /^(?!vbox|hbox)/.test( field.type ) ) { if ( !field.setup ) { // Read the dialog fields values from the specified // element attributes. field.setup = function( element ) { field.setValue( element.getAttribute( field.id ) || '', 1 ); }; } if ( !field.commit ) { // Set element attributes assigned by the dialog // fields. field.commit = function( element ) { var fieldValue = this.getValue(); // ignore default element attribute values if ( field.id == 'dir' && element.getComputedStyle( 'direction' ) == fieldValue ) { return; } if ( fieldValue ) element.setAttribute( field.id, fieldValue ); else element.removeAttribute( field.id ); }; } } } ); } // Wrapping 'div' element around appropriate blocks among the selected ranges. // @param {Object} editor function createDiv( editor ) { // new adding containers OR detected pre-existed containers. var containers = []; // node markers store. var database = {}; // All block level elements which contained by the ranges. var containedBlocks = [], block; // Get all ranges from the selection. var selection = editor.getSelection(), ranges = selection.getRanges(); var bookmarks = selection.createBookmarks(); var i, iterator; // collect all included elements from dom-iterator for ( i = 0; i < ranges.length; i++ ) { iterator = ranges[ i ].createIterator(); while ( ( block = iterator.getNextParagraph() ) ) { // include contents of blockLimit elements. if ( block.getName() in divLimitDefinition && !block.isReadOnly() ) { var j, childNodes = block.getChildren(); for ( j = 0; j < childNodes.count(); j++ ) addSafely( containedBlocks, childNodes.getItem( j ), database ); } else { while ( !dtd[ block.getName() ] && !block.equals( ranges[ i ].root ) ) block = block.getParent(); addSafely( containedBlocks, block, database ); } } } CKEDITOR.dom.element.clearAllMarkers( database ); var blockGroups = groupByDivLimit( containedBlocks ); var ancestor, divElement; for ( i = 0; i < blockGroups.length; i++ ) { // Sometimes we could get empty block group if all elements inside it // don't have parent's nodes (https://dev.ckeditor.com/ticket/13585). if ( !blockGroups[ i ].length ) { continue; } var currentNode = blockGroups[ i ][ 0 ]; // Calculate the common parent node of all contained elements. ancestor = currentNode.getParent(); for ( j = 1; j < blockGroups[ i ].length; j++ ) { ancestor = ancestor.getCommonAncestor( blockGroups[ i ][ j ] ); } // If there is no ancestor, mark editable as one (https://dev.ckeditor.com/ticket/13585). if ( !ancestor ) { ancestor = editor.editable(); } divElement = new CKEDITOR.dom.element( 'div', editor.document ); // Normalize the blocks in each group to a common parent. for ( j = 0; j < blockGroups[ i ].length; j++ ) { currentNode = blockGroups[ i ][ j ]; // Check if the currentNode has a parent before attempting to operate on it (https://dev.ckeditor.com/ticket/13585). while ( currentNode.getParent() && !currentNode.getParent().equals( ancestor ) ) { currentNode = currentNode.getParent(); } // This could introduce some duplicated elements in array. blockGroups[ i ][ j ] = currentNode; } // Wrapped blocks counting for ( j = 0; j < blockGroups[ i ].length; j++ ) { currentNode = blockGroups[ i ][ j ]; // Avoid DUP elements introduced by grouping. if ( !( currentNode.getCustomData && currentNode.getCustomData( 'block_processed' ) ) ) { currentNode.is && CKEDITOR.dom.element.setMarker( database, currentNode, 'block_processed', true ); // Establish new container, wrapping all elements in this group. if ( !j ) { divElement.insertBefore( currentNode ); } divElement.append( currentNode ); } } CKEDITOR.dom.element.clearAllMarkers( database ); containers.push( divElement ); } selection.selectBookmarks( bookmarks ); return containers; } // Divide a set of nodes to different groups by their path's blocklimit element. // Note: the specified nodes should be in source order naturally, which mean they are supposed to producea by following class: // * CKEDITOR.dom.range.Iterator // * CKEDITOR.dom.domWalker // @returns {Array[]} the grouped nodes function groupByDivLimit( nodes ) { var groups = [], lastDivLimit = null, block; for ( var i = 0; i < nodes.length; i++ ) { block = nodes[ i ]; var limit = getDivContainer( block ); if ( !limit.equals( lastDivLimit ) ) { lastDivLimit = limit; groups.push( [] ); } // Sometimes we got nodes that are not inside the DOM, which causes error (https://dev.ckeditor.com/ticket/13585). if ( block.getParent() ) { groups[ groups.length - 1 ].push( block ); } } return groups; } // Synchronous field values to other impacted fields is required, e.g. div styles // change should also alter inline-style text. function commitInternally( targetFields ) { var dialog = this.getDialog(), element = dialog._element && dialog._element.clone() || new CKEDITOR.dom.element( 'div', editor.document ); // Commit this field and broadcast to target fields. this.commit( element, true ); targetFields = [].concat( targetFields ); var length = targetFields.length, field; for ( var i = 0; i < length; i++ ) { field = dialog.getContentElement.apply( dialog, targetFields[ i ].split( ':' ) ); field && field.setup && field.setup( element, true ); } } // Registered 'CKEDITOR.style' instances. var styles = {}; // Hold a collection of created block container elements. var containers = []; // @type divDialog return { title: editor.lang.div.title, minWidth: 400, minHeight: 165, contents: [ { id: 'info', label: editor.lang.common.generalTab, title: editor.lang.common.generalTab, elements: [ { type: 'hbox', widths: [ '50%', '50%' ], children: [ { id: 'elementStyle', type: 'select', style: 'width: 100%;', label: editor.lang.div.styleSelectLabel, 'default': '', // Options are loaded dynamically. items: [ [ editor.lang.common.notSet, '' ] ], onChange: function() { commitInternally.call( this, [ 'info:elementStyle', 'info:class', 'advanced:dir', 'advanced:style' ] ); }, setup: function( element ) { for ( var name in styles ) styles[ name ].checkElementRemovable( element, true, editor ) && this.setValue( name, 1 ); }, commit: function( element ) { var styleName; if ( ( styleName = this.getValue() ) ) { var style = styles[ styleName ]; style.applyToObject( element, editor ); } else { element.removeAttribute( 'style' ); } } }, { id: 'class', type: 'text', requiredContent: 'div(cke-xyz)', // Random text like 'xyz' will check if all are allowed. label: editor.lang.common.cssClass, 'default': '' } ] } ] }, { id: 'advanced', label: editor.lang.common.advancedTab, title: editor.lang.common.advancedTab, elements: [ { type: 'vbox', padding: 1, children: [ { type: 'hbox', widths: [ '50%', '50%' ], children: [ { type: 'text', id: 'id', requiredContent: 'div[id]', label: editor.lang.common.id, 'default': '' }, { type: 'text', id: 'lang', requiredContent: 'div[lang]', label: editor.lang.common.langCode, 'default': '' } ] }, { type: 'hbox', children: [ { type: 'text', id: 'style', requiredContent: 'div{cke-xyz}', // Random text like 'xyz' will check if all are allowed. style: 'width: 100%;', label: editor.lang.common.cssStyle, 'default': '', commit: function( element ) { element.setAttribute( 'style', this.getValue() ); } } ] }, { type: 'hbox', children: [ { type: 'text', id: 'title', requiredContent: 'div[title]', style: 'width: 100%;', label: editor.lang.common.advisoryTitle, 'default': '' } ] }, { type: 'select', id: 'dir', requiredContent: 'div[dir]', style: 'width: 100%;', label: editor.lang.common.langDir, 'default': '', items: [ [ editor.lang.common.notSet, '' ], [ editor.lang.common.langDirLtr, 'ltr' ], [ editor.lang.common.langDirRtl, 'rtl' ] ] } ] } ] } ], onLoad: function() { setupFields.call( this ); // Preparing for the 'elementStyle' field. var dialog = this, stylesField = this.getContentElement( 'info', 'elementStyle' ); // Reuse the 'stylescombo' plugin's styles definition. editor.getStylesSet( function( stylesDefinitions ) { var styleName, style; if ( stylesDefinitions ) { // Digg only those styles that apply to 'div'. for ( var i = 0; i < stylesDefinitions.length; i++ ) { var styleDefinition = stylesDefinitions[ i ]; if ( styleDefinition.element && styleDefinition.element == 'div' ) { styleName = styleDefinition.name; styles[ styleName ] = style = new CKEDITOR.style( styleDefinition ); if ( editor.filter.check( style ) ) { // Populate the styles field options with style name. stylesField.items.push( [ styleName, styleName ] ); stylesField.add( styleName, styleName ); } } } } // We should disable the content element // it if no options are available at all. stylesField[ stylesField.items.length > 1 ? 'enable' : 'disable' ](); // Now setup the field value manually if dialog was opened on element. (https://dev.ckeditor.com/ticket/9689) setTimeout( function() { dialog._element && stylesField.setup( dialog._element ); }, 0 ); } ); }, onShow: function() { // Whether always create new container regardless of existed // ones. if ( command == 'editdiv' ) { // Try to discover the containers that already existed in // ranges // update dialog field values this.setupContent( this._element = CKEDITOR.plugins.div.getSurroundDiv( editor ) ); } }, onOk: function() { if ( command == 'editdiv' ) containers = [ this._element ]; else containers = createDiv( editor, true ); // Update elements attributes var size = containers.length; for ( var i = 0; i < size; i++ ) { this.commitContent( containers[ i ] ); // Remove empty 'style' attribute. !containers[ i ].getAttribute( 'style' ) && containers[ i ].removeAttribute( 'style' ); } this.hide(); }, onHide: function() { // Remove style only when editing existing DIV. (https://dev.ckeditor.com/ticket/6315) if ( command == 'editdiv' ) this._element.removeCustomData( 'elementStyle' ); delete this._element; } }; } CKEDITOR.dialog.add( 'creatediv', function( editor ) { return divDialog( editor, 'creatediv' ); } ); CKEDITOR.dialog.add( 'editdiv', function( editor ) { return divDialog( editor, 'editdiv' ); } ); } )(); /** * Whether to wrap the entire table instead of individual cells when creating a `<div>` in a table cell. * * config.div_wrapTable = true; * * @cfg {Boolean} [div_wrapTable=false] * @member CKEDITOR.config */
otto-torino/gino
ckeditor/plugins/div/dialogs/div.js
JavaScript
mit
14,457
import json, logging, os, re, subprocess, shlex from tools import get_category_by_status log = logging.getLogger() meta_files = ['Disassembly', 'Stacktrace', 'Registers', 'SegvAnalysis', 'ProcMaps', "BootLog" , "CoreDump", "BootDmesg", "syslog", "UbiquityDebug.gz", "Casper.gz", "UbiquityPartman.gz", "UbiquityDm.gz", "GdmLog", "XorgLog" "log", "Log"] def get(metadata, bugdir): indicators = {} # look for file arg; this needs work TODO cmdline = None uri = None for line in metadata['description'].splitlines(): if "proccmdline" in line.lower(): cmdline = ":".join(line.split(":")[1:]).strip() try: toks = shlex.split(cmdline) except ValueError as e: log.error("error while parsing cmdline: %s" % cmdline) log.exception(e) continue if len(toks) > 1: if ("//" in toks[-1]) or ("." in toks[-1]): uri = toks[-1].strip() indicators['cmdline'] = cmdline indicators['cmdline_uri'] = uri # look for interesting attachments; ugly interesting_files = [] for f in os.listdir(bugdir): fpath = os.path.join(bugdir, f) if not os.path.isfile(fpath): continue for fn in meta_files: if fn.lower() in f.lower(): break else: # no break in loop above, i.e. still interested out = subprocess.check_output(["file", fpath]) ftype = out.split(":")[-1] if ftype.strip() == "empty": continue for tstr in ["ASCII", "text", "core file"]: if tstr in ftype: break else: # only runs if we didn't break, i.e., this might be interesting interesting_files.append(f) indicators['files'] = interesting_files # TODO: look for recv, etc. in stacks (shoudl this be in exploitability maybe (remote?)) return indicators
jfoote/vulture
vlib/analyzers/reproducibility.py
Python
mit
2,072
// ------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See License.txt in the repo root for license information. // ------------------------------------------------------------ // For more information on enabling Web API for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860 namespace WebService.Controllers { using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.ServiceFabric.Services.Remoting.Client; using StatelessBackendService.Interfaces; using System.Fabric; using System; [Route("api/[controller]")] public class StatelessBackendServiceController : Controller { private readonly ConfigSettings configSettings; private readonly StatelessServiceContext serviceContext; public StatelessBackendServiceController(StatelessServiceContext serviceContext, ConfigSettings settings) { this.serviceContext = serviceContext; this.configSettings = settings; } // GET: api/values [HttpGet] public async Task<IActionResult> GetAsync() { string serviceUri = this.serviceContext.CodePackageActivationContext.ApplicationName + "/" + this.configSettings.StatelessBackendServiceName; IStatelessBackendService proxy = ServiceProxy.Create<IStatelessBackendService>(new Uri(serviceUri)); long result = await proxy.GetCountAsync(); return this.Json(new CountViewModel() { Count = result }); } } }
Azure-Samples/service-fabric-dotnet-getting-started
src/GettingStartedApplication/WebService/Controllers/StatelessBackendServiceController.cs
C#
mit
1,682
// // YYBBConfig.h // YYBBSDK // // Created by Wang_Ruzhou on 2018/9/10. // #import <Foundation/Foundation.h> #import <YYModel/NSObject+YYModel.h> @interface YYBBURL : NSObject @property (nonatomic, copy) NSString *afActivate; @property (nonatomic, copy) NSString *firebaseInitialize; @end @interface YYBBConfig : NSObject<YYModel> @property (nonatomic, copy) NSString *appsFlyerDevKey; @property (nonatomic, copy) NSString *appId; @property (nonatomic, copy) NSString *appKey; @property (nonatomic, copy) NSString *appSecret; @property (nonatomic, copy) NSString *appsFlyerAppId; @property (nonatomic, copy) NSString *baseURL; @property (nonatomic, copy) NSString *channelId; @property (nonatomic, copy) NSString *headerDomainURL; @property (nonatomic, copy) NSArray *iaps; @property (nonatomic, assign) NSInteger orderWay; @property (nonatomic, strong) YYBBURL *url; // 环境配置, 参考YYBBCommonUtilities.h YYBBEnvs @property (nonatomic, strong) NSArray *envs; @property (nonatomic, strong) NSString * appStoreID; @property (nonatomic, strong) NSString * BuglyAppId; @property (nonatomic, strong) NSString * JpushAppKey; @property (nonatomic, strong) NSString * JpushChannel; @property (nonatomic, strong) NSString * WeChatAppId; @property (nonatomic, strong) NSString * WeChatuniversalLink; @property (nonatomic, strong) NSString * WeChatSecret; @property (nonatomic, strong) NSString * QQAppId; @property (nonatomic, strong) NSString * QQSecret; @property (nonatomic, strong) NSString * QQUniversalLink; @property (nonatomic, strong) NSString * UMAppKey; @property (nonatomic, strong) NSString * UMChannel; @property (nonatomic, strong) NSString * PGYAppKey; @property (nonatomic, strong) NSString * themeColor; @property (nonatomic, strong) NSString * themeColor2; // 二维码分享地址 @property (nonatomic, strong) NSString * shareQrcodeStr; + (instancetype)currentConfig; @end
460467069/smzdm
CWSDK/YYBBSDK/Required/YYBBConfig.h
C
mit
1,926
if ( true ) import { a as x } from "./abc"; if ( false ) import { b as y } from "./abc"; if ( true ) export function outer() { import { a as ay } from "./abc"; import { b as bee } from "./abc"; import { c as see } from "./abc"; return [ ay, bee, see ]; } if ( false ) export { x } from "./foo"; x; // Stay as x y; // Stay as y
quase/quasejs
packages/builder/test/babel-modules-fixtures/nested-imports-exports-3/actual.js
JavaScript
mit
338
/** @class <p>Efficient querying of documents containing shapes indexed using the geo_shape type.</p> <p>Much like the geo_shape type, the geo_shape query uses a grid square representation of the query shape to find those documents which have shapes that relate to the query shape in a specified way. In order to do this, the field being queried must be of geo_shape type. The query will use the same PrefixTree configuration as defined for the field.</p> @name ejs.GeoShapeQuery @desc A Query to find documents with a geo_shapes matching a specific shape. */ ejs.GeoShapeQuery = function (field) { /** The internal query object. <code>Use _self()</code> @member ejs.GeoShapeQuery @property {Object} GeoShapeQuery */ var query = { geo_shape: {} }; query.geo_shape[field] = {}; return { /** Sets the field to query against. @member ejs.GeoShapeQuery @param {String} f A valid field name. @returns {Object} returns <code>this</code> so that calls can be chained. */ field: function (f) { var oldValue = query.geo_shape[field]; if (f == null) { return field; } delete query.geo_shape[field]; field = f; query.geo_shape[f] = oldValue; return this; }, /** Sets the shape @member ejs.GeoShapeQuery @param {String} shape A valid <code>Shape</code> object. @returns {Object} returns <code>this</code> so that calls can be chained. */ shape: function (shape) { if (shape == null) { return query.geo_shape[field].shape; } if (query.geo_shape[field].indexed_shape != null) { delete query.geo_shape[field].indexed_shape; } query.geo_shape[field].shape = shape._self(); return this; }, /** Sets the indexed shape. Use this if you already have shape definitions already indexed. @member ejs.GeoShapeQuery @param {String} indexedShape A valid <code>IndexedShape</code> object. @returns {Object} returns <code>this</code> so that calls can be chained. */ indexedShape: function (indexedShape) { if (indexedShape == null) { return query.geo_shape[field].indexed_shape; } if (query.geo_shape[field].shape != null) { delete query.geo_shape[field].shape; } query.geo_shape[field].indexed_shape = indexedShape._self(); return this; }, /** Sets the shape relation type. A relationship between a Query Shape and indexed Shapes that will be used to determine if a Document should be matched or not. Valid values are: intersects, disjoint, and within. @member ejs.GeoShapeQuery @param {String} indexedShape A valid <code>IndexedShape</code> object. @returns {Object} returns <code>this</code> so that calls can be chained. */ relation: function (relation) { if (relation == null) { return query.geo_shape[field].relation; } relation = relation.toLowerCase(); if (relation === 'intersects' || relation === 'disjoint' || relation === 'within') { query.geo_shape[field].relation = relation; } return this; }, /** <p>Sets the spatial strategy.</p> <p>Valid values are:</p> <dl> <dd><code>recursive</code> - default, recursively traverse nodes in the spatial prefix tree. This strategy has support for searching non-point shapes.</dd> <dd><code>term</code> - uses a large TermsFilter on each node in the spatial prefix tree. It only supports the search of indexed Point shapes.</dd> </dl> <p>This is an advanced setting, use with care.</p> @since elasticsearch 0.90 @member ejs.GeoShapeQuery @param {String} strategy The strategy as a string. @returns {Object} returns <code>this</code> so that calls can be chained. */ strategy: function (strategy) { if (strategy == null) { return query.geo_shape[field].strategy; } strategy = strategy.toLowerCase(); if (strategy === 'recursive' || strategy === 'term') { query.geo_shape[field].strategy = strategy; } return this; }, /** Sets the boost value for documents matching the <code>Query</code>. @member ejs.GeoShapeQuery @param {Number} boost A positive <code>double</code> value. @returns {Object} returns <code>this</code> so that calls can be chained. */ boost: function (boost) { if (boost == null) { return query.geo_shape[field].boost; } query.geo_shape[field].boost = boost; return this; }, /** Allows you to serialize this object into a JSON encoded string. @member ejs.GeoShapeQuery @returns {String} returns this object as a serialized JSON string. */ toString: function () { return JSON.stringify(query); }, /** The type of ejs object. For internal use only. @member ejs.GeoShapeQuery @returns {String} the type of object */ _type: function () { return 'query'; }, /** Retrieves the internal <code>query</code> object. This is typically used by internal API functions so use with caution. @member ejs.GeoShapeQuery @returns {String} returns this object's internal <code>query</code> property. */ _self: function () { return query; } }; };
AdrianRossouw/browsr
couch-app/bower_components/elastic.js/src/query/GeoShapeQuery.js
JavaScript
mit
6,233
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import "MMUIViewController.h" @interface MMWebLoginController : MMUIViewController { } - (void)viewDidUnload; - (void)viewDidLoad; - (id)init; - (void)beginScan; - (void)onBack; @end
walkdianzi/DashengHook
WeChat-Headers/MMWebLoginController.h
C
mit
327
package utils; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import model.Pic; import org.apache.log4j.Logger; import org.json.JSONArray; import org.json.JSONObject; import org.noggit.JSONParser; import org.springframework.boot.json.JsonJsonParser; import com.flickr4java.flickr.Flickr; import com.flickr4java.flickr.FlickrException; import com.flickr4java.flickr.REST; import com.flickr4java.flickr.photos.Photo; import com.flickr4java.flickr.photos.PhotoList; import com.flickr4java.flickr.photos.SearchParameters; import com.flickr4java.flickr.util.Base64; import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; import com.mashape.unirest.http.exceptions.UnirestException; import constants.Constants; public class SearchPhoto { private static final Logger logger = Logger.getLogger(SearchPhoto.class); private String nsid; private String username; // private final String sharedSecret; private final Flickr flickr; public SearchPhoto() { flickr = new Flickr(Constants.FLICKER_KEY, Constants.FLICKER_SECRET, new REST()); } public ArrayList<Pic> searchPhotoByText(String text, int numOfImages, double confidence) { SearchParameters searchParameters = new SearchParameters(); searchParameters.setText(text); ArrayList<Pic> result = new ArrayList<>(); try { PhotoList<Photo> list = flickr.getPhotosInterface().search( searchParameters, 0, 0); int i = 0; for (Photo photo : list) { if (i < numOfImages) { result.add(new Pic(photo.getLarge1600Url(), getTagsImagga( photo.getLarge1600Url(), confidence))); } i++; } } catch (FlickrException e) { // TODO Auto-generated catch block e.printStackTrace(); } return result; } private ArrayList<String> getTagsImagga(String url, double confidence) { ArrayList<String> result = new ArrayList<>(); try { HttpResponse<String> response = Unirest .get("http://api.imagga.com/v1/tagging?url=" + url) .header("accept", "application/json") .header("authorization", "Basic "+Constants.IMAGGA_KEY_SECRET_BASE64) .asString(); // result.add(response.getRawBody()); BufferedReader rd = new BufferedReader(new InputStreamReader( response.getRawBody())); StringBuilder content = new StringBuilder(); String line; try { while (null != (line = rd.readLine())) { content.append(line); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } result = getTagsFromJson(content.toString(), confidence); // result.add(content.toString()); } catch (UnirestException e) { // TODO Auto-generated catch block e.printStackTrace(); } return result; } private ArrayList<String> getTagsFromJson(String jsonString, double confidence) { ArrayList<String> tagsPic = new ArrayList<>(); try { JSONObject jsonObject = new JSONObject(jsonString); JSONArray result = (JSONArray) jsonObject.get("results"); JSONObject mainObj = (JSONObject) result.get(0); JSONArray tags = (JSONArray) mainObj.get("tags"); for (int i = 0; i < tags.length(); i++) { double conf = 100; try { conf = (((JSONObject) tags.get(i)) .getDouble("confidence")); } catch (Exception e) { } if (conf > confidence) tagsPic.add(((JSONObject) tags.get(i)).getString("tag")); } } catch (Exception e) { } return tagsPic; } }
rohitguptadev/ImagePlay
src/main/java/utils/SearchPhoto.java
Java
mit
3,508
import hashlib import os import sys if len(sys.argv) < 3: #1 print("You need to specify two directories:") #1 print(sys.argv[0], "<directory 1> <directory 2>") #1 sys.exit() #1 directory1 = sys.argv[1] #2 directory2 = sys.argv[2] #2 print("Comparing:") print(directory1) print(directory2) for directory in [directory1, directory2]: if not os.access(directory, os.F_OK): print(directory, "is not a valid directory!") sys.exit() def md5(file_path): read_file = open(file_path, "rb") the_hash = hashlib.md5() for line in read_file.readlines(): the_hash.update(line) return the_hash.hexdigest() def directory_listing(directory_name): dir_file_list = {} dir_root = None dir_trim = 0 for path, dirs, files in os.walk(directory_name): if dir_root is None: dir_root = path dir_trim = len(dir_root) print("dir", directory_name, end=' ') print("root is", dir_root) trimmed_path = path[dir_trim:] if trimmed_path.startswith(os.path.sep): trimmed_path = trimmed_path[1:] #print "path is", path, " and trimmed_path is", trimmed_path for each_file in files: file_path = os.path.join(trimmed_path, each_file) dir_file_list[file_path] = True return (dir_file_list, dir_root) dir1_file_list, dir1_root = directory_listing(directory1) dir2_file_list, dir2_root = directory_listing(directory2) results = {} for file_path in list(dir2_file_list.keys()): if file_path not in dir1_file_list: results[file_path] = "not found in directory 1" else: #print file_path, "found in directory 1 and 2" file1 = os.path.join(dir1_root, file_path) file2 = os.path.join(dir2_root, file_path) if md5(file1) != md5(file2): results[file_path] = "is different in directory 2" else: results[file_path] = "is the same in both" for file_path, value in list(dir1_file_list.items()): if file_path not in results: results[file_path] = "not found in directory 2" print() for path, result in sorted(results.items()): if os.path.sep not in path and "same" not in result: print(path, result) for path, result in sorted(results.items()): if os.path.sep in path and "same" not in result: print(path, result)
AnthonyBriggs/Python-101
hello_python_source_py3/chapter 03/difference_engine_5_inorder.py
Python
mit
2,533
import React, { Component } from 'react' import { connect } from 'react-redux' import * as actions from '../../actions/auth' import './login.css' import { Container, Grid, Segment, Input, Header, Button, Icon } from 'semantic-ui-react'; const styles = { loginForm: { height: '100%' }, segment: { maxWidth: '450px' }, container: { marginTop: '10px' }, } class Login extends Component { constructor(props) { super(props) this.state = { username: "", password: "", isLoading: false } } handleUserChange(e) { this.setState({ user: e.target.value }); } handlePasswordChange(e) { this.setState({ password: e.target.value }); } toggleLoading() { this.setState({ isLoading: !this.state.isLoading }); } handleSubmit() { this.toggleLoading(); this.props.login(this.state.user, this.state.password,(err,data)=>{ if(err) { this.toggleLoading(); alert(data.msg); } else { this.props.history.push("/dashboard"); } }); } handleKeyPress = (e) => { console.log('Key pressed.'); if(e.key === 'Enter') { this.handleSubmit(); } } componentWillMount() { document.title = "Login"; } renderLogin() { return ( <div style={styles.loginForm}> <Grid textAlign='center' style={{ height: '100%' }} verticalAlign='middle'> <Grid.Column style={styles.segment}> <Segment raised onKeyPress={this.handleKeyPress}> <Header as='h2' color='teal' textAlign='center'> Log-in to your account </Header> <Input onChange={this.handleUserChange.bind(this)} value={this.state.user} fluid icon='user' iconPosition='left' placeholder='Enter your username' /> <br /> <Input onChange={this.handlePasswordChange.bind(this)} value={this.state.password} fluid type='password' icon='lock' iconPosition='left' placeholder='Enter your password' /> <Container textAlign='right' style={styles.container}> <Button animated loading={this.state.isLoading} color='teal' onClick={this.handleSubmit.bind(this)}> <Button.Content visible>Login</Button.Content> <Button.Content hidden> <Icon name='right arrow'/> </Button.Content> </Button> </Container> </Segment> </Grid.Column> </Grid> </div> ) } render() { return ( <div style={styles.loginForm}> {this.renderLogin()} </div> ) } } function mapStateToProps({ auth }) { return { auth } } export default connect(mapStateToProps, actions)(Login);
projectOpenRAP/OpenRAP
devmgmtui/src/components/auth/Login.js
JavaScript
mit
3,749
--- layout: post lang: en permalink: /en/smarthr title: SmartHR description: ' SmartHR was founded on Jan. 23, 2013 and we launched our eponymous service in November of 2015. SmartHR is an HR/Labor SaaS that allows companies to completely digitzalize onboarding paperwork, tax forms, and other labor procedures that have traditionally been all done on paper. By integrating our service with the e-Gov API offered by the Ministry of Internal Affairs and Communications, companies can submit their paperwork entirely online to government offices. As a result, management, HR personnel, and employees are liberated from doing time-consuming and difficult paperwork. In 2018, SmartHR was selected as one of the companies for the J-Startup program, sponsored by the Ministry of Economy, Trade and Industry which aims to create unicorn companies out of Japan. In 2019, we established our first branch office in the Kansai region of Japan.(Hiring) ' description_full: '<p>SmartHR was founded on Jan. 23, 2013 and we launched our eponymous service in November of 2015. SmartHR is an HR/Labor SaaS that allows companies to completely digitzalize onboarding paperwork, tax forms, and other labor procedures that have traditionally been all done on paper. By integrating our service with the e-Gov API offered by the Ministry of Internal Affairs and Communications, companies can submit their paperwork entirely online to government offices. As a result, management, HR personnel, and employees are liberated from doing time-consuming and difficult paperwork. In 2018, SmartHR was selected as one of the companies for the J-Startup program, sponsored by the Ministry of Economy, Trade and Industry which aims to create unicorn companies out of Japan. In 2019, we established our first branch office in the Kansai region of Japan.<a href="https://hello-world.smarthr.co.jp/">(Hiring)</a></p>' categories: link: https://hello-world.smarthr.co.jp/ ---
uiureo/remote-in-japan
docs/en/_posts/2020-02-22-smarthr.md
Markdown
mit
1,949
<!doctype html> <!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]--> <!--[if (IE 7)&!(IEMobile)]><html class="no-js lt-ie9 lt-ie8" lang="en"><![endif]--> <!--[if (IE 8)&!(IEMobile)]><html class="no-js lt-ie9" lang="en"><![endif]--> <!--[if gt IE 8]><!--> <html class="no-js" lang="en"><!--<![endif]--> <head> <meta charset="utf-8"> <title>Complete compliance in coding is an Alice in Wonderland-style fairytale &#8211; The New Dromologue</title> <meta name="description" content="Velocity is all that matters."> <meta name="keywords" content="Interview"> <!-- Twitter Cards --> <meta name="twitter:card" content="summary"> <meta name="twitter:image" content="http://www.dromologue.com/images/"> <meta name="twitter:title" content="Complete compliance in coding is an Alice in Wonderland-style fairytale"> <meta name="twitter:description" content="Velocity is all that matters."> <meta name="twitter:creator" content="@dromologue"> <!-- Open Graph --> <meta property="og:locale" content="en_US"> <meta property="og:type" content="article"> <meta property="og:title" content="Complete compliance in coding is an Alice in Wonderland-style fairytale"> <meta property="og:description" content="Velocity is all that matters."> <meta property="og:url" content="http://www.dromologue.com/devops-summit-complete-compliance-in-coding-is-an/"> <meta property="og:site_name" content="The New Dromologue"> <link rel="canonical" href="http://www.dromologue.com/devops-summit-complete-compliance-in-coding-is-an/"> <link href="http://www.dromologue.com/feed.xml" type="application/atom+xml" rel="alternate" title="The New Dromologue Feed"> <!-- http://t.co/dKP3o1e --> <meta name="HandheldFriendly" content="True"> <meta name="MobileOptimized" content="320"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- For all browsers --> <link rel="stylesheet" href="http://www.dromologue.com/assets/css/main.css"> <!-- Webfonts --> <link href="//fonts.googleapis.com/css?family=Lato:300,400,700,300italic,400italic" rel="stylesheet" type="text/css"> <meta http-equiv="cleartype" content="on"> <!-- Load Modernizr --> <script src="http://www.dromologue.com/assets/js/vendor/modernizr-2.6.2.custom.min.js"></script> <!-- Icons --> <!-- 16x16 --> <link rel="shortcut icon" href="http://www.dromologue.com/favicon.ico"> <!-- 32x32 --> <link rel="shortcut icon" href="http://www.dromologue.com/favicon.png"> <!-- 57x57 (precomposed) for iPhone 3GS, pre-2011 iPod Touch and older Android devices --> <link rel="apple-touch-icon-precomposed" href="http://www.dromologue.com/images/apple-touch-icon-precomposed.png"> <!-- 72x72 (precomposed) for 1st generation iPad, iPad 2 and iPad mini --> <link rel="apple-touch-icon-precomposed" sizes="72x72" href="http://www.dromologue.com/images/apple-touch-icon-72x72-precomposed.png"> <!-- 114x114 (precomposed) for iPhone 4, 4S, 5 and post-2011 iPod Touch --> <link rel="apple-touch-icon-precomposed" sizes="114x114" href="http://www.dromologue.com/images/apple-touch-icon-114x114-precomposed.png"> <!-- 144x144 (precomposed) for iPad 3rd and 4th generation --> <link rel="apple-touch-icon-precomposed" sizes="144x144" href="http://www.dromologue.com/images/apple-touch-icon-144x144-precomposed.png"> </head> <body id="post" > <!--[if lt IE 9]><div class="upgrade"><strong><a href="http://whatbrowser.org/">Your browser is quite old!</strong> Why not upgrade to a different browser to better enjoy this site?</a></div><![endif]--> <nav id="dl-menu" class="dl-menuwrapper" role="navigation"> <button class="dl-trigger">Open Menu</button> <ul class="dl-menu"> <li><a href="http://www.dromologue.com/">Home</a></li> <li> <a href="#">About</a> <ul class="dl-submenu"> <li> <img src="http://www.dromologue.com/images/Justin2.jpg" alt="Justin Arbuckle photo" class="author-photo"> <h4>Justin Arbuckle</h4> <p>CTO, IT Architect, Evangelist, Transformer.</p> </li> <li><a href="http://www.dromologue.com/about/"><span class="btn btn-inverse">Learn More</span></a></li> <li> <a href="mailto:justin@dromologue.com"><i class="fa fa-fw fa-envelope"></i> Email</a> </li> <li> <a href="https://twitter.com/dromologue"><i class="fa fa-fw fa-twitter"></i> Twitter</a> </li> <li> <a href="https://facebook.com/justin.arbuckle"><i class="fa fa-fw fa-facebook"></i> Facebook</a> </li> <li> <a href="https://linkedin.com/in/justinarbuckle"><i class="fa fa-fw fa-linkedin"></i> LinkedIn</a> </li> <li> <a href="https://github.com/dromologue"><i class="fa fa-fw fa-github"></i> GitHub</a> </li> </ul><!-- /.dl-submenu --> </li> <li> <a href="#">Posts</a> <ul class="dl-submenu"> <li><a href="http://www.dromologue.com/posts/">All Posts</a></li> <li><a href="http://www.dromologue.com/tags/">All Tags</a></li> </ul> </li> <li><a href="http://linklist.dromologue.com" target="_blank">Link-List</a></li> <li><a href="http://www.dromologue.com/ContinuousTransformation/" target="_blank">Open Source Methods</a></li> <li><a href="http://www.dromologue.com/feed.xml" target="_blank">RSS</a></li> </ul><!-- /.dl-menu --> </nav><!-- /.dl-menuwrapper --> <div id="main" role="main"> <article class="hentry"> <header class="header-title"> <div class="header-title-wrap"> <h1 class="entry-title"><a href="http://www.dromologue.com/devops-summit-complete-compliance-in-coding-is-an/" rel="bookmark" title="Complete compliance in coding is an Alice in Wonderland-style fairytale">Complete compliance in coding is an Alice in Wonderland-style fairytale</a></h1> <h2><span class="entry-date date published"><time datetime="2015-07-08T13:06:12+01:00">July 08, 2015</time></span></h2> </div><!-- /.header-title-wrap --> </header> <div class="entry-content"> <p>DevOps Summit: Complete compliance in coding is an Alice in Wonderland-style fairytale <a href="http://www.computing.co.uk/ctg/news/2416905/complete-compliance-in-coding-is-an-alice-in-wonderland-style-fairytale">Article</a> in Computer Weekly. </p> <footer class="entry-meta"> <span class="entry-tags"><a href="http://www.dromologue.com/tags/#Interview" title="Pages tagged Interview" class="tag"><span class="term">Interview</span></a></span> <div class="social-share"> <ul class="socialcount socialcount-small inline-list"> <li class="facebook"><a href="https://www.facebook.com/sharer/sharer.php?u=http://www.dromologue.com/devops-summit-complete-compliance-in-coding-is-an/" title="Share on Facebook"><span class="count"><i class="fa fa-facebook-square"></i> Like</span></a></li> <li class="twitter"><a href="https://twitter.com/intent/tweet?text=http://www.dromologue.com/devops-summit-complete-compliance-in-coding-is-an/" title="Share on Twitter"><span class="count"><i class="fa fa-twitter-square"></i> Tweet</span></a></li> <li class="googleplus"><a href="https://plus.google.com/share?url=http://www.dromologue.com/devops-summit-complete-compliance-in-coding-is-an/" title="Share on Google Plus"><span class="count"><i class="fa fa-google-plus-square"></i> +1</span></a></li> </ul> </div><!-- /.social-share --> </footer> </div><!-- /.entry-content --> <section id="disqus_thread"></section><!-- /#disqus_thread --> <div class="read-more"> <div class="read-more-header"> <a href="http://www.dromologue.com/ics-presentation/" class="read-more-btn">Read More</a> </div><!-- /.read-more-header --> <div class="read-more-content"> <h3><a href="http://www.dromologue.com/newletter/" title="Promotions">Promotions</a></h3> <p>Junior staff often ask me, "what does it take to be promoted?" I am honest and don't pretend. I say, "It takes fitting in with how the or...&hellip; <a href="http://www.dromologue.com/newletter/">Continue reading</a></p> </div><!-- /.read-more-content --> <div class="read-more-list"> <div class="list-item"> <h4><a href="http://www.dromologue.com/bankofyear/" title="Scotiabank Wins Bank of the Year in Canada 2019">Scotiabank Wins Bank of the Year in Canada 2019</a></h4> <span>Published on November 19, 2019</span> </div><!-- /.list-item --> <div class="list-item"> <h4><a href="http://www.dromologue.com/GoogleKeynote/" title="Google Next Keynote">Google Next Keynote</a></h4> <span>Published on May 02, 2019</span> </div><!-- /.list-item --> </div><!-- /.read-more-list --> </div><!-- /.read-more --> </article> </div><!-- /#main --> <div class="footer-wrapper"> <footer role="contentinfo"> <span>&copy; 2021 Justin Arbuckle. Powered by <a href="http://jekyllrb.com" rel="nofollow">Jekyll</a> using the <a href="https://mademistakes.com/work/hpstr-jekyll-theme/" rel="nofollow">HPSTR Theme</a>.</span> </footer> </div><!-- /.footer-wrapper --> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script>window.jQuery || document.write('<script src="http://www.dromologue.com/assets/js/vendor/jquery-1.9.1.min.js"><\/script>')</script> <script src="http://www.dromologue.com/assets/js/scripts.min.js"></script> <!-- Asynchronous Google Analytics snippet --> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-10343112-1', 'auto'); ga('require', 'linkid', 'linkid.js'); ga('send', 'pageview'); </script> <script type="text/javascript"> /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */ var disqus_shortname = 'dromologue'; // required: replace example with your forum shortname /* * * DON'T EDIT BELOW THIS LINE * * */ (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); /* * * DON'T EDIT BELOW THIS LINE * * */ (function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); </script> <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript> <a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a> </body> </html>
dromologue/dromologue.github.io
_site/devops-summit-complete-compliance-in-coding-is-an/index.html
HTML
mit
11,145
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_25) on Sun Jan 04 18:05:04 PST 2015 --> <title>&lt;Unnamed&gt;</title> <meta name="date" content="2015-01-04"> <link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style"> <script type="text/javascript" src="script.js"></script> </head> <body> <h1 class="bar"><a href="package-summary.html" target="classFrame">&lt;Unnamed&gt;</a></h1> <div class="indexContainer"> <h2 title="Classes">Classes</h2> <ul title="Classes"> <li><a href="GraphDriver.html" title="class in &lt;Unnamed&gt;" target="classFrame">GraphDriver</a></li> </ul> </div> </body> </html>
amirbawab/GraphADT
documentation/package-frame.html
HTML
mit
745