code
stringlengths
3
1.05M
repo_name
stringlengths
4
116
path
stringlengths
3
942
language
stringclasses
30 values
license
stringclasses
15 values
size
int32
3
1.05M
Style ===== **Author**: gejiawen **Email**: [email protected] **Desp**: > 将会阐述一些基本的代码样式、文件命名、变量命名、代码组织等规范
gejiawen/guides
style.md
Markdown
mit
169
<!DOCTYPE html> <html dir="ltr"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>Text Editor</title> <link href="favicon.ico" rel="shortcut icon"> </head> <body spellcheck="false"> <p style=" background: #ffa; border: 1px dashed; margin-top: 0; padding: .75em 1em; ">Like this project? Please support my <a href="https://github.com/mecha-cms">Mecha CMS</a> project too. Thank you!</p> <h1>Text Editor</h1> <p><textarea style="display:block;width:100%;height:6em;box-sizing:border-box;">Lorem ipsum dolor sit amet.</textarea></p> <p> <button onclick="editor.wrap('<b>', '</b>');"><b>B</b></button> <button onclick="editor.wrap('<i>', '</i>');"><i>I</i></button> <button onclick="editor.insert('😀', -1, true);">&#x263A;</button> </p> <h2>Features</h2> <ul> <li>Light-weight library. No dependencies. <strong>Text Editor</strong> uses plain JavaScript language.</li> <li>Simple <abbr title="Application Programming Interface">API</abbr>. Easy to learn.</li> <li>Extensible &rarr; <a href="#examples">check it out</a></li> <li>No hack. No feature detection. Optimized for modern browsers with their built-in JavaScript features.</li> <li>Make your own. The core functionality is enough to help you making your own text editor.</li> </ul> <h2>Start</h2> <pre><code>&lt;!DOCTYPE html&gt; &lt;html dir="ltr"&gt; &lt;head&gt; &lt;meta charset="utf-8"&gt; &lt;/head&gt; &lt;body&gt; &lt;p&gt;&lt;textarea&gt;&lt;/textarea&gt;&lt;/p&gt; &lt;script src="<a href="text-editor.min.js" target="_blank">text-editor.min.js</a>"&gt;&lt;/script&gt; &lt;script&gt; var editor = new TE(document.querySelector('textarea')); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt;</code></pre> <h2>Configure</h2> <pre><code>var editor = new TE(<var>self</var>, <var>tab</var> = '\t');</code></pre> <pre><code>var editor = new TE(<var>self</var>, <var>state</var> = { tab: '\t' });</code></pre> <ul> <li><var>self</var> &rarr; The text area element.</li> <li><var>tab</var> &rarr; The default indent character for <code>editor.pull()</code> and <code>editor.push()</code> method.</li> <li><var>state</var> &rarr; The configuration data.</li> <li><var>state.tab</var> &rarr; The default indent character for <code>editor.pull()</code> and <code>editor.push()</code> method.</li> </ul> <h2>Instance</h2> <p>All editor instances will be stored in <code>TE.__instance__</code>. To iterate the instances is possible with <code>TE.each()</code>:</p> <pre><code>TE.each(function(key) { console.log(key); console.log(this.self); });</code></pre> <ul> <li><var>this</var> &rarr; Refers to the text editor instance.</li> <li><var>key</var> &rarr; Refers to the text editor target&rsquo;s <code>id</code> or <code>name</code> attribute value, or its current order.</li> </ul> <h2>Methods and Properties</h2> <h3>TE.version</h3> <p>Return the text editor version.</p> <h3>TE.x</h3> <p>List of regular expression characters to be escaped.</p> <h3>TE.esc(input)</h3> <p>Escape regular expression characters listed in <code>TE.x</code> from a string or array input.</p> <h3>TE._</h3> <p>Return the text editor prototypes.</p> <h3>editor.state</h3> <p>Return the text editor states if any.</p> <h3>editor.self</h3> <p>Return the <code>&lt;textarea&gt;</code> element.</p> <h3>editor.source</h3> <p>Alias for <code>editor.self</code> property.</p> <h3>editor.value</h3> <p>Return the initial value of the <code>&lt;textarea&gt;</code> element.</p> <h3>editor.set(value)</h3> <p>Set value to the <code>&lt;textarea&gt;</code> element.</p> <h3>editor.let()</h3> <p>Reset value to the initial value of the <code>&lt;textarea&gt;</code> element.</p> <h3>editor.get()</h3> <p>Get current value of the <code>&lt;textarea&gt;</code> element if not empty, otherwise, return <code>null</code>.</p> <h3>editor.$()</h3> <p>Get current text selection data.</p> <pre><code>// `a|b|c` console.log(editor.$()); // `{"start":1,"end":2,"value":"b","before":"a","after":"c","length":1}`</code></pre> <h3>editor.focus(mode = 0)</h3> <p>Focus to the <code>&lt;textarea&gt;</code>.</p> <pre><code>editor.focus(); // Focus to the last selection editor.focus(-1); // Focus to the start of text area value editor.focus(1); // Focus to the end of text area value editor.focus(true); // Select all</code></pre> <h3>editor.blur()</h3> <p>Blur from the <code>&lt;textarea&gt;</code>.</p> <h3>editor.select(...args)</h3> <p>Set selection range.</p> <pre><code>editor.select(); // Is the same as `editor.focus()` editor.select(2); // Move caret to the index `2` editor.select(0, 2); // Select from range `0` to `2` editor.select(true); // Select all</code></pre> <h3>editor.match(pattern, fn)</h3> <p>Match current selection with the pattern provided.</p> <pre><code>if (editor.match(/^\s*:\w+:\s*$/)) { alert('Selection is detected as emoji!'); // &rarr; <a href="text-editor.match.html" target="_blank">demo</a> }</code></pre> <p>Do something with the current matched selection.</p> <pre><code>var maps = { ':happy:': '😀', ':sad:': '😩', ':wonder:': '😕' } editor.match(/^\s*:\w+:\s*$/, function(m) { var exists = maps[m[0] = m[0] ? m[0].trim() : ""]; exists && this.insert(exists); // &rarr; <a href="text-editor.alter.html" target="_blank">demo</a> });</code></pre> <p>Match to the characters before selection, current selection and characters after selection.</p> <pre><code>var test = editor.match([/:$/, /^\w+$/, /^:/]); console.log(test[0] && test[1] && test[2]);</code></pre> <pre><code>editor.match([/:$/, /^\w+$/, /^:/], function(before, value, after) { console.log([before, value, after]); // &rarr; <a href="text-editor.toggle.html" target="_blank">demo</a> });</code></pre> <h3>editor.replace(from, to, mode = 0)</h3> <p>Replace current, before or after selection from <var>from</var> to <var>to</var>.</p> <pre><code>editor.replace(/<.*?>/g, ""); // Strip HTML tags in selection editor.replace(/<.*?>/g, "", -1); // Strip HTML tags before selection editor.replace(/<.*?>/g, "", 1); // Strip HTML tags after selection</code></pre> <h3>editor.insert(string, mode = 0, clear = false)</h3> <p>Insert <var>string</var> to (replace) the current selection.</p> <pre><code>editor.insert(':)'); // Insert at selection (replace selection) editor.insert('&lt;b&gt;', -1); // Insert before selection editor.insert('&lt;/b&gt;', 1); // Insert after selection editor.insert(':)', -1, true); // Insert before selection and delete selection editor.insert(':)', 1, true); // Insert after selection and delete selection</code></pre> <h3>editor.wrap(open, close, wrap = false)</h3> <p>Wrap current selection with <var>open</var> and <var>close</var>.</p> <pre><code>editor.wrap('&lt;', '&gt;'); // Wrap with `&lt;` and `&gt;` editor.wrap('&lt;', '&gt;', true); // Wrap with `&lt;` and `&gt;` then select</code></pre> <h3>editor.peel(open, close, wrap = false)</h3> <p>Unwrap current selection from <var>open</var> and <var>close</var>.</p> <pre><code>editor.peel('&lt;', '&gt;'); // Remove `&lt;` before selection and `&gt;` after selection editor.peel('&lt;', '&gt;', true); // Remove `&lt;` at selection start and `&gt;` at selection end editor.peel(/&lt;+/, /&gt;+/); // Remove any `&lt;` before selection and any `&gt;` after selection editor.peel(/&lt;+/, /&gt;+/, true); // Remove any `&lt;` at selection start and any `&gt;` at selection end</code></pre> <h3>editor.push(by = '\t', includeEmptyLines = false)</h3> <p>Indent current selection with <var>by</var>.</p> <pre><code>editor.push(); // Indent with `\t` editor.push('****'); // Indent with `****`</code></pre> <h3>editor.pull(by = '\t', includeEmptyLines = true)</h3> <p>Outdent current selection from <var>by</var>.</p> <pre><code>editor.pull(); // Outdent from `\t` editor.pull('****'); // Outdent from `****` editor.pull(/[\t ]+/); // Outdent from any length of white-space</code></pre> <h3>editor.trim(open = "", close = "", start = "", end = "", tidy = true)</h3> <p>Trim current selection from white-spaces, and optionally insert characters at the specified points.</p> <pre><code>// `a&lt;open&gt;<mark>&lt;start&gt;b&lt;end&gt;</mark>&lt;close&gt;c` editor.trim(); // Remove any white-spaces before and after selection, start and end of selection editor.trim(false, false); // Remove any white-spaces at the start and end of selection editor.trim("", "", false, false); // Remove any white-spaces before and after selection editor.trim(' ', ' '); // Force a space before and after selection editor.trim('\n\n', '\n\n'); // Force line-break before and after selection editor.trim('\n\n', '\n\n', "", "", false); // Ignore empty value before and after selection, just insert that `\n\n` away</code></pre> <h2 id="examples">Examples</h2> <ul> <li><a href="text-editor.html" target="_blank">No Idea?</a></li> <li><a href="text-editor.self.html" target="_blank">Multiple Instances</a></li> <li><a href="text-editor.disabled.html" target="_blank">Disabled Input</a></li> <li><a href="text-editor.read-only.html" target="_blank">Read-Only Input</a></li> <li><a href="text-editor.get,let,set.html" target="_blank">Set, Get and Let Value</a></li> <li><a href="text-editor.$.html" target="_blank">Get Selection Data</a></li> <li><a href="text-editor.blur,focus.html" target="_blank">Focus, Blur Events</a></li> <li><a href="text-editor.select.html" target="_blank">Set Selection Range</a></li> <li><a href="text-editor.match.html" target="_blank">Match Selection</a></li> <li><a href="text-editor.alter.html" target="_blank">Alter Selection</a></li> <li><a href="text-editor.toggle.html" target="_blank">Toggle Replace Selection</a></li> <li><a href="text-editor.replace.html" target="_blank">Replace Selection</a></li> <li><a href="text-editor.insert.html" target="_blank">Insert Selection</a></li> <li><a href="text-editor.peel,wrap.html" target="_blank">Wrap, Peel Selection</a></li> <li><a href="text-editor.pull,push.html" target="_blank">Indent, Outdent Selection</a></li> <li><a href="text-editor.pull,push.type.html" target="_blank">Indent, Outdent by Custom Character</a></li> <li><a href="text-editor.pull,push.key.html" target="_blank">Indent, Outdent with Keyboard Key</a></li> <li><a href="text-editor.trim.html" target="_blank">Trim Selection</a></li> <li><a href="text-editor/rect.html" target="_blank">Get Selection Offset</a> (<a href="text-editor/rect.min.js" target="_blank">+rect.min.js</a>)</li> <li><a href="text-editor/rect.caret.html" target="_blank">Custom Caret Example</a></li> <li><a href="text-editor/history.html" target="_blank">Undo and Redo Feature</a> (<a href="text-editor/history.min.js" target="_blank">+history.min.js</a>)</li> <li><a href="text-editor/source.html" target="_blank">Source Code Editor</a> (<a href="text-editor/source.min.js" target="_blank">+source.min.js</a>)</li> </ul> <script src="text-editor.js"></script> <script> var editor = new TE(document.querySelector('textarea')); </script> </body> </html>
tovic/simple-text-editor-library
index.html
HTML
mit
11,800
module ActiveWarehouse #:nodoc: # Class that supports prejoining a fact table with dimensions. This is useful if you need # to list facts along with some or all of their detail information. class PrejoinFact # The fact class that this engine instance is connected to attr_accessor :fact_class delegate :prejoined_table_name, :connection, :prejoined_fields, :dimension_relationships, :dimension_class, :table_name, :columns, :to => :fact_class # Initialize the engine instance def initialize(fact_class) @fact_class = fact_class end # Populate the prejoined fact table. def populate(options={}) populate_prejoined_fact_table(options) end protected # Drop the storage table def drop_prejoin_fact_table connection.drop_table(prejoined_table_name) if connection.tables.include?(prejoined_table_name) end # Get foreign key names that are excluded. def excluded_foreign_key_names excluded_dimension_relations = prejoined_fields.keys.collect {|k| dimension_relationships[k]} excluded_dimension_relations.collect {|r| r.foreign_key} end # Construct the prejoined fact table. def create_prejoined_fact_table(options={}) connection.transaction { drop_prejoin_fact_table connection.create_table(prejoined_table_name, :id => false) do |t| # get all columns except the foreign_key columns for prejoined dimensions columns.each do |c| t.column(c.name, c.type) unless excluded_foreign_key_names.include?(c.name) end #prejoined_columns prejoined_fields.each_pair do |key, value| dclass = dimension_class(key) dclass.columns.each do |c| t.column(c.name, c.type) if value.include?(c.name.to_sym) end end end } end # Populate the prejoined fact table. def populate_prejoined_fact_table(options={}) fact_columns_string = columns.collect {|c| "#{table_name}." + c.name unless excluded_foreign_key_names.include?(c.name) }.compact.join(",\n") prejoined_columns = [] tables_and_joins = "#{table_name}" prejoined_fields.each_pair do |key, value| dimension = dimension_class(key) tables_and_joins += "\nJOIN #{dimension.table_name} as #{key}" tables_and_joins += "\n ON #{table_name}.#{dimension_relationships[key].foreign_key} = " tables_and_joins += "#{key}.#{dimension.primary_key}" prejoined_columns << value.collect {|v| "#{key}." + v.to_s} end if connection.support_select_into_table? drop_prejoin_fact_table sql = <<-SQL SELECT #{fact_columns_string}, #{prejoined_columns.join(",\n")} FROM #{tables_and_joins} SQL sql = connection.add_select_into_table(prejoined_table_name, sql) else create_prejoined_fact_table(options) sql = <<-SQL INSERT INTO #{prejoined_table_name} SELECT #{fact_columns_string}, #{prejoined_columns.join(",\n")} FROM #{tables_and_joins} SQL end connection.transaction { connection.execute(sql) } end end end
activewarehouse/activewarehouse
lib/active_warehouse/prejoin_fact.rb
Ruby
mit
3,448
from array import array import numpy as np import matplotlib.pyplot as plt from sklearn import datasets from sklearn.tree import DecisionTreeClassifier from sklearn.ensemble import AdaBoostClassifier from sklearn.metrics import classification_report, roc_auc_score, roc_curve from sklearn import tree import cPickle data = np.load('/Users/musthero/Documents/Yura/Applications/tmva_local/output_electrons_fullsim_v5_VeryTightLH_20per.npz') # Train on the first 2000, test on the rest X_train, y_train = data['data_training'], data['isprompt_training'].ravel() X_test, y_test = data['data_testing'][0:1000], data['isprompt_testing'][0:1000].ravel() # sklearn dt = DecisionTreeClassifier(max_depth=3, min_samples_leaf=100) #min_samples_leaf=0.05*len(X_train)) doFit = False if doFit: print "Performing DecisionTree fit..." dt.fit(X_train, y_train) import cPickle with open('electrons_toTMVA.pkl', 'wb') as fid: cPickle.dump(dt, fid) else: print "Loading DecisionTree..." # load it again with open('electrons_toTMVA.pkl', 'rb') as fid: dt = cPickle.load(fid) #sk_y_predicted = dt.predict(X_test) #sk_y_predicted = dt.predict_proba(X_test)[:, 1] sk_y_predicted = dt.predict_proba(X_test)[:, 1] predictions = dt.predict(X_test) print predictions print y_test # Draw ROC curve fpr, tpr, _ = roc_curve(y_test, sk_y_predicted) plt.figure() plt.plot(fpr, tpr, label='ROC curve of class') plt.plot([0, 1], [0, 1], 'k--') plt.xlim([0.0, 1.0]) plt.ylim([0.0, 1.05]) plt.xlabel('False Positive Rate') plt.ylabel('True Positive Rate') plt.title('Some extension of Receiver operating characteristic to multi-class') plt.legend(loc="lower right") plt.savefig("output_fullsim_v5_electrons_roc_20per_DecisionTree.png", dpi=144) tree.export_graphviz(dt, out_file='dt_viz.dot') # Save to file fpr, tpr #np.savez('output_fullsim_v3_electrons_fpr_tpr_10per.npz', # fpr=fpr, tpr=tpr)
yuraic/koza4ok
skTMVA/sci_bdt_electron_DecisionTree.py
Python
mit
1,980
--- layout: default og_type: article --- <article class="post grid u-pad-both pjax-animate"> <section class="grid__row"> <span class="post__date typography__mono">{{ page.date | date: "%-d %B %Y" }}</span> {{ content }} </section> </article> {% if page.comments != Nil %} {% assign showComments = page.comments %} {% else %} {% assign showComments = site.comments %} {% endif %} {% if showComments %} {% include blog-comments.html %} {% endif %} {% include blog-newsletter.html %} {% if page.next_in_category != nil %} {% assign nextpage = page.next_in_category %} {% else %} {% assign nextpage = page.first_in_category %} {% endif %} <section class="related-posts"> <a class="related-posts__link grid u-default-v-padding u-bg-natt-dark" href="{{ site.baseurl }}{{ nextpage.url }}"> <div class="grid__row"> <p class="related-posts__label typography__mono">Read Next</p> <h2 class="related-posts__title">{{ nextpage.title }}</h2> </div> </a> </section> {% include footer.html %}
14islands/14islands-com
app/_layouts/post.html
HTML
mit
1,017
package utils; import java.io.*; import java.net.DatagramSocket; import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; import java.util.ArrayList; import java.util.List; import java.util.Scanner; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import ch.ethz.ssh2.Connection; import ch.ethz.ssh2.Session; import ueb01.StringBufferImpl; /** * Created with IntelliJ IDEA. * User: Julian * Date: 16.10.13 * Time: 13:37 */ public class Utils { private static long currentTime; /** * http://svn.apache.org/viewvc/camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/AvailablePortFinder.java?view=markup#l130 * Checks to see if a specific port is available. * * @param port the port to check for availability */ public static boolean available(int port) { ServerSocket ss = null; DatagramSocket ds = null; try { ss = new ServerSocket(port); ss.setReuseAddress(true); ds = new DatagramSocket(port); ds.setReuseAddress(true); return true; } catch (IOException e) { } finally { if (ds != null) { ds.close(); } if (ss != null) { try { ss.close(); } catch (IOException e) { /* should not be thrown */ } } } return false; } public static void stopwatchStart() { currentTime = java.lang.System.nanoTime(); } static ExecutorService pool = null; public static class SyncTcpResponse { public final Socket socket; public final String message; public boolean isValid() { return this.socket != null; } public SyncTcpResponse(Socket s, String m) { this.socket = s; this.message = m; } } public static String getTCPSync(final Socket socket) { StringBuilder sb = new StringBuilder(); try { Scanner s = new Scanner(socket.getInputStream()); while (s.hasNext()) { sb.append(s.next()); } } catch (IOException e) { e.printStackTrace(); } return sb.toString(); } public static SyncTcpResponse getTCPSync(final int port) { ServerSocket server = null; Socket client = null; StringBuilder sb = new StringBuilder(); try { server = new ServerSocket(port); client = server.accept(); Scanner s = new Scanner(client.getInputStream()); while (s.hasNext()) { sb.append(s.next()); } } catch (IOException e) { e.printStackTrace(); } finally { if (server != null) try { server.close(); } catch (IOException e) { e.printStackTrace(); } } return new SyncTcpResponse(client, sb.toString()); } public static Future<String> getTCP(final int port) { if (pool == null) { pool = Executors.newCachedThreadPool(); } return pool.submit(new Callable<String>() { @Override public String call() throws Exception { ServerSocket server = null; /*try(ServerSocket socket = new ServerSocket(port)){ Socket client = socket.accept(); Scanner s = new Scanner(client.getInputStream()); StringBuilder sb = new StringBuilder(); while (s.hasNext()){ sb.append(s.next()); } return sb.toString(); } */ return null; } }); } public static Socket sendTCP(InetAddress address, int port, String message) { try { Socket s = new Socket(address, port); return sendTCP(s, message); } catch (IOException e) { e.printStackTrace(); } return null; } public static Socket sendTCP(Socket socket, String message) { PrintWriter out = null; try { out = new PrintWriter(socket.getOutputStream()); out.println(message); out.flush(); } catch (IOException e) { e.printStackTrace(); } finally { if (out != null) { out.close(); } try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } return socket; } public static void close() { if (pool != null) { pool.shutdown(); } } public static String wordFromScanner(Scanner scanner) { StringBuilder result = new StringBuilder(); while (scanner.hasNextLine()) { String line = scanner.nextLine(); result.append(line); result.append("\n"); } return result.toString(); } public static String[] wordsFromScanner(Scanner scanner) { List<String> result = new ArrayList<String>(); while (scanner.hasNextLine()) { String line = scanner.nextLine(); String[] words = line.split(" "); for (String word : words) { if (word.length() > 0) result.add(wordify(word)); } } return Utils.<String>listToArrayStr(result); } public static String wordify(String word) { return word.replace(",", "").replace(".", "").replace("'", "").replace("\"", "") .replace("...", "").replace("!", "").replace(";", "").replace(":", "").toLowerCase(); } public static <T> T[] listToArray(List<T> list) { T[] result = (T[]) new Object[list.size()]; for (int i = 0; i < list.size(); i++) { result[i] = list.get(i); } return result; } public static String[] listToArrayStr(List<String> list) { String[] result = new String[list.size()]; for (int i = 0; i < list.size(); i++) { result[i] = list.get(i); } return result; } public static void stopwatchEnd() { long current = java.lang.System.nanoTime(); long dif = current - currentTime; long millis = dif / 1000000; System.out.println("Millis: {" + millis + "} Nanos: {" + dif + "}"); } /** * Method to send a command to a Process * * @param p * @param command */ public static void send(Process p, String command) { OutputStream os = p.getOutputStream(); try { os.write(command.getBytes()); } catch (IOException e) { System.out.println("something went wrong... [Utils.send(..) -> " + e.getMessage()); } finally { try { os.close(); } catch (IOException e) { System.out.println("something went wrong while closing... [Utils.send(..) -> " + e.getMessage()); } } } public static void close(Process p) { try { p.getOutputStream().close(); p.getInputStream().close(); } catch (IOException e) { e.printStackTrace(); } } /** * easy exceptionless sleep * * @param millis */ public static void sleep(long millis) { try { Thread.sleep(millis); } catch (InterruptedException e) { e.printStackTrace(); System.out.println("ALP5: Utils::sleep crashed.."); } } public static int countCharactersInFile(String fileName) { BufferedReader br = null; try { StringBuilder sb = new StringBuilder(); br = new BufferedReader(new FileReader(fileName)); String line = br.readLine(); while (line != null) { sb.append(line); line = br.readLine(); } return sb.length(); } catch (FileNotFoundException e) { e.printStackTrace(); System.out.println("shit happens... @Utils.countCharactersInFile"); return -1; } catch (IOException e) { e.printStackTrace(); System.out.println("shit happens while reading... @Utils.countCharactersInFile"); } finally { if (br != null) try { br.close(); } catch (IOException e) { e.printStackTrace(); return -2; } } return -3; } public static String join(String[] l, String connector) { StringBuilder sb = new StringBuilder(); for (String s : l) { if (sb.length() > 0) { sb.append(connector); } sb.append(s); } return sb.toString(); } public static String readFromStream(InputStream is){ java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A"); return s.hasNext() ? s.next() : ""; } /** * Method to receive the output of a Process * * @param p * @return */ public static String read(Process p) { StringBuilder sb = new StringBuilder(); InputStream is = p.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(is)); String s = null; try { while ((s = reader.readLine()) != null) { if (s.equals("") || s.equals(" ")) break; sb.append(s); } } catch (IOException e) { System.out.println("something went wrong... [Utils.read(..) -> " + e.getMessage()); } return sb.toString(); } public static void main(String[] args) throws IOException, InterruptedException { System.out.println("yyy"); System.out.println('a' > 'b'); } /** * If you want to use your ssh-key-login, you need to generate a pem-File from * the ssh-private-key and put it into the main folder ( ALP5/ ); You also need * to define the user with @ (like: [email protected]:...) * * @param commandId * @return */ public static Process fork(String commandId) { String username = null; // HARDCODE ME! String password = null; // HARDCODE ME! String host = null; String command = commandId; if (commandId.contains(":")) { String[] temp = commandId.split(":"); if (temp[0].length() > 2) { // if the host is shorter its probably just a windows drive ('d:// ...') host = temp[0]; if (host.contains("@")) { String[] t = host.split("@"); username = t[0]; host = t[1]; } if (temp.length == 3) { command = temp[1] + ":" + temp[2]; // to "repair" windows drives... } else { command = temp[1]; } } } if (host != null) { Process remoteP = null; try { final Connection conn = new Connection(host); conn.connect(); boolean isAuth = false; if (password != null) { isAuth = conn.authenticateWithPassword(username, password); } if (!isAuth) { File f = new File("private.pem"); isAuth = conn.authenticateWithPublicKey(username, f, ""); if (!isAuth) return null; } final Session sess = conn.openSession(); sess.execCommand(command); remoteP = new Process() { @Override public OutputStream getOutputStream() { return sess.getStdin(); } @Override public InputStream getInputStream() { return sess.getStdout(); } @Override public InputStream getErrorStream() { return sess.getStderr(); } @Override public int waitFor() throws InterruptedException { sess.wait(); return 0; } @Override public int exitValue() { return 0; } @Override public void destroy() { sess.close(); conn.close(); } }; } catch (IOException e) { System.out.println("shit happens with the ssh connection: @Utils.fork .. " + e.getMessage()); return null; } return remoteP; } ProcessBuilder b = new ProcessBuilder(command.split(" ")); try { return b.start(); } catch (IOException e) { System.out.println("shit happens: @Utils.fork .. " + e.getMessage()); } return null; } }
justayak/ALP5
src/utils/Utils.java
Java
mit
14,112
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { onUnexpectedError } from 'vs/base/common/errors'; import { IDisposable } from 'vs/base/common/lifecycle'; import { URI, UriComponents } from 'vs/base/common/uri'; import { EditOperation } from 'vs/editor/common/core/editOperation'; import { Range } from 'vs/editor/common/core/range'; import { ITextModel } from 'vs/editor/common/model'; import { IEditorWorkerService } from 'vs/editor/common/services/editorWorkerService'; import { IModelService } from 'vs/editor/common/services/modelService'; import { IModeService } from 'vs/editor/common/services/modeService'; import { ITextModelService } from 'vs/editor/common/services/resolverService'; import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers'; import { ExtHostContext, ExtHostDocumentContentProvidersShape, IExtHostContext, MainContext, MainThreadDocumentContentProvidersShape } from '../node/extHost.protocol'; import { CancellationTokenSource } from 'vs/base/common/cancellation'; @extHostNamedCustomer(MainContext.MainThreadDocumentContentProviders) export class MainThreadDocumentContentProviders implements MainThreadDocumentContentProvidersShape { private readonly _resourceContentProvider = new Map<number, IDisposable>(); private readonly _pendingUpdate = new Map<string, CancellationTokenSource>(); private readonly _proxy: ExtHostDocumentContentProvidersShape; constructor( extHostContext: IExtHostContext, @ITextModelService private readonly _textModelResolverService: ITextModelService, @IModeService private readonly _modeService: IModeService, @IModelService private readonly _modelService: IModelService, @IEditorWorkerService private readonly _editorWorkerService: IEditorWorkerService ) { this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostDocumentContentProviders); } dispose(): void { this._resourceContentProvider.forEach(p => p.dispose()); this._pendingUpdate.forEach(source => source.dispose()); } $registerTextContentProvider(handle: number, scheme: string): void { const registration = this._textModelResolverService.registerTextModelContentProvider(scheme, { provideTextContent: (uri: URI): Thenable<ITextModel> => { return this._proxy.$provideTextDocumentContent(handle, uri).then(value => { if (typeof value === 'string') { const firstLineText = value.substr(0, 1 + value.search(/\r?\n/)); const languageSelection = this._modeService.createByFilepathOrFirstLine(uri.fsPath, firstLineText); return this._modelService.createModel(value, languageSelection, uri); } return undefined; }); } }); this._resourceContentProvider.set(handle, registration); } $unregisterTextContentProvider(handle: number): void { const registration = this._resourceContentProvider.get(handle); if (registration) { registration.dispose(); this._resourceContentProvider.delete(handle); } } $onVirtualDocumentChange(uri: UriComponents, value: string): void { const model = this._modelService.getModel(URI.revive(uri)); if (!model) { return; } // cancel and dispose an existing update if (this._pendingUpdate.has(model.id)) { this._pendingUpdate.get(model.id).cancel(); } // create and keep update token const myToken = new CancellationTokenSource(); this._pendingUpdate.set(model.id, myToken); this._editorWorkerService.computeMoreMinimalEdits(model.uri, [{ text: value, range: model.getFullModelRange() }]).then(edits => { // remove token this._pendingUpdate.delete(model.id); if (myToken.token.isCancellationRequested) { // ignore this return; } if (edits.length > 0) { // use the evil-edit as these models show in readonly-editor only model.applyEdits(edits.map(edit => EditOperation.replace(Range.lift(edit.range), edit.text))); } }).catch(onUnexpectedError); } }
DustinCampbell/vscode
src/vs/workbench/api/electron-browser/mainThreadDocumentContentProviders.ts
TypeScript
mit
4,197
//--------------------------------------------------------------------------- // // <copyright file="ByteAnimationUsingKeyFrames.cs" company="Microsoft"> // Copyright (C) Microsoft Corporation. All rights reserved. // </copyright> // // This file was generated, please do not edit it directly. // // Please see http://wiki/default.aspx/Microsoft.Projects.Avalon/MilCodeGen.html for more information. // //--------------------------------------------------------------------------- using MS.Internal; using MS.Internal.KnownBoxes; using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Windows; using System.Windows.Markup; using System.Windows.Media.Animation; using System.Windows.Media.Media3D; using SR=MS.Internal.PresentationCore.SR; using SRID=MS.Internal.PresentationCore.SRID; using MS.Internal.PresentationCore; namespace System.Windows.Media.Animation { /// <summary> /// This class is used to animate a Byte property value along a set /// of key frames. /// </summary> [ContentProperty("KeyFrames")] public class ByteAnimationUsingKeyFrames : ByteAnimationBase, IKeyFrameAnimation, IAddChild { #region Data private ByteKeyFrameCollection _keyFrames; private ResolvedKeyFrameEntry[] _sortedResolvedKeyFrames; private bool _areKeyTimesValid; #endregion #region Constructors /// <Summary> /// Creates a new KeyFrameByteAnimation. /// </Summary> public ByteAnimationUsingKeyFrames() : base() { _areKeyTimesValid = true; } #endregion #region Freezable /// <summary> /// Creates a copy of this KeyFrameByteAnimation. /// </summary> /// <returns>The copy</returns> public new ByteAnimationUsingKeyFrames Clone() { return (ByteAnimationUsingKeyFrames)base.Clone(); } /// <summary> /// Returns a version of this class with all its base property values /// set to the current animated values and removes the animations. /// </summary> /// <returns> /// Since this class isn't animated, this method will always just return /// this instance of the class. /// </returns> public new ByteAnimationUsingKeyFrames CloneCurrentValue() { return (ByteAnimationUsingKeyFrames)base.CloneCurrentValue(); } /// <summary> /// Implementation of <see cref="System.Windows.Freezable.FreezeCore">Freezable.FreezeCore</see>. /// </summary> protected override bool FreezeCore(bool isChecking) { bool canFreeze = base.FreezeCore(isChecking); canFreeze &= Freezable.Freeze(_keyFrames, isChecking); if (canFreeze & !_areKeyTimesValid) { ResolveKeyTimes(); } return canFreeze; } /// <summary> /// Implementation of <see cref="System.Windows.Freezable.OnChanged">Freezable.OnChanged</see>. /// </summary> protected override void OnChanged() { _areKeyTimesValid = false; base.OnChanged(); } /// <summary> /// Implementation of <see cref="System.Windows.Freezable.CreateInstanceCore">Freezable.CreateInstanceCore</see>. /// </summary> /// <returns>The new Freezable.</returns> protected override Freezable CreateInstanceCore() { return new ByteAnimationUsingKeyFrames(); } /// <summary> /// Implementation of <see cref="System.Windows.Freezable.CloneCore(System.Windows.Freezable)">Freezable.CloneCore</see>. /// </summary> protected override void CloneCore(Freezable sourceFreezable) { ByteAnimationUsingKeyFrames sourceAnimation = (ByteAnimationUsingKeyFrames) sourceFreezable; base.CloneCore(sourceFreezable); CopyCommon(sourceAnimation, /* isCurrentValueClone = */ false); } /// <summary> /// Implementation of <see cref="System.Windows.Freezable.CloneCurrentValueCore(Freezable)">Freezable.CloneCurrentValueCore</see>. /// </summary> protected override void CloneCurrentValueCore(Freezable sourceFreezable) { ByteAnimationUsingKeyFrames sourceAnimation = (ByteAnimationUsingKeyFrames) sourceFreezable; base.CloneCurrentValueCore(sourceFreezable); CopyCommon(sourceAnimation, /* isCurrentValueClone = */ true); } /// <summary> /// Implementation of <see cref="System.Windows.Freezable.GetAsFrozenCore(Freezable)">Freezable.GetAsFrozenCore</see>. /// </summary> protected override void GetAsFrozenCore(Freezable source) { ByteAnimationUsingKeyFrames sourceAnimation = (ByteAnimationUsingKeyFrames) source; base.GetAsFrozenCore(source); CopyCommon(sourceAnimation, /* isCurrentValueClone = */ false); } /// <summary> /// Implementation of <see cref="System.Windows.Freezable.GetCurrentValueAsFrozenCore(Freezable)">Freezable.GetCurrentValueAsFrozenCore</see>. /// </summary> protected override void GetCurrentValueAsFrozenCore(Freezable source) { ByteAnimationUsingKeyFrames sourceAnimation = (ByteAnimationUsingKeyFrames) source; base.GetCurrentValueAsFrozenCore(source); CopyCommon(sourceAnimation, /* isCurrentValueClone = */ true); } /// <summary> /// Helper used by the four Freezable clone methods to copy the resolved key times and /// key frames. The Get*AsFrozenCore methods are implemented the same as the Clone*Core /// methods; Get*AsFrozen at the top level will recursively Freeze so it's not done here. /// </summary> /// <param name="sourceAnimation"></param> /// <param name="isCurrentValueClone"></param> private void CopyCommon(ByteAnimationUsingKeyFrames sourceAnimation, bool isCurrentValueClone) { _areKeyTimesValid = sourceAnimation._areKeyTimesValid; if ( _areKeyTimesValid && sourceAnimation._sortedResolvedKeyFrames != null) { // _sortedResolvedKeyFrames is an array of ResolvedKeyFrameEntry so the notion of CurrentValueClone doesn't apply _sortedResolvedKeyFrames = (ResolvedKeyFrameEntry[])sourceAnimation._sortedResolvedKeyFrames.Clone(); } if (sourceAnimation._keyFrames != null) { if (isCurrentValueClone) { _keyFrames = (ByteKeyFrameCollection)sourceAnimation._keyFrames.CloneCurrentValue(); } else { _keyFrames = (ByteKeyFrameCollection)sourceAnimation._keyFrames.Clone(); } OnFreezablePropertyChanged(null, _keyFrames); } } #endregion // Freezable #region IAddChild interface /// <summary> /// Adds a child object to this KeyFrameAnimation. /// </summary> /// <param name="child"> /// The child object to add. /// </param> /// <remarks> /// A KeyFrameAnimation only accepts a KeyFrame of the proper type as /// a child. /// </remarks> void IAddChild.AddChild(object child) { WritePreamble(); if (child == null) { throw new ArgumentNullException("child"); } AddChild(child); WritePostscript(); } /// <summary> /// Implemented to allow KeyFrames to be direct children /// of KeyFrameAnimations in markup. /// </summary> [EditorBrowsable(EditorBrowsableState.Advanced)] protected virtual void AddChild(object child) { ByteKeyFrame keyFrame = child as ByteKeyFrame; if (keyFrame != null) { KeyFrames.Add(keyFrame); } else { throw new ArgumentException(SR.Get(SRID.Animation_ChildMustBeKeyFrame), "child"); } } /// <summary> /// Adds a text string as a child of this KeyFrameAnimation. /// </summary> /// <param name="childText"> /// The text to add. /// </param> /// <remarks> /// A KeyFrameAnimation does not accept text as a child, so this method will /// raise an InvalididOperationException unless a derived class has /// overridden the behavior to add text. /// </remarks> /// <exception cref="ArgumentNullException">The childText parameter is /// null.</exception> void IAddChild.AddText(string childText) { if (childText == null) { throw new ArgumentNullException("childText"); } AddText(childText); } /// <summary> /// This method performs the core functionality of the AddText() /// method on the IAddChild interface. For a KeyFrameAnimation this means /// throwing and InvalidOperationException because it doesn't /// support adding text. /// </summary> /// <remarks> /// This method is the only core implementation. It does not call /// WritePreamble() or WritePostscript(). It also doesn't throw an /// ArgumentNullException if the childText parameter is null. These tasks /// are performed by the interface implementation. Therefore, it's OK /// for a derived class to override this method and call the base /// class implementation only if they determine that it's the right /// course of action. The derived class can rely on KeyFrameAnimation's /// implementation of IAddChild.AddChild or implement their own /// following the Freezable pattern since that would be a public /// method. /// </remarks> /// <param name="childText">A string representing the child text that /// should be added. If this is a KeyFrameAnimation an exception will be /// thrown.</param> /// <exception cref="InvalidOperationException">Timelines have no way /// of adding text.</exception> [EditorBrowsable(EditorBrowsableState.Advanced)] protected virtual void AddText(string childText) { throw new InvalidOperationException(SR.Get(SRID.Animation_NoTextChildren)); } #endregion #region ByteAnimationBase /// <summary> /// Calculates the value this animation believes should be the current value for the property. /// </summary> /// <param name="defaultOriginValue"> /// This value is the suggested origin value provided to the animation /// to be used if the animation does not have its own concept of a /// start value. If this animation is the first in a composition chain /// this value will be the snapshot value if one is available or the /// base property value if it is not; otherise this value will be the /// value returned by the previous animation in the chain with an /// animationClock that is not Stopped. /// </param> /// <param name="defaultDestinationValue"> /// This value is the suggested destination value provided to the animation /// to be used if the animation does not have its own concept of an /// end value. This value will be the base value if the animation is /// in the first composition layer of animations on a property; /// otherwise this value will be the output value from the previous /// composition layer of animations for the property. /// </param> /// <param name="animationClock"> /// This is the animationClock which can generate the CurrentTime or /// CurrentProgress value to be used by the animation to generate its /// output value. /// </param> /// <returns> /// The value this animation believes should be the current value for the property. /// </returns> protected sealed override Byte GetCurrentValueCore( Byte defaultOriginValue, Byte defaultDestinationValue, AnimationClock animationClock) { Debug.Assert(animationClock.CurrentState != ClockState.Stopped); if (_keyFrames == null) { return defaultDestinationValue; } // We resolved our KeyTimes when we froze, but also got notified // of the frozen state and therefore invalidated ourselves. if (!_areKeyTimesValid) { ResolveKeyTimes(); } if (_sortedResolvedKeyFrames == null) { return defaultDestinationValue; } TimeSpan currentTime = animationClock.CurrentTime.Value; Int32 keyFrameCount = _sortedResolvedKeyFrames.Length; Int32 maxKeyFrameIndex = keyFrameCount - 1; Byte currentIterationValue; Debug.Assert(maxKeyFrameIndex >= 0, "maxKeyFrameIndex is less than zero which means we don't actually have any key frames."); Int32 currentResolvedKeyFrameIndex = 0; // Skip all the key frames with key times lower than the current time. // currentResolvedKeyFrameIndex will be greater than maxKeyFrameIndex // if we are past the last key frame. while ( currentResolvedKeyFrameIndex < keyFrameCount && currentTime > _sortedResolvedKeyFrames[currentResolvedKeyFrameIndex]._resolvedKeyTime) { currentResolvedKeyFrameIndex++; } // If there are multiple key frames at the same key time, be sure to go to the last one. while ( currentResolvedKeyFrameIndex < maxKeyFrameIndex && currentTime == _sortedResolvedKeyFrames[currentResolvedKeyFrameIndex + 1]._resolvedKeyTime) { currentResolvedKeyFrameIndex++; } if (currentResolvedKeyFrameIndex == keyFrameCount) { // Past the last key frame. currentIterationValue = GetResolvedKeyFrameValue(maxKeyFrameIndex); } else if (currentTime == _sortedResolvedKeyFrames[currentResolvedKeyFrameIndex]._resolvedKeyTime) { // Exactly on a key frame. currentIterationValue = GetResolvedKeyFrameValue(currentResolvedKeyFrameIndex); } else { // Between two key frames. Double currentSegmentProgress = 0.0; Byte fromValue; if (currentResolvedKeyFrameIndex == 0) { // The current key frame is the first key frame so we have // some special rules for determining the fromValue and an // optimized method of calculating the currentSegmentProgress. // If we're additive we want the base value to be a zero value // so that if there isn't a key frame at time 0.0, we'll use // the zero value for the time 0.0 value and then add that // later to the base value. if (IsAdditive) { fromValue = AnimatedTypeHelpers.GetZeroValueByte(defaultOriginValue); } else { fromValue = defaultOriginValue; } // Current segment time divided by the segment duration. // Note: the reason this works is that we know that we're in // the first segment, so we can assume: // // currentTime.TotalMilliseconds = current segment time // _sortedResolvedKeyFrames[0]._resolvedKeyTime.TotalMilliseconds = current segment duration currentSegmentProgress = currentTime.TotalMilliseconds / _sortedResolvedKeyFrames[0]._resolvedKeyTime.TotalMilliseconds; } else { Int32 previousResolvedKeyFrameIndex = currentResolvedKeyFrameIndex - 1; TimeSpan previousResolvedKeyTime = _sortedResolvedKeyFrames[previousResolvedKeyFrameIndex]._resolvedKeyTime; fromValue = GetResolvedKeyFrameValue(previousResolvedKeyFrameIndex); TimeSpan segmentCurrentTime = currentTime - previousResolvedKeyTime; TimeSpan segmentDuration = _sortedResolvedKeyFrames[currentResolvedKeyFrameIndex]._resolvedKeyTime - previousResolvedKeyTime; currentSegmentProgress = segmentCurrentTime.TotalMilliseconds / segmentDuration.TotalMilliseconds; } currentIterationValue = GetResolvedKeyFrame(currentResolvedKeyFrameIndex).InterpolateValue(fromValue, currentSegmentProgress); } // If we're cumulative, we need to multiply the final key frame // value by the current repeat count and add this to the return // value. if (IsCumulative) { Double currentRepeat = (Double)(animationClock.CurrentIteration - 1); if (currentRepeat > 0.0) { currentIterationValue = AnimatedTypeHelpers.AddByte( currentIterationValue, AnimatedTypeHelpers.ScaleByte(GetResolvedKeyFrameValue(maxKeyFrameIndex), currentRepeat)); } } // If we're additive we need to add the base value to the return value. if (IsAdditive) { return AnimatedTypeHelpers.AddByte(defaultOriginValue, currentIterationValue); } return currentIterationValue; } /// <summary> /// Provide a custom natural Duration when the Duration property is set to Automatic. /// </summary> /// <param name="clock"> /// The Clock whose natural duration is desired. /// </param> /// <returns> /// If the last KeyFrame of this animation is a KeyTime, then this will /// be used as the NaturalDuration; otherwise it will be one second. /// </returns> protected override sealed Duration GetNaturalDurationCore(Clock clock) { return new Duration(LargestTimeSpanKeyTime); } #endregion #region IKeyFrameAnimation /// <summary> /// Returns the ByteKeyFrameCollection used by this KeyFrameByteAnimation. /// </summary> IList IKeyFrameAnimation.KeyFrames { get { return KeyFrames; } set { KeyFrames = (ByteKeyFrameCollection)value; } } /// <summary> /// Returns the ByteKeyFrameCollection used by this KeyFrameByteAnimation. /// </summary> public ByteKeyFrameCollection KeyFrames { get { ReadPreamble(); // The reason we don't just set _keyFrames to the empty collection // in the first place is that null tells us that the user has not // asked for the collection yet. The first time they ask for the // collection and we're unfrozen, policy dictates that we give // them a new unfrozen collection. All subsequent times they will // get whatever collection is present, whether frozen or unfrozen. if (_keyFrames == null) { if (this.IsFrozen) { _keyFrames = ByteKeyFrameCollection.Empty; } else { WritePreamble(); _keyFrames = new ByteKeyFrameCollection(); OnFreezablePropertyChanged(null, _keyFrames); WritePostscript(); } } return _keyFrames; } set { if (value == null) { throw new ArgumentNullException("value"); } WritePreamble(); if (value != _keyFrames) { OnFreezablePropertyChanged(_keyFrames, value); _keyFrames = value; WritePostscript(); } } } /// <summary> /// Returns true if we should serialize the KeyFrames, property for this Animation. /// </summary> /// <returns>True if we should serialize the KeyFrames property for this Animation; otherwise false.</returns> [EditorBrowsable(EditorBrowsableState.Never)] public bool ShouldSerializeKeyFrames() { ReadPreamble(); return _keyFrames != null && _keyFrames.Count > 0; } #endregion #region Public Properties /// <summary> /// If this property is set to true, this animation will add its value /// to the base value or the value of the previous animation in the /// composition chain. Another way of saying this is that the units /// specified in the animation are relative to the base value rather /// than absolute units. /// </summary> /// <remarks> /// In the case where the first key frame's resolved key time is not /// 0.0 there is slightly different behavior between KeyFrameByteAnimations /// with IsAdditive set and without. Animations with the property set to false /// will behave as if there is a key frame at time 0.0 with the value of the /// base value. Animations with the property set to true will behave as if /// there is a key frame at time 0.0 with a zero value appropriate to the type /// of the animation. These behaviors provide the results most commonly expected /// and can be overridden by simply adding a key frame at time 0.0 with the preferred value. /// </remarks> public bool IsAdditive { get { return (bool)GetValue(IsAdditiveProperty); } set { SetValueInternal(IsAdditiveProperty, BooleanBoxes.Box(value)); } } /// <summary> /// If this property is set to true, the value of this animation will /// accumulate over repeat cycles. For example, if this is a point /// animation and your key frames describe something approximating and /// arc, setting this property to true will result in an animation that /// would appear to bounce the point across the screen. /// </summary> /// <remarks> /// This property works along with the IsAdditive property. Setting /// this value to true has no effect unless IsAdditive is also set /// to true. /// </remarks> public bool IsCumulative { get { return (bool)GetValue(IsCumulativeProperty); } set { SetValueInternal(IsCumulativeProperty, BooleanBoxes.Box(value)); } } #endregion #region Private Methods private struct KeyTimeBlock { public int BeginIndex; public int EndIndex; } private Byte GetResolvedKeyFrameValue(Int32 resolvedKeyFrameIndex) { Debug.Assert(_areKeyTimesValid, "The key frames must be resolved and sorted before calling GetResolvedKeyFrameValue"); return GetResolvedKeyFrame(resolvedKeyFrameIndex).Value; } private ByteKeyFrame GetResolvedKeyFrame(Int32 resolvedKeyFrameIndex) { Debug.Assert(_areKeyTimesValid, "The key frames must be resolved and sorted before calling GetResolvedKeyFrame"); return _keyFrames[_sortedResolvedKeyFrames[resolvedKeyFrameIndex]._originalKeyFrameIndex]; } /// <summary> /// Returns the largest time span specified key time from all of the key frames. /// If there are not time span key times a time span of one second is returned /// to match the default natural duration of the From/To/By animations. /// </summary> private TimeSpan LargestTimeSpanKeyTime { get { bool hasTimeSpanKeyTime = false; TimeSpan largestTimeSpanKeyTime = TimeSpan.Zero; if (_keyFrames != null) { Int32 keyFrameCount = _keyFrames.Count; for (int index = 0; index < keyFrameCount; index++) { KeyTime keyTime = _keyFrames[index].KeyTime; if (keyTime.Type == KeyTimeType.TimeSpan) { hasTimeSpanKeyTime = true; if (keyTime.TimeSpan > largestTimeSpanKeyTime) { largestTimeSpanKeyTime = keyTime.TimeSpan; } } } } if (hasTimeSpanKeyTime) { return largestTimeSpanKeyTime; } else { return TimeSpan.FromSeconds(1.0); } } } private void ResolveKeyTimes() { Debug.Assert(!_areKeyTimesValid, "KeyFrameByteAnimaton.ResolveKeyTimes() shouldn't be called if the key times are already valid."); int keyFrameCount = 0; if (_keyFrames != null) { keyFrameCount = _keyFrames.Count; } if (keyFrameCount == 0) { _sortedResolvedKeyFrames = null; _areKeyTimesValid = true; return; } _sortedResolvedKeyFrames = new ResolvedKeyFrameEntry[keyFrameCount]; int index = 0; // Initialize the _originalKeyFrameIndex. for ( ; index < keyFrameCount; index++) { _sortedResolvedKeyFrames[index]._originalKeyFrameIndex = index; } // calculationDuration represents the time span we will use to resolve // percent key times. This is defined as the value in the following // precedence order: // 1. The animation's duration, but only if it is a time span, not auto or forever. // 2. The largest time span specified key time of all the key frames. // 3. 1 second, to match the From/To/By animations. TimeSpan calculationDuration = TimeSpan.Zero; Duration duration = Duration; if (duration.HasTimeSpan) { calculationDuration = duration.TimeSpan; } else { calculationDuration = LargestTimeSpanKeyTime; } int maxKeyFrameIndex = keyFrameCount - 1; ArrayList unspecifiedBlocks = new ArrayList(); bool hasPacedKeyTimes = false; // // Pass 1: Resolve Percent and Time key times. // index = 0; while (index < keyFrameCount) { KeyTime keyTime = _keyFrames[index].KeyTime; switch (keyTime.Type) { case KeyTimeType.Percent: _sortedResolvedKeyFrames[index]._resolvedKeyTime = TimeSpan.FromMilliseconds( keyTime.Percent * calculationDuration.TotalMilliseconds); index++; break; case KeyTimeType.TimeSpan: _sortedResolvedKeyFrames[index]._resolvedKeyTime = keyTime.TimeSpan; index++; break; case KeyTimeType.Paced: case KeyTimeType.Uniform: if (index == maxKeyFrameIndex) { // If the last key frame doesn't have a specific time // associated with it its resolved key time will be // set to the calculationDuration, which is the // defined in the comments above where it is set. // Reason: We only want extra time at the end of the // key frames if the user specifically states that // the last key frame ends before the animation ends. _sortedResolvedKeyFrames[index]._resolvedKeyTime = calculationDuration; index++; } else if ( index == 0 && keyTime.Type == KeyTimeType.Paced) { // Note: It's important that this block come after // the previous if block because of rule precendence. // If the first key frame in a multi-frame key frame // collection is paced, we set its resolved key time // to 0.0 for performance reasons. If we didn't, the // resolved key time list would be dependent on the // base value which can change every animation frame // in many cases. _sortedResolvedKeyFrames[index]._resolvedKeyTime = TimeSpan.Zero; index++; } else { if (keyTime.Type == KeyTimeType.Paced) { hasPacedKeyTimes = true; } KeyTimeBlock block = new KeyTimeBlock(); block.BeginIndex = index; // NOTE: We don't want to go all the way up to the // last frame because if it is Uniform or Paced its // resolved key time will be set to the calculation // duration using the logic above. // // This is why the logic is: // ((++index) < maxKeyFrameIndex) // instead of: // ((++index) < keyFrameCount) while ((++index) < maxKeyFrameIndex) { KeyTimeType type = _keyFrames[index].KeyTime.Type; if ( type == KeyTimeType.Percent || type == KeyTimeType.TimeSpan) { break; } else if (type == KeyTimeType.Paced) { hasPacedKeyTimes = true; } } Debug.Assert(index < keyFrameCount, "The end index for a block of unspecified key frames is out of bounds."); block.EndIndex = index; unspecifiedBlocks.Add(block); } break; } } // // Pass 2: Resolve Uniform key times. // for (int j = 0; j < unspecifiedBlocks.Count; j++) { KeyTimeBlock block = (KeyTimeBlock)unspecifiedBlocks[j]; TimeSpan blockBeginTime = TimeSpan.Zero; if (block.BeginIndex > 0) { blockBeginTime = _sortedResolvedKeyFrames[block.BeginIndex - 1]._resolvedKeyTime; } // The number of segments is equal to the number of key // frames we're working on plus 1. Think about the case // where we're working on a single key frame. There's a // segment before it and a segment after it. // // Time known Uniform Time known // ^ ^ ^ // | | | // | (segment 1) | (segment 2) | Int64 segmentCount = (block.EndIndex - block.BeginIndex) + 1; TimeSpan uniformTimeStep = TimeSpan.FromTicks((_sortedResolvedKeyFrames[block.EndIndex]._resolvedKeyTime - blockBeginTime).Ticks / segmentCount); index = block.BeginIndex; TimeSpan resolvedTime = blockBeginTime + uniformTimeStep; while (index < block.EndIndex) { _sortedResolvedKeyFrames[index]._resolvedKeyTime = resolvedTime; resolvedTime += uniformTimeStep; index++; } } // // Pass 3: Resolve Paced key times. // if (hasPacedKeyTimes) { ResolvePacedKeyTimes(); } // // Sort resolved key frame entries. // Array.Sort(_sortedResolvedKeyFrames); _areKeyTimesValid = true; return; } /// <summary> /// This should only be called from ResolveKeyTimes and only at the /// appropriate time. /// </summary> private void ResolvePacedKeyTimes() { Debug.Assert(_keyFrames != null && _keyFrames.Count > 2, "Caller must guard against calling this method when there are insufficient keyframes."); // If the first key frame is paced its key time has already // been resolved, so we start at index 1. int index = 1; int maxKeyFrameIndex = _sortedResolvedKeyFrames.Length - 1; do { if (_keyFrames[index].KeyTime.Type == KeyTimeType.Paced) { // // We've found a paced key frame so this is the // beginning of a paced block. // // The first paced key frame in this block. int firstPacedBlockKeyFrameIndex = index; // List of segment lengths for this paced block. List<Double> segmentLengths = new List<Double>(); // The resolved key time for the key frame before this // block which we'll use as our starting point. TimeSpan prePacedBlockKeyTime = _sortedResolvedKeyFrames[index - 1]._resolvedKeyTime; // The total of the segment lengths of the paced key // frames in this block. Double totalLength = 0.0; // The key value of the previous key frame which will be // used to determine the segment length of this key frame. Byte prevKeyValue = _keyFrames[index - 1].Value; do { Byte currentKeyValue = _keyFrames[index].Value; // Determine the segment length for this key frame and // add to the total length. totalLength += AnimatedTypeHelpers.GetSegmentLengthByte(prevKeyValue, currentKeyValue); // Temporarily store the distance into the total length // that this key frame represents in the resolved // key times array to be converted to a resolved key // time outside of this loop. segmentLengths.Add(totalLength); // Prepare for the next iteration. prevKeyValue = currentKeyValue; index++; } while ( index < maxKeyFrameIndex && _keyFrames[index].KeyTime.Type == KeyTimeType.Paced); // index is currently set to the index of the key frame // after the last paced key frame. This will always // be a valid index because we limit ourselves with // maxKeyFrameIndex. // We need to add the distance between the last paced key // frame and the next key frame to get the total distance // inside the key frame block. totalLength += AnimatedTypeHelpers.GetSegmentLengthByte(prevKeyValue, _keyFrames[index].Value); // Calculate the time available in the resolved key time space. TimeSpan pacedBlockDuration = _sortedResolvedKeyFrames[index]._resolvedKeyTime - prePacedBlockKeyTime; // Convert lengths in segmentLengths list to resolved // key times for the paced key frames in this block. for (int i = 0, currentKeyFrameIndex = firstPacedBlockKeyFrameIndex; i < segmentLengths.Count; i++, currentKeyFrameIndex++) { // The resolved key time for each key frame is: // // The key time of the key frame before this paced block // + ((the percentage of the way through the total length) // * the resolved key time space available for the block) _sortedResolvedKeyFrames[currentKeyFrameIndex]._resolvedKeyTime = prePacedBlockKeyTime + TimeSpan.FromMilliseconds( (segmentLengths[i] / totalLength) * pacedBlockDuration.TotalMilliseconds); } } else { index++; } } while (index < maxKeyFrameIndex); } #endregion } }
mind0n/hive
Cache/Libs/net46/wpf/src/Core/CSharp/System/Windows/Media/Animation/Generated/ByteAnimationUsingKeyFrames.cs
C#
mit
39,816
'use strict'; const Hoek = require('hoek'); exports.plugin = { register: async (plugin, options) => { plugin.ext('onPreResponse', (request, h) => { try { var internals = { devEnv: (process.env.NODE_ENV === 'development'), meta: options.meta, credentials: request.auth.isAuthenticated ? request.auth.credentials : null }; var response = request.response; if (response.variety && response.variety === 'view') { response.source.context = Hoek.merge(internals, request.response.source.context); } return h.continue; } catch (error) { throw error; } }); }, pkg: require('../package.json'), name: 'context' };
SystangoTechnologies/Hapiness
lib/context.js
JavaScript
mit
672
'use strict'; //Customers service used to communicate Customers REST endpoints angular.module('customers') .factory('Customers', ['$resource', function($resource) { return $resource('customers/:customerId', { customerId: '@_id' }, { update: { method: 'PUT' } }); } ]) .factory('Notify', ['$rootScope', function($rootScope) { var notify = {}; notify.sendMsg = function(msg, data) { data = data || {}; $rootScope.$emit(msg, data); console.log('message sent!'); }; notify.getMsg = function(msg, func, scope) { var unbind = $rootScope.$on(msg, func); if (scope) { scope.$on('destroy', unbind); } }; return notify; } ]);
armackey/spa_practice
public/modules/customers/services/customers.client.service.js
JavaScript
mit
724
#pragma once char separator; #ifdef _WIN32 #define DIR_SEPARATOR '\\' #else #define DIR_SEPARATOR '/' #endif #include <string> #include <algorithm> using namespace std; class PathUtil{ public: /*A small function to extract FileName from File Path C:/File.exe -> File.exe */ string static extractFileName(string FilePath){ int separatorlast = FilePath.find_last_of(DIR_SEPARATOR); return FilePath.substr(separatorlast + 1, FilePath.length() - separatorlast); } string static extractFileExt(string FilePath){ int separatorlast = FilePath.find_last_of('.'); string FileExt = FilePath.substr(separatorlast + 1, FilePath.length() - separatorlast); std::transform(FileExt.begin(), FileExt.end(), FileExt.begin(), ::tolower); return FileExt; } string static extractFileNamewithoutExt(string FilePath){ string FileName = extractFileName(FilePath); int separatorlast = FilePath.find_last_of(DIR_SEPARATOR); int dotlast = FilePath.find_last_of('.'); return FilePath.substr(separatorlast + 1, dotlast); } string static extractDirPath(string FilePath){ string FileName = extractFileName(FilePath); int separatorlast = FilePath.find_last_of(DIR_SEPARATOR); int dotlast = FilePath.find_first_of('.'); return FilePath.substr(separatorlast + 1, dotlast - separatorlast -1); } };
snoobvn/HuffMan
HuffMan/PathUtil.h
C
mit
1,305
/* some devices call home before accepting a wifi access point. Spoof those responses. */ var path = require('path'); exports.load = function(server, boatData, settings) { var endpointMap = [ {'route': '/kindle-wifi/wifiredirect.html', 'responseFile': 'kindle.html'} , {'route': '/kindle-wifi/wifistub.html', 'responseFile': 'kindle.html'} //http://spectrum.s3.amazonaws.com ]; _.each(endpointMap, function(endpoint) { server.get(endpoint.route, function(req, res) { res.sendFile(path.join(__dirname + endpoint.responseFile)); }); }); };
HomegrownMarine/boat_computer
apps/wifi_allow/app.js
JavaScript
mit
603
# twitterStreamerMap To start the project ``` git clone https://github.com/klosorio10/ExamenFinalWebDev.git cd ExamenFinalWebdev cd ExamenFinal ``` A simple boilerplate for a Meteor 1.4 Twitter streamer application with React. Uses the twitter [npm](https://www.npmjs.com/package/twitter) module for connecting to twitter. It requires you to setup your credentials on the server using environment variables: ``` export TWITTER_CONSUMER_KEY="yourCredentialsHere" export TWITTER_CONSUMER_SECRET="yourCredentialsHere" export TWITTER_ACCESS_TOKEN_KEY="yourCredentialsHere" export TWITTER_ACCESS_TOKEN_SECRET="yourCredentialsHere" meteor npm install meteor ``` This is a very basic implementation that handles a global search shared by all users and doesn't implement any security or restriction. It's intended as a starting point, so add your own requirements.
klosorio10/ExamenFinalWebDev
README.md
Markdown
mit
866
USE [VipunenTK] GO /****** Object: Table [dbo].[d_erikoislaakarikoulutus] Script Date: 14.9.2017 13:55:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[d_erikoislaakarikoulutus]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[d_erikoislaakarikoulutus]( [id] [int] NOT NULL, [alkaa] [date] NOT NULL, [paattyy] [date] NOT NULL, [erikoislaakarikoulutus_koodi] [nvarchar](2) NOT NULL, [erikoislaakarikoulutus] [nvarchar](200) NULL, [erikoislaakarikoulutus_SV] [nvarchar](200) NULL, [erikoislaakarikoulutus_EN] [nvarchar](200) NULL, [jarjestys] [nvarchar](50) NULL, [tietolahde] [nvarchar](50) NULL ) ON [PRIMARY] END GO INSERT [dbo].[d_erikoislaakarikoulutus] ([id], [alkaa], [paattyy], [erikoislaakarikoulutus_koodi], [erikoislaakarikoulutus], [erikoislaakarikoulutus_SV], [erikoislaakarikoulutus_EN], [jarjestys], [tietolahde]) VALUES (-2, CAST(N'1900-01-01' AS Date), CAST(N'9999-01-01' AS Date), N'-2', N'Virhetilanne', N'Feltillstånd', N'Error occurred', N'99999', N'Manuaalinen') GO INSERT [dbo].[d_erikoislaakarikoulutus] ([id], [alkaa], [paattyy], [erikoislaakarikoulutus_koodi], [erikoislaakarikoulutus], [erikoislaakarikoulutus_SV], [erikoislaakarikoulutus_EN], [jarjestys], [tietolahde]) VALUES (-1, CAST(N'1900-01-01' AS Date), CAST(N'9999-01-01' AS Date), N'-1', N'Tuntematon', N'Information saknas', N'Missing data', N'99998', N'Manuaalinen') GO INSERT [dbo].[d_erikoislaakarikoulutus] ([id], [alkaa], [paattyy], [erikoislaakarikoulutus_koodi], [erikoislaakarikoulutus], [erikoislaakarikoulutus_SV], [erikoislaakarikoulutus_EN], [jarjestys], [tietolahde]) VALUES (1, CAST(N'1900-01-01' AS Date), CAST(N'9999-01-01' AS Date), N'1', N'Erikoislääkärit', N'*SV*Erikoislääkärit', N'*EN*Erikoislääkärit', N'1', N'Tilastokeskus') GO INSERT [dbo].[d_erikoislaakarikoulutus] ([id], [alkaa], [paattyy], [erikoislaakarikoulutus_koodi], [erikoislaakarikoulutus], [erikoislaakarikoulutus_SV], [erikoislaakarikoulutus_EN], [jarjestys], [tietolahde]) VALUES (2, CAST(N'1900-01-01' AS Date), CAST(N'9999-01-01' AS Date), N'2', N'Erikoishammaslääkärit', N'*SV*Erikoishammaslääkärit', N'*EN*Erikoishammaslääkärit', N'2', N'Tilastokeskus') GO USE [ANTERO]
CSCfi/antero
db_archive/sql_archive/762__create_table_vipunentk_erikoislaakarikoulutus.sql
SQL
mit
2,268
# diofa-vendeghaz-orfu www.diofa-vendeghaz-orfu.hu
kmARC/diofa-vendeghaz-orfu
README.md
Markdown
mit
51
# Basics Toast is a Rack application that hooks into Ruby on Rails providing a REST interface for ActiveRecord models. For each model a HTTP interface can be configured. Using Toast's configuration DSL one declares which of its attributes are exposed, which are readable and/or writable using white lists. Web Service Provider Web Service Consumer ----------------- ----------------- | Toast | <--HTTP/REST--> | AJAX app, | ----------------- | mobile app, | | | \ | Java app, etc.| ----------- ----------- ----------- ----------------- | Model A | | Model B | | Model C | ----------- ----------- ---------- Toast dispatches any request to the right model class by using naming conventions. That way a model can be exposed on the web by a simple configuration file under `config/toast-api/coconut.rb`: {% highlight ruby %} expose(Coconut) { readables :color, :weight via_get { # for GET /coconut/ID allow do |user, coconut, uri_params| user.is_admin? end } collection(:all) { via_get { # for GET /coconuts allow do |user, coconut, uri_params| user.is_admin? end } } } {% endhighlight %} This exposes the model Coconut. Toast would respond like this: GET /coconuts --> 200 OK --> [{"self":"https://www.example.com/coconuts/1","color":...,"weight":...}, {"self":"https://www.example.com/coconuts/2","color":...,"weight":...}, {"self":"https://www.example.com/coconuts/3","color":...,"weight":...}] given there are 3 rows in the table _coconuts_. Note that this request translates to the ActiveRecord call `Coconut.all`, hence the exposition of the `all` collection. Each of the URIs in the response will fetch the respective Coconut instances: GET /coconut/2 --> 200 OK --> {"self": "https://www.example.com/coconuts/2", "color": "brown", "weight": 2.1} `color` and `weight` were declared in the `readables` list. That means these attributes are exposed via GET requests, but not updatable by PATCH requests. To allow that attributes must be declared writable: {% highlight ruby %} expose(Coconut) { readables :color writables :weight } {% endhighlight %} POST and DELETE operations must be allowed explicitly: {% highlight ruby %} expose(Coconut) { readables :color, :weight via_get { # for GET /coconut/ID allow do |user, coconut, uri_params| user.is_admin? end } via_delete { # for DELETE /coconut/ID allow do |user, coconut, uri_params| user.is_admin? end } collection(:all) { via_get { # for GET /coconuts allow do |user, coconut, uri_params| user.is_admin? end } via_post { # for POST /coconuts allow do |user, coconut, uri_params| user.is_admin? end } } } {% endhighlight %} The above permits to POST a new record (== `Coconut.create(...)` and to DELETE single instances (== `Coconnut.find(id).destroy`): POST /coconuts <-- {"color": "yellow", "weight": 42.0} --> 201 Created --> {"self": "https://www.example.com/coconuts/4", "color": "yellow", "weight": 42.0} DELETE /coconut/3 --> 200 OK Nonetheless exposing associations will render your entire data model (or parts of it) a complete web-service. Associations will be represented as URIs via which the associated resource(s) can be fetched: {% highlight ruby %} class Coconut < ActiveRecord::Base belongs_to :tree has_many :consumers end {% endhighlight %} together with `config/toast-api/coconut.rb`: {% highlight ruby %} expose(Coconut) { readables :color, :weight association(:tree) { via_get { allow do |*args| true end } } association(:consumers) { via_get { allow do |user, coconut, uri_params| user.role == 'admin' end } via_post { allow do |user, coconut, uri_params| user.role == 'admin' end } } } {% endhighlight %} GET /coconut/2 --> 200 OK --> {"self": "https://www.example.com/coconuts/2", "tree": "https://www.example.com/coconuts/2/tree", "consumers": "https://www.example.com/consumers", "color": "brown", "weight": 2.1} ## Representation Toast's JSON representation is very minimal. As you can see above it does not have any qualification of the properties. Data and links and even structured property value are possible. There are other standards like [HAL](http://stateless.co/hal_specification.html), [Siren](https://github.com/kevinswiber/siren), [Collection+JSON](http://amundsen.com/media-types/collection/) or [JSON API](http://jsonapi.org) on that matter you may also consider. Toast's key ideas and distinguishing features are: Simplicity and Opaque URIs. The JSON representation was guided by the idea that any client(/-programmer) must know the representation of each resource by documentation anyway, so there is no need to nest links in a 'links' sub structure like JSON API does. The only rules for Toast's JSON representation are: * The `self` property is the canonical URI (see below) of the model/resource * Link properties are named like ActiveRecord associations in the model and are not in non-canonical form * Data properties are named as the corresponding attributes of the model. They can contain any type and also structured data (serialized by AR or self constructed). ## URIs Toast treats URIs generally as opaque strings, meaning that it only uses complete URLs and has no concept of "URL templates" for processing. Such templates may only appear in the documentation. The canonical form of a URI for a model/resource is: `https://<HOST>/<PATH>/<RESOURCE>/<ID>?<PARAMS>`, where * `https://<HOST>` is FQDN. * `<PATH>` is an optional path segment, * `<RESOURCE>` is name of the resource/model * `<ID>` is a string of digits: `[0-9]+`, * `<PARAMS>` is an optional list of query parameters Association URIs composed like: `<CANONICAL>/<ASSOCIATION>?<PARAMS>`, where * `<CANONICAL>` is as defined above * `<ASSOCIATION>` is the name a models association (`has_many`, `belongs_to`, ...) Root collection URIs are also provided: `https://<HOST>/<PATH>/<RESOURCES>?<PARAMS>`. The string `<RESOURCES>` is named after a class method of a model that returns a relation to a collection of instances of the same model. ## Association Treatment Model instances link each other and construct a web of model instances/resources. The web is conveyed by URIs that can be traversed by GET request. All model association that are exposed appear in the JSON response as a URL, nothing else (embedding can be achieved through regular data properties). Association properties never change when associations change, because they don't use the canonical URI form. They can be used to issue a * a POST request to create a new resource + linking to the base resource, * a DELETE request to delete a model instance/resource, * a LINK request in order to link existing model instances/resources using a second canonical URI or * a UNLINK request in order to remove a association/link between model instances/resources without deleting a model instance/resource. All these actions are directly mapped to the corresponding ActiveRecord calls on associations.
robokopp/toast
docs/introduction.md
Markdown
mit
7,511
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; using TestProjectFromCsv.ValidationSteps; namespace TestProjectFromCsv { public class Program { public static void Main(string[] args) { try { var options = new Options(); if (CommandLine.Parser.Default.ParseArguments(args, options)) { var validation = new Validation( new ValidationStep[] { new CsvFileExists(options), new TemplateFilesExist(options) }); if (!validation.IsValid()) { foreach (string issue in validation.Issues) { Console.WriteLine(issue); } } else { Directory.CreateDirectory(Path.Combine(options.ProjectPath, options.ProjectName)); CsvFile csvFile = new CsvFile(options.CsvFile); IList<CsvRecord> testRecords = csvFile.Parse(); StringBuilder allTestProjects = new StringBuilder(100 + testRecords.Count * 100); TemplateFileGenerator testTemplateGen = new TemplateFileGenerator(Path.Combine(options.TemplatePath, "Test.tmp")); foreach (CsvRecord record in testRecords) { string filename = Path.Combine( options.ProjectPath, options.ProjectName, string.Format("{0}.GenericTest", record.TestName)); try { allTestProjects.AppendLine(string.Format("\t<None Include=\"{0}.GenericTest\">", record.TestName)); allTestProjects.AppendLine("\t\t<CopyToOutputDirectory>Always</CopyToOutputDirectory>"); allTestProjects.AppendLine("\t</None>"); testTemplateGen.GenerateFile(filename, new Dictionary<string, string>() { { "[[TestName]]" , record.TestName } , { "[[FullFilePath]]", filename } , { "[[TestGuid]]", Guid.NewGuid().ToString("D") } , { "[[CommandFullFilePath]]", Path.Combine(options.CommandPath, record.BatchFile)} }); } catch (Exception ex) { Console.WriteLine(string.Format("Error building file '{0}' : {1}", filename, ex.Message)); } } string assemblyInfoFilename = Path.Combine(options.ProjectPath, options.ProjectName, "Properties", "AssemblyInfo.cs"); try { Directory.CreateDirectory(Path.Combine(options.ProjectPath, options.ProjectName, "Properties")); TemplateFileGenerator assemblyInfoGen = new TemplateFileGenerator(Path.Combine(options.TemplatePath, "AssemblyInfo.cs.tmp")); assemblyInfoGen.GenerateFile(assemblyInfoFilename, new Dictionary<string, string>() { { "[[ProjectName]]" , options.ProjectName } , { "[[AssemblyGuid]]", Guid.NewGuid().ToString("D") } }); } catch (Exception ex) { Console.WriteLine(string.Format("Error building file '{0}' : {1}", assemblyInfoFilename, ex.Message)); } string projectFileName = Path.Combine(options.ProjectPath, options.ProjectName, string.Format("{0}.csproj", options.ProjectName)); try { TemplateFileGenerator projectFileGen = new TemplateFileGenerator(Path.Combine(options.TemplatePath, "ProjectTemplate.proj.tmp")); projectFileGen.GenerateFile(projectFileName, new Dictionary<string, string>() { { "[[ProjectGuid]]", Guid.NewGuid().ToString("B") } , { "[[ProjectName]]" , options.ProjectName } , { "[[Tests]]" , allTestProjects.ToString() } }); } catch (Exception ex) { Console.WriteLine(string.Format("Error building file '{0}' : {1}", projectFileName, ex.Message)); } Console.WriteLine("Done."); } } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } } } }
jtwebman/GenericTestProjectGenerator
TestProjectFromCsv/Program.cs
C#
mit
5,551
class AlbumsController < ApplicationController respond_to :html, :xml, :json attr_reader :current_album_type, :author_name load_and_authorize_resource def index @albums = Album.by_type params[:album_type] respond_with(@albums) end def show get_current_album_type get_author_name if @current_album_type.name.singularize == 'Picture' @album_pictures = @album.pictures.paginate(:page => params[:page], :per_page => 12) elsif @current_album_type.name.singularize == 'Video' @album_videos = @album.videos.paginate(:page => params[:page], :per_page => 12) end respond_with(@album) end def new @album.album_type_id = params[:album_type] get_current_album_type respond_with(@album) end def edit get_current_album_type respond_with(@album) end def create @album.user_id = user_signed_in? ? current_user.id : 0 flash[:notice] = 'Album was successfully created.' if @album.save get_current_album_type respond_with(@album) end def update @album.update_attributes(params[:album]) respond_with(@album) end def destroy @album.destroy flash[:notice] = 'Successfully destroyed album.' redirect_to albums_path(:album_type => @album.album_type_id) end private def get_current_album_type @current_album_type = AlbumType.all.find { |album_type| album_type.id == @album.album_type_id } end def get_author_name @author_name = (@album.user_id > 0) \ ? User.find { |user| user.id == @album.user_id }.name \ : 'Anonymous' end end
quattro004/scratches
app/controllers/albums_controller.rb
Ruby
mit
1,594
// フォーマット var koyomi = require('../..').create(); var format = koyomi.format.bind(koyomi); var eq = require('assert').equal; koyomi.startMonth = 1; // 序数 (CC:経過日数) eq(format(20150101, 'CC'), '1'); eq(format(20150101, 'CC>0'), '1st'); eq(format(20150102, 'CC>0'), '2nd'); eq(format(20150103, 'CC>0'), '3rd'); eq(format(20150104, 'CC>0'), '4th'); eq(format(20150105, 'CC>0'), '5th'); eq(format(20150106, 'CC>0'), '6th'); eq(format(20150107, 'CC>0'), '7th'); eq(format(20150108, 'CC>0'), '8th'); eq(format(20150109, 'CC>0'), '9th'); eq(format(20150110, 'CC>0'), '10th'); eq(format(20150111, 'CC>0'), '11th'); eq(format(20150112, 'CC>0'), '12th'); eq(format(20150113, 'CC>0'), '13th'); eq(format(20150114, 'CC>0'), '14th'); eq(format(20150115, 'CC>0'), '15th'); eq(format(20150116, 'CC>0'), '16th'); eq(format(20150117, 'CC>0'), '17th'); eq(format(20150118, 'CC>0'), '18th'); eq(format(20150119, 'CC>0'), '19th'); eq(format(20150120, 'CC>0'), '20th'); eq(format(20150121, 'CC>0'), '21st'); eq(format(20150122, 'CC>0'), '22nd'); eq(format(20150123, 'CC>0'), '23rd'); eq(format(20150124, 'CC>0'), '24th'); eq(format(20150125, 'CC>0'), '25th'); eq(format(20150126, 'CC>0'), '26th'); eq(format(20150127, 'CC>0'), '27th'); eq(format(20150128, 'CC>0'), '28th'); eq(format(20150129, 'CC>0'), '29th'); eq(format(20150130, 'CC>0'), '30th'); eq(format(20150131, 'CC>0'), '31st'); eq(format(20150201, 'CC>0'), '32nd'); eq(format(20150202, 'CC>0'), '33rd'); eq(format(20150203, 'CC>0'), '34th'); eq(format(20150204, 'CC>0'), '35th'); eq(format(20150205, 'CC>0'), '36th'); eq(format(20150206, 'CC>0'), '37th'); eq(format(20150207, 'CC>0'), '38th'); eq(format(20150208, 'CC>0'), '39th'); eq(format(20150209, 'CC>0'), '40th'); eq(format(20150210, 'CC>0'), '41st'); eq(format(20150211, 'CC>0'), '42nd'); eq(format(20150212, 'CC>0'), '43rd'); eq(format(20150213, 'CC>0'), '44th'); eq(format(20150214, 'CC>0'), '45th'); eq(format(20150215, 'CC>0'), '46th'); eq(format(20150216, 'CC>0'), '47th'); eq(format(20150217, 'CC>0'), '48th'); eq(format(20150218, 'CC>0'), '49th'); eq(format(20150219, 'CC>0'), '50th'); eq(format(20150220, 'CC>0'), '51st'); eq(format(20150221, 'CC>0'), '52nd'); eq(format(20150222, 'CC>0'), '53rd'); eq(format(20150223, 'CC>0'), '54th'); eq(format(20150224, 'CC>0'), '55th'); eq(format(20150225, 'CC>0'), '56th'); eq(format(20150226, 'CC>0'), '57th'); eq(format(20150227, 'CC>0'), '58th'); eq(format(20150228, 'CC>0'), '59th'); eq(format(20150301, 'CC>0'), '60th'); eq(format(20150302, 'CC>0'), '61st'); eq(format(20150303, 'CC>0'), '62nd'); eq(format(20150304, 'CC>0'), '63rd'); eq(format(20150305, 'CC>0'), '64th'); eq(format(20150306, 'CC>0'), '65th'); eq(format(20150307, 'CC>0'), '66th'); eq(format(20150308, 'CC>0'), '67th'); eq(format(20150309, 'CC>0'), '68th'); eq(format(20150310, 'CC>0'), '69th'); eq(format(20150311, 'CC>0'), '70th'); eq(format(20150312, 'CC>0'), '71st'); eq(format(20150313, 'CC>0'), '72nd'); eq(format(20150314, 'CC>0'), '73rd'); eq(format(20150315, 'CC>0'), '74th'); eq(format(20150316, 'CC>0'), '75th'); eq(format(20150317, 'CC>0'), '76th'); eq(format(20150318, 'CC>0'), '77th'); eq(format(20150319, 'CC>0'), '78th'); eq(format(20150320, 'CC>0'), '79th'); eq(format(20150321, 'CC>0'), '80th'); eq(format(20150322, 'CC>0'), '81st'); eq(format(20150323, 'CC>0'), '82nd'); eq(format(20150324, 'CC>0'), '83rd'); eq(format(20150325, 'CC>0'), '84th'); eq(format(20150326, 'CC>0'), '85th'); eq(format(20150327, 'CC>0'), '86th'); eq(format(20150328, 'CC>0'), '87th'); eq(format(20150329, 'CC>0'), '88th'); eq(format(20150330, 'CC>0'), '89th'); eq(format(20150331, 'CC>0'), '90th'); eq(format(20150401, 'CC>0'), '91st'); eq(format(20150402, 'CC>0'), '92nd'); eq(format(20150403, 'CC>0'), '93rd'); eq(format(20150404, 'CC>0'), '94th'); eq(format(20150405, 'CC>0'), '95th'); eq(format(20150406, 'CC>0'), '96th'); eq(format(20150407, 'CC>0'), '97th'); eq(format(20150408, 'CC>0'), '98th'); eq(format(20150409, 'CC>0'), '99th'); eq(format(20150410, 'CC>0'), '100th'); eq(format(20150411, 'CC>0'), '101st'); eq(format(20150412, 'CC>0'), '102nd'); eq(format(20150413, 'CC>0'), '103rd'); eq(format(20150414, 'CC>0'), '104th'); eq(format(20150415, 'CC>0'), '105th'); eq(format(20150416, 'CC>0'), '106th'); eq(format(20150417, 'CC>0'), '107th'); eq(format(20150418, 'CC>0'), '108th'); eq(format(20150419, 'CC>0'), '109th'); eq(format(20150420, 'CC>0'), '110th'); eq(format(20150421, 'CC>0'), '111th'); eq(format(20150422, 'CC>0'), '112th'); eq(format(20150423, 'CC>0'), '113th'); eq(format(20150424, 'CC>0'), '114th'); eq(format(20150425, 'CC>0'), '115th'); eq(format(20150426, 'CC>0'), '116th'); eq(format(20150427, 'CC>0'), '117th'); eq(format(20150428, 'CC>0'), '118th'); eq(format(20150429, 'CC>0'), '119th'); eq(format(20150430, 'CC>0'), '120th'); eq(format(20150501, 'CC>0'), '121st'); eq(format(20150502, 'CC>0'), '122nd'); eq(format(20150503, 'CC>0'), '123rd'); eq(format(20150504, 'CC>0'), '124th'); eq(format(20150505, 'CC>0'), '125th'); eq(format(20150506, 'CC>0'), '126th'); eq(format(20150507, 'CC>0'), '127th'); eq(format(20150508, 'CC>0'), '128th'); eq(format(20150509, 'CC>0'), '129th'); eq(format(20150510, 'CC>0'), '130th'); eq(format(20150511, 'CC>0'), '131st'); eq(format(20150512, 'CC>0'), '132nd'); eq(format(20150513, 'CC>0'), '133rd'); eq(format(20150514, 'CC>0'), '134th'); eq(format(20150515, 'CC>0'), '135th'); eq(format(20150516, 'CC>0'), '136th'); eq(format(20150517, 'CC>0'), '137th'); eq(format(20150518, 'CC>0'), '138th'); eq(format(20150519, 'CC>0'), '139th'); eq(format(20150520, 'CC>0'), '140th'); eq(format(20150521, 'CC>0'), '141st'); eq(format(20150522, 'CC>0'), '142nd'); eq(format(20150523, 'CC>0'), '143rd'); eq(format(20150524, 'CC>0'), '144th'); eq(format(20150525, 'CC>0'), '145th'); eq(format(20150526, 'CC>0'), '146th'); eq(format(20150527, 'CC>0'), '147th'); eq(format(20150528, 'CC>0'), '148th'); eq(format(20150529, 'CC>0'), '149th'); eq(format(20150530, 'CC>0'), '150th'); eq(format(20150531, 'CC>0'), '151st'); eq(format(20150601, 'CC>0'), '152nd'); eq(format(20150602, 'CC>0'), '153rd'); eq(format(20150603, 'CC>0'), '154th'); eq(format(20150604, 'CC>0'), '155th'); eq(format(20150605, 'CC>0'), '156th'); eq(format(20150606, 'CC>0'), '157th'); eq(format(20150607, 'CC>0'), '158th'); eq(format(20150608, 'CC>0'), '159th'); eq(format(20150609, 'CC>0'), '160th'); eq(format(20150610, 'CC>0'), '161st'); eq(format(20150611, 'CC>0'), '162nd'); eq(format(20150612, 'CC>0'), '163rd'); eq(format(20150613, 'CC>0'), '164th'); eq(format(20150614, 'CC>0'), '165th'); eq(format(20150615, 'CC>0'), '166th'); eq(format(20150616, 'CC>0'), '167th'); eq(format(20150617, 'CC>0'), '168th'); eq(format(20150618, 'CC>0'), '169th'); eq(format(20150619, 'CC>0'), '170th'); eq(format(20150620, 'CC>0'), '171st'); eq(format(20150621, 'CC>0'), '172nd'); eq(format(20150622, 'CC>0'), '173rd'); eq(format(20150623, 'CC>0'), '174th'); eq(format(20150624, 'CC>0'), '175th'); eq(format(20150625, 'CC>0'), '176th'); eq(format(20150626, 'CC>0'), '177th'); eq(format(20150627, 'CC>0'), '178th'); eq(format(20150628, 'CC>0'), '179th'); eq(format(20150629, 'CC>0'), '180th'); eq(format(20150630, 'CC>0'), '181st'); eq(format(20150701, 'CC>0'), '182nd'); eq(format(20150702, 'CC>0'), '183rd'); eq(format(20150703, 'CC>0'), '184th'); eq(format(20150704, 'CC>0'), '185th'); eq(format(20150705, 'CC>0'), '186th'); eq(format(20150706, 'CC>0'), '187th'); eq(format(20150707, 'CC>0'), '188th'); eq(format(20150708, 'CC>0'), '189th'); eq(format(20150709, 'CC>0'), '190th'); eq(format(20150710, 'CC>0'), '191st'); eq(format(20150711, 'CC>0'), '192nd'); eq(format(20150712, 'CC>0'), '193rd'); eq(format(20150713, 'CC>0'), '194th'); eq(format(20150714, 'CC>0'), '195th'); eq(format(20150715, 'CC>0'), '196th'); eq(format(20150716, 'CC>0'), '197th'); eq(format(20150717, 'CC>0'), '198th'); eq(format(20150718, 'CC>0'), '199th'); eq(format(20150719, 'CC>0'), '200th'); eq(format(20150720, 'CC>0'), '201st'); eq(format(20150721, 'CC>0'), '202nd'); eq(format(20150722, 'CC>0'), '203rd'); eq(format(20150723, 'CC>0'), '204th'); eq(format(20150724, 'CC>0'), '205th'); eq(format(20150725, 'CC>0'), '206th'); eq(format(20150726, 'CC>0'), '207th'); eq(format(20150727, 'CC>0'), '208th'); eq(format(20150728, 'CC>0'), '209th'); eq(format(20150729, 'CC>0'), '210th'); eq(format(20150730, 'CC>0'), '211th'); eq(format(20150731, 'CC>0'), '212th'); eq(format(20150801, 'CC>0'), '213th'); eq(format(20150802, 'CC>0'), '214th'); eq(format(20150803, 'CC>0'), '215th'); eq(format(20150804, 'CC>0'), '216th'); eq(format(20150805, 'CC>0'), '217th'); eq(format(20150806, 'CC>0'), '218th'); eq(format(20150807, 'CC>0'), '219th'); eq(format(20150808, 'CC>0'), '220th'); eq(format(20150809, 'CC>0'), '221st'); eq(format(20150810, 'CC>0'), '222nd'); eq(format(20150811, 'CC>0'), '223rd'); eq(format(20150812, 'CC>0'), '224th'); eq(format(20150813, 'CC>0'), '225th'); eq(format(20150814, 'CC>0'), '226th'); eq(format(20150815, 'CC>0'), '227th'); eq(format(20150816, 'CC>0'), '228th'); eq(format(20150817, 'CC>0'), '229th'); eq(format(20150818, 'CC>0'), '230th'); eq(format(20150819, 'CC>0'), '231st'); eq(format(20150820, 'CC>0'), '232nd'); eq(format(20150821, 'CC>0'), '233rd'); eq(format(20150822, 'CC>0'), '234th'); eq(format(20150823, 'CC>0'), '235th'); eq(format(20150824, 'CC>0'), '236th'); eq(format(20150825, 'CC>0'), '237th'); eq(format(20150826, 'CC>0'), '238th'); eq(format(20150827, 'CC>0'), '239th'); eq(format(20150828, 'CC>0'), '240th'); eq(format(20150829, 'CC>0'), '241st'); eq(format(20150830, 'CC>0'), '242nd'); eq(format(20150831, 'CC>0'), '243rd'); eq(format(20150901, 'CC>0'), '244th'); eq(format(20150902, 'CC>0'), '245th'); eq(format(20150903, 'CC>0'), '246th'); eq(format(20150904, 'CC>0'), '247th'); eq(format(20150905, 'CC>0'), '248th'); eq(format(20150906, 'CC>0'), '249th'); eq(format(20150907, 'CC>0'), '250th'); eq(format(20150908, 'CC>0'), '251st'); eq(format(20150909, 'CC>0'), '252nd'); eq(format(20150910, 'CC>0'), '253rd'); eq(format(20150911, 'CC>0'), '254th'); eq(format(20150912, 'CC>0'), '255th'); eq(format(20150913, 'CC>0'), '256th'); eq(format(20150914, 'CC>0'), '257th'); eq(format(20150915, 'CC>0'), '258th'); eq(format(20150916, 'CC>0'), '259th'); eq(format(20150917, 'CC>0'), '260th'); eq(format(20150918, 'CC>0'), '261st'); eq(format(20150919, 'CC>0'), '262nd'); eq(format(20150920, 'CC>0'), '263rd'); eq(format(20150921, 'CC>0'), '264th'); eq(format(20150922, 'CC>0'), '265th'); eq(format(20150923, 'CC>0'), '266th'); eq(format(20150924, 'CC>0'), '267th'); eq(format(20150925, 'CC>0'), '268th'); eq(format(20150926, 'CC>0'), '269th'); eq(format(20150927, 'CC>0'), '270th'); eq(format(20150928, 'CC>0'), '271st'); eq(format(20150929, 'CC>0'), '272nd'); eq(format(20150930, 'CC>0'), '273rd'); eq(format(20151001, 'CC>0'), '274th'); eq(format(20151002, 'CC>0'), '275th'); eq(format(20151003, 'CC>0'), '276th'); eq(format(20151004, 'CC>0'), '277th'); eq(format(20151005, 'CC>0'), '278th'); eq(format(20151006, 'CC>0'), '279th'); eq(format(20151007, 'CC>0'), '280th'); eq(format(20151008, 'CC>0'), '281st'); eq(format(20151009, 'CC>0'), '282nd'); eq(format(20151010, 'CC>0'), '283rd'); eq(format(20151011, 'CC>0'), '284th'); eq(format(20151012, 'CC>0'), '285th'); eq(format(20151013, 'CC>0'), '286th'); eq(format(20151014, 'CC>0'), '287th'); eq(format(20151015, 'CC>0'), '288th'); eq(format(20151016, 'CC>0'), '289th'); eq(format(20151017, 'CC>0'), '290th'); eq(format(20151018, 'CC>0'), '291st'); eq(format(20151019, 'CC>0'), '292nd'); eq(format(20151020, 'CC>0'), '293rd'); eq(format(20151021, 'CC>0'), '294th'); eq(format(20151022, 'CC>0'), '295th'); eq(format(20151023, 'CC>0'), '296th'); eq(format(20151024, 'CC>0'), '297th'); eq(format(20151025, 'CC>0'), '298th'); eq(format(20151026, 'CC>0'), '299th'); eq(format(20151027, 'CC>0'), '300th'); eq(format(20151028, 'CC>0'), '301st'); eq(format(20151029, 'CC>0'), '302nd'); eq(format(20151030, 'CC>0'), '303rd'); eq(format(20151031, 'CC>0'), '304th'); eq(format(20151101, 'CC>0'), '305th'); eq(format(20151102, 'CC>0'), '306th'); eq(format(20151103, 'CC>0'), '307th'); eq(format(20151104, 'CC>0'), '308th'); eq(format(20151105, 'CC>0'), '309th'); eq(format(20151106, 'CC>0'), '310th'); eq(format(20151107, 'CC>0'), '311th'); eq(format(20151108, 'CC>0'), '312th'); eq(format(20151109, 'CC>0'), '313th'); eq(format(20151110, 'CC>0'), '314th'); eq(format(20151111, 'CC>0'), '315th'); eq(format(20151112, 'CC>0'), '316th'); eq(format(20151113, 'CC>0'), '317th'); eq(format(20151114, 'CC>0'), '318th'); eq(format(20151115, 'CC>0'), '319th'); eq(format(20151116, 'CC>0'), '320th'); eq(format(20151117, 'CC>0'), '321st'); eq(format(20151118, 'CC>0'), '322nd'); eq(format(20151119, 'CC>0'), '323rd'); eq(format(20151120, 'CC>0'), '324th'); eq(format(20151121, 'CC>0'), '325th'); eq(format(20151122, 'CC>0'), '326th'); eq(format(20151123, 'CC>0'), '327th'); eq(format(20151124, 'CC>0'), '328th'); eq(format(20151125, 'CC>0'), '329th'); eq(format(20151126, 'CC>0'), '330th'); eq(format(20151127, 'CC>0'), '331st'); eq(format(20151128, 'CC>0'), '332nd'); eq(format(20151129, 'CC>0'), '333rd'); eq(format(20151130, 'CC>0'), '334th'); eq(format(20151201, 'CC>0'), '335th'); eq(format(20151202, 'CC>0'), '336th'); eq(format(20151203, 'CC>0'), '337th'); eq(format(20151204, 'CC>0'), '338th'); eq(format(20151205, 'CC>0'), '339th'); eq(format(20151206, 'CC>0'), '340th'); eq(format(20151207, 'CC>0'), '341st'); eq(format(20151208, 'CC>0'), '342nd'); eq(format(20151209, 'CC>0'), '343rd'); eq(format(20151210, 'CC>0'), '344th'); eq(format(20151211, 'CC>0'), '345th'); eq(format(20151212, 'CC>0'), '346th'); eq(format(20151213, 'CC>0'), '347th'); eq(format(20151214, 'CC>0'), '348th'); eq(format(20151215, 'CC>0'), '349th'); eq(format(20151216, 'CC>0'), '350th'); eq(format(20151217, 'CC>0'), '351st'); eq(format(20151218, 'CC>0'), '352nd'); eq(format(20151219, 'CC>0'), '353rd'); eq(format(20151220, 'CC>0'), '354th'); eq(format(20151221, 'CC>0'), '355th'); eq(format(20151222, 'CC>0'), '356th'); eq(format(20151223, 'CC>0'), '357th'); eq(format(20151224, 'CC>0'), '358th'); eq(format(20151225, 'CC>0'), '359th'); eq(format(20151226, 'CC>0'), '360th'); eq(format(20151227, 'CC>0'), '361st'); eq(format(20151228, 'CC>0'), '362nd'); eq(format(20151229, 'CC>0'), '363rd'); eq(format(20151230, 'CC>0'), '364th'); eq(format(20151231, 'CC>0'), '365th'); // 文字列の序数 eq(format(20150101, 'GG>0'), '平成'); eq(format(20000101, 'y>0'), '00th'); eq(format(20010101, 'y>0'), '01st');
yukik/koyomi
test/format/josu.js
JavaScript
mit
14,614
# ImageHelper [![Version](https://img.shields.io/cocoapods/v/AFImageHelper.svg?style=flat)](http://cocoapods.org/pods/AFImageHelper) [![License](https://img.shields.io/cocoapods/l/AFImageHelper.svg?style=flat)](http://cocoapods.org/pods/AFImageHelper) [![Platform](https://img.shields.io/cocoapods/p/AFImageHelper.svg?style=flat)](http://cocoapods.org/pods/AFImageHelper) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) Image Extensions for Swift 3.0 ![Sample Project Screenshot](https://raw.githubusercontent.com/melvitax/AFImageHelper/master/Screenshot.png?raw=true "Sample Project Screenshot") ## Usage To run the example project, clone or download the repo, and run. ## UIImageView Extension ### Image from a URL ```Swift // Fetches an image from a URL. If caching is set, it will be cached by NSCache for future queries. The cached image is returned if available, otherise the placeholder is set. When the image is returned, the closure gets called. func imageFromURL(url: String, placeholder: UIImage, fadeIn: Bool = true, closure: ((image: UIImage?) ``` ## UIImage Extension ### Colors ```Swift // Creates an image from a solid color UIImage(color:UIColor, size:CGSize) // Creates an image from a gradient color UIImage(gradientColors:[UIColor], size:CGSize) // Applies a gradient overlay to an image func applyGradientColors(gradientColors: [UIColor], blendMode: CGBlendMode) -> UIImage // Creates an image from a radial gradient UIImage(startColor: UIColor, endColor: UIColor, radialGradientCenter: CGPoint, radius:Float, size:CGSize) ``` ### Text ```Swift // Creates an image with a string of text UIImage(text: String, font: UIFont, color: UIColor, backgroundColor: UIColor, size:CGSize, offset: CGPoint) ``` ### Screenshot ```Swift // Creates an image from a UIView UIImage(fromView view: UIView) ``` ### Alpha and Padding ```Swift // Returns true if the image has an alpha layer func hasAlpha() -> Bool // Returns a copy(if needed) of the image with alpha layer func applyAlpha() -> UIImage? // Returns a copy of the image with a transparent border of the given size added around its edges func applyPadding(padding: CGFloat) -> UIImage? ``` ### Crop and Resize ```Swift // Crops an image to a new rect func crop(bounds: CGRect) -> UIImage? // Crops an image to a centered square func cropToSquare() -> UIImage? { // Resizes an image func resize(size:CGSize, contentMode: UIImageContentMode = .ScaleToFill) -> UIImage? ``` ### Circle and Rounded Corners ```Swift // Rounds corners of an image func roundCorners(cornerRadius:CGFloat) -> UIImage? // Rounds corners of an image with border func roundCorners(cornerRadius:CGFloat, border:CGFloat, color:UIColor) -> UIImage? // Rounds corners to a circle func roundCornersToCircle() -> UIImage? // Rounds corners to a circle with border func roundCornersToCircle(border border:CGFloat, color:UIColor) -> UIImage? ``` ### Border ```Swift // Adds a border func applyBorder(border:CGFloat, color:UIColor) -> UIImage? ``` ### Image Effects ```Swift // Applies a light blur effect to the image func applyLightEffect() -> UIImage? // Applies a extra light blur effect to the image func applyExtraLightEffect() -> UIImage? // Applies a dark blur effect to the image func applyDarkEffect() -> UIImage? // Applies a color tint to an image func applyTintEffect(tintColor: UIColor) -> UIImage? // Applies a blur to an image based on the specified radius, tint color saturation and mask image func applyBlur(blurRadius:CGFloat, tintColor:UIColor?, saturationDeltaFactor:CGFloat, maskImage:UIImage? = nil) -> UIImage? ``` ### Screen Density ```Swift // To create an image that is Retina aware, use the screen scale as a multiplier for your size. You should also use this technique for padding or borders. let width = 140 * UIScreen.mainScreen().scale let height = 140 * UIScreen.mainScreen().scale let image = UIImage(named: "myImage")?.resize(CGSize(width: width, height: height)) ```
melvitax/AFImageHelper
README.md
Markdown
mit
4,059
import { apiGet, apiPut, apiDelete } from 'utils/api' import { flashError, flashSuccess } from 'utils/flash' import { takeLatest, takeEvery, call, put, select } from 'redux-saga/effects' import { filter, find, without, omit } from 'lodash' import { filesUrlSelector } from 'ducks/app' import { makeUploadsSelector } from 'ducks/uploads' import { makeFiltersQuerySelector } from 'ducks/filters' import { makeSelectedFileIdsSelector } from 'ducks/filePlacements' // Constants const GET_FILES = 'files/GET_FILES' const GET_FILES_SUCCESS = 'files/GET_FILES_SUCCESS' const UPLOADED_FILE = 'files/UPLOADED_FILE' const THUMBNAIL_GENERATED = 'files/THUMBNAIL_GENERATED' const DELETE_FILE = 'files/DELETE_FILE' const DELETE_FILE_FAILURE = 'files/DELETE_FILE_FAILURE' const UPDATE_FILE = 'files/UPDATE_FILE' export const UPDATE_FILE_SUCCESS = 'files/UPDATE_FILE_SUCCESS' export const UPDATE_FILE_FAILURE = 'files/UPDATE_FILE_FAILURE' const UPDATED_FILES = 'files/UPDATED_FILES' const REMOVED_FILES = 'files/REMOVED_FILES' const CHANGE_FILES_PAGE = 'files/CHANGE_FILES_PAGE' const MASS_SELECT = 'files/MASS_SELECT' const MASS_DELETE = 'files/MASS_DELETE' const MASS_CANCEL = 'files/MASS_CANCEL' // Actions export function getFiles (fileType, filesUrl, query = '') { return { type: GET_FILES, fileType, filesUrl, query } } export function getFilesSuccess (fileType, records, meta) { return { type: GET_FILES_SUCCESS, fileType, records, meta } } export function uploadedFile (fileType, file) { return { type: UPLOADED_FILE, fileType, file } } export function thumbnailGenerated (fileType, temporaryUrl, url) { return { type: THUMBNAIL_GENERATED, fileType, temporaryUrl, url } } export function updatedFiles (fileType, files) { return { type: UPDATED_FILES, fileType, files } } export function updateFile (fileType, filesUrl, file, attributes) { return { type: UPDATE_FILE, fileType, filesUrl, file, attributes } } export function deleteFile (fileType, filesUrl, file) { return { type: DELETE_FILE, fileType, filesUrl, file } } export function deleteFileFailure (fileType, file) { return { type: DELETE_FILE_FAILURE, fileType, file } } export function removedFiles (fileType, ids) { return { type: REMOVED_FILES, fileType, ids } } export function updateFileSuccess (fileType, file, response) { return { type: UPDATE_FILE_SUCCESS, fileType, file, response } } export function updateFileFailure (fileType, file) { return { type: UPDATE_FILE_FAILURE, fileType, file } } export function changeFilesPage (fileType, filesUrl, page) { return { type: CHANGE_FILES_PAGE, fileType, filesUrl, page } } export function massSelect (fileType, file, select) { return { type: MASS_SELECT, fileType, file, select } } export function massDelete (fileType) { return { type: MASS_DELETE, fileType } } export function massCancel (fileType) { return { type: MASS_CANCEL, fileType } } // Sagas function * getFilesPerform (action) { try { const filesUrl = `${action.filesUrl}?${action.query}` const response = yield call(apiGet, filesUrl) yield put(getFilesSuccess(action.fileType, response.data, response.meta)) } catch (e) { flashError(e.message) } } function * getFilesSaga () { // takeLatest automatically cancels any saga task started previously if it's still running yield takeLatest(GET_FILES, getFilesPerform) } function * updateFilePerform (action) { try { const { file, filesUrl, attributes } = action const fullUrl = `${filesUrl}/${file.id}` const data = { file: { id: file.id, attributes } } const response = yield call(apiPut, fullUrl, data) yield put(updateFileSuccess(action.fileType, action.file, response.data)) } catch (e) { flashError(e.message) yield put(updateFileFailure(action.fileType, action.file)) } } function * updateFileSaga () { yield takeEvery(UPDATE_FILE, updateFilePerform) } function * changeFilesPagePerform (action) { try { const filtersQuery = yield select(makeFiltersQuerySelector(action.fileType)) let query = `page=${action.page}` if (filtersQuery) { query = `${query}&${filtersQuery}` } yield put(getFiles(action.fileType, action.filesUrl, query)) } catch (e) { flashError(e.message) } } function * changeFilesPageSaga () { yield takeLatest(CHANGE_FILES_PAGE, changeFilesPagePerform) } function * massDeletePerform (action) { try { const { massSelectedIds } = yield select(makeMassSelectedIdsSelector(action.fileType)) const filesUrl = yield select(filesUrlSelector) const fullUrl = `${filesUrl}/mass_destroy?ids=${massSelectedIds.join(',')}` const res = yield call(apiDelete, fullUrl) if (res.error) { flashError(res.error) } else { flashSuccess(res.data.message) yield put(removedFiles(action.fileType, massSelectedIds)) yield put(massCancel(action.fileType)) } } catch (e) { flashError(e.message) } } function * massDeleteSaga () { yield takeLatest(MASS_DELETE, massDeletePerform) } function * deleteFilePerform (action) { try { const res = yield call(apiDelete, `${action.filesUrl}/${action.file.id}`) if (res.error) { flashError(res.error) } else { yield put(removedFiles(action.fileType, [action.file.id])) } } catch (e) { flashError(e.message) } } function * deleteFileSaga () { yield takeLatest(DELETE_FILE, deleteFilePerform) } export const filesSagas = [ getFilesSaga, updateFileSaga, changeFilesPageSaga, massDeleteSaga, deleteFileSaga ] // Selectors export const makeFilesStatusSelector = (fileType) => (state) => { return { loading: state.files[fileType] && state.files[fileType].loading, loaded: state.files[fileType] && state.files[fileType].loaded, massSelecting: state.files[fileType].massSelectedIds.length > 0 } } export const makeFilesLoadedSelector = (fileType) => (state) => { return state.files[fileType] && state.files[fileType].loaded } export const makeMassSelectedIdsSelector = (fileType) => (state) => { const base = state.files[fileType] || defaultFilesKeyState return { massSelectedIds: base.massSelectedIds, massSelectedIndestructibleIds: base.massSelectedIndestructibleIds } } export const makeFilesSelector = (fileType) => (state) => { const base = state.files[fileType] || defaultFilesKeyState const selected = base.massSelectedIds return base.records.map((file) => { if (file.id && selected.indexOf(file.id) !== -1) { return { ...file, massSelected: true } } else { return file } }) } export const makeFilesForListSelector = (fileType) => (state) => { const uploads = makeUploadsSelector(fileType)(state) let files if (uploads.uploadedIds.length) { files = makeFilesSelector(fileType)(state).map((file) => { if (uploads.uploadedIds.indexOf(file.id) === -1) { return file } else { return { ...file, attributes: { ...file.attributes, freshlyUploaded: true } } } }) } else { files = makeFilesSelector(fileType)(state) } return [ ...Object.values(uploads.records).map((upload) => ({ ...upload, attributes: { ...upload.attributes, uploading: true } })), ...files ] } export const makeRawUnselectedFilesForListSelector = (fileType, selectedIds) => (state) => { const all = makeFilesForListSelector(fileType)(state) return filter(all, (file) => selectedIds.indexOf(String(file.id)) === -1) } export const makeUnselectedFilesForListSelector = (fileType) => (state) => { const all = makeFilesForListSelector(fileType)(state) const selectedIds = makeSelectedFileIdsSelector(fileType)(state) return filter(all, (file) => selectedIds.indexOf(String(file.id)) === -1) } export const makeFilesPaginationSelector = (fileType) => (state) => { const base = state.files[fileType] || defaultFilesKeyState return base.pagination } export const makeFilesReactTypeSelector = (fileType) => (state) => { const base = state.files[fileType] || defaultFilesKeyState return base.reactType } export const makeFilesReactTypeIsImageSelector = (fileType) => (state) => { return makeFilesReactTypeSelector(fileType)(state) === 'image' } // State const defaultFilesKeyState = { loading: false, loaded: false, records: [], massSelectedIds: [], massSelectedIndestructibleIds: [], reactType: 'document', pagination: { page: null, pages: null } } const initialState = {} // Reducer function filesReducer (rawState = initialState, action) { const state = rawState if (action.fileType && !state[action.fileType]) { state[action.fileType] = { ...defaultFilesKeyState } } switch (action.type) { case GET_FILES: return { ...state, [action.fileType]: { ...state[action.fileType], loading: true } } case GET_FILES_SUCCESS: return { ...state, [action.fileType]: { ...state[action.fileType], records: action.records, loading: false, loaded: true, pagination: omit(action.meta, ['react_type']), reactType: action.meta.react_type } } case UPLOADED_FILE: return { ...state, [action.fileType]: { ...state[action.fileType], records: [action.file, ...state[action.fileType].records] } } case THUMBNAIL_GENERATED: { return { ...state, [action.fileType]: { ...state[action.fileType], records: state[action.fileType].records.map((record) => { if (record.attributes.thumb !== action.temporaryUrl) return record return { ...record, attributes: { ...record.attributes, thumb: action.url } } }) } } } case UPDATE_FILE: return { ...state, [action.fileType]: { ...state[action.fileType], records: state[action.fileType].records.map((record) => { if (record.id === action.file.id) { return { ...record, attributes: { ...record.attributes, ...action.attributes, updating: true } } } else { return record } }) } } case UPDATE_FILE_SUCCESS: return { ...state, [action.fileType]: { ...state[action.fileType], records: state[action.fileType].records.map((record) => { if (record.id === action.response.id) { return action.response } else { return record } }) } } case UPDATE_FILE_FAILURE: return { ...state, [action.fileType]: { ...state[action.fileType], records: state[action.fileType].records.map((record) => { if (record.id === action.file.id) { return { ...action.file } } else { return record } }) } } case UPDATED_FILES: return { ...state, [action.fileType]: { ...state[action.fileType], records: state[action.fileType].records.map((record) => { const found = find(action.files, { id: record.id }) return found || record }) } } case MASS_SELECT: { if (!action.file.id) return state let massSelectedIds = state[action.fileType].massSelectedIds let massSelectedIndestructibleIds = state[action.fileType].massSelectedIndestructibleIds if (action.select) { massSelectedIds = [...massSelectedIds, action.file.id] if (action.file.attributes.file_placements_size) { massSelectedIndestructibleIds = [...massSelectedIndestructibleIds, action.file.id] } } else { massSelectedIds = without(massSelectedIds, action.file.id) if (action.file.attributes.file_placements_size) { massSelectedIndestructibleIds = without(massSelectedIndestructibleIds, action.file.id) } } return { ...state, [action.fileType]: { ...state[action.fileType], massSelectedIds, massSelectedIndestructibleIds } } } case MASS_CANCEL: return { ...state, [action.fileType]: { ...state[action.fileType], massSelectedIds: [] } } case REMOVED_FILES: { const originalLength = state[action.fileType].records.length const records = state[action.fileType].records.filter((record) => action.ids.indexOf(record.id) === -1) return { ...state, [action.fileType]: { ...state[action.fileType], records, pagination: { ...state[action.fileType].pagination, to: records.length, count: state[action.fileType].pagination.count - (originalLength - records.length) } } } } case DELETE_FILE: return { ...state, [action.fileType]: { ...state[action.fileType], records: state[action.fileType].records.map((record) => { if (record.id === action.file.id) { return { ...record, _destroying: true } } else { return record } }) } } case DELETE_FILE_FAILURE: return { ...state, [action.fileType]: { ...state[action.fileType], records: state[action.fileType].records.map((record) => { if (record.id === action.file.id) { return { ...action.file } } else { return record } }) } } default: return state } } export default filesReducer
sinfin/folio
react/src/ducks/files.js
JavaScript
mit
14,083
using ShiftCaptain.Models; using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Linq; using System.Security.Principal; using System.Web; using System.Web.Security; namespace ShiftCaptain.Infrastructure { public static class Authentication { public static Boolean Login(EmailNPass user, ref String errorMessage) { errorMessage = ""; var db = new ShiftCaptainEntities(); var validUser = db.Users.FirstOrDefault(u => u.EmailAddress == user.EmailAddress); if (validUser != null) { if (validUser.Locked && validUser.LastLogin.HasValue && (validUser.LastLogin.Value <= DateTime.Now.AddMinutes(-30))) { validUser.Locked = false; validUser.NumTries = 0; } int numTries = 4; Int32.TryParse(ConfigurationManager.AppSettings["NumTries"], out numTries); if (validUser.NumTries++ > numTries) { validUser.Locked = true; } if (!validUser.Locked && validUser.Pass == user.Pass) { validUser.NumTries = 0; if (validUser.IsActive) { var ticket = new FormsAuthenticationTicket(String.Format("{0}|{1}", validUser.Id, validUser.EmailAddress), true, 30); var encr = FormsAuthentication.Encrypt(ticket); //FormsAuthentication.SetAuthCookie("authCk", false); SessionManager.UserId = validUser.Id; SessionManager.token = encr; SessionManager.GetVersion(); return true; } } validUser.LastLogin = DateTime.Now; db.Entry(validUser).State = EntityState.Modified; db.SaveChanges(); if (validUser.Locked) { errorMessage = "Your account is locked. Please wait 30 minutes or contact the system administrator."; return false; } } errorMessage = "Email Address or Password is invalid."; return false; } public static void LogOff() { SessionManager.Clear(); } public static bool Authenticate(HttpContextBase ctx) { if (SessionManager.token != null) { var ticket = FormsAuthentication.Decrypt(SessionManager.token); if (ticket != null && !ticket.Expired) { ctx.User = new GenericPrincipal(new FormsIdentity(ticket), new string[] { }); var nTicket = new FormsAuthenticationTicket(ticket.Name, true, 30);//Everytime you click a new page, clock restarts SessionManager.token = FormsAuthentication.Encrypt(nTicket); } } return ctx.User.Identity.IsAuthenticated; } } }
adabadyitzaboy/ShiftCaptain
ShiftCaptain/Infrastructure/Authentication.cs
C#
mit
3,191
# Angular.js Enterprise Edition Lazy Load Boilerplate > **TODO:** review and update This boilerplate (seed project, starting project) helps you build large scale [Angular.js](https://angularjs.org/) applications with [Require.js](http://requirejs.org/) -- <!-- toc --> * [Overview](#overview) * [Installation Guide](#installation-guide) * [Prerequisites](#prerequisites) * [Use Guide](#use-guide) * [Tools for Development Workflow](#tools-for-development-workflow) * [Build](#build) * [Code Generation](#code-generation) * [Development](#development) * [Distribuction Preview](#distribuction-preview) * [Tests](#tests) * [Tools Configuration](#tools-configuration) * [Tips](#tips) * [Known Issues](#known-issues) * [Publishing tool for GitHub gh-pages](#publishing-tool-for-github-gh-pages) * [Directories Structure](#directories-structure) * [Development](#development) * [Publishing](#publishing) * [Project](#project) <!-- toc stop --> ## Overview FrontEnd Boilerplate project with development and publishing tools (for GitHub gh-pages) * **Important**: to define a better communication between frontend and backend (server), please consider follow the given proposal [REST URL Design](rest_url_design.md) ## Installation Guide Enter the following commands in the terminal ```bash $ git clone https://github.com/erkobridee/angularjs-ee-ll-boilerplate.git $ cd angularjs-ee-ll-boilerplate $ cd tools $ npm run setup $ cd .. $ cd publisher $ npm install ``` ### Prerequisites * Must have [Git](http://git-scm.com/) installed * Must have [node.js (at least v0.10.0)](http://nodejs.org/) installed with npm (Node Package Manager) * Must have [Grunt](https://github.com/gruntjs/grunt) node package installed globally ## Use Guide > `./` means root directoy ### Tools for Development Workflow > Inside `./tools` directory, available grunt.js commands * `grunt` >> (default task) that will execute lintspaces, jshint to verify and ensure js code quality and cleanup build and dist directories > **Attention:** the following task **lintspaces** will verify the patterns insides files according rules inside `.editorconfig` in the root directory #### Build * `grunt build:dev` >> prepare files for development, inside `./tools/.temp` directory * `grunt build:prod` >> cleanup build directories, execute test's and then prepare files for distribution / production, inside `./dist` directory #### Code Generation * `grunt generate` >> ask for which code generate option you want, values for the chosen and finally output destination #### Development * `grunt dev:livereload` >> first will execute `build:dev` task, after that start web server with livereload support and watch changes on files *.html, .css and .js*, that will update all browsers and devices connect to server * `grunt dev:livereload:proxy` >> beyond the `dev:livereload` tasks, this task create a proxy to route requests to other server based on given context, for example `/rest` * `grunt dev:sync` >> first will execute `build:dev` task, after that start web server with browser-sync support and watch changes on files *.html, .css and .js*, that will update all browsers and devices connect to server and sync data and navigation * `grunt dev:sync:proxy` >> beyond the `dev:sync` tasks, this task create a proxy to route requests to other server based on given context, for example `/rest` ##### alias * `grunt dev` >> alias to `grunt dev:livereload` * `grunt dev:proxy` >> alias to `grunt dev:livereload:proxy` #### Distribuction Preview * `grunt dist` >> first will execute `build:prod` task, after that start web server with generated files * `grunt dist:proxy` >> first will execute `build:prod` task, after that start web server with generated files + proxy to route requests to other server based on given context, for example `/rest` * `grunt dist:sync` >> first will execute `build:prod` task, after that start web server with generated files + browser-sync to synchronize data and navigation * `grunt dist:sync:proxy` >> first will execute `build:prod` task, after that start web server with generated files + browser-sync to synchronize data and navigation + proxy to route requests to other server based on given context, for example `/rest` #### Tests ##### Unit Tests * `grunt ci` - cleanup build directories and then execute `karma:ci` grunt task that run test's * `grunt reports` - cleanup build directories, execute `karma:reports` grunt task that generate coverage and jasmine html reports and then open reports output directory * `grunt specs` - first generate coverage and jasmine html reports, start karma with watch process and webserver with livereload watching reports html's > **Attention:** if you want to run with dev flow, run first dev task (ex.: `grunt dev`) in one terminal and in other terminal run `grunt specs` ##### e2e (end-to-end) - Selenium Tests * `grunt e2e` - execute `build:prod`, start web server with proxy support and then run e2e test's with Protractor * `grunt protractor` - run only e2e test's > **Attention:** need to run with dev flow, run first (ex.: `grunt dev`) in one terminal and in other terminal run `grunt protractor` or specific test's suite `grunt protractor --suite bookmarks` (Protractor configs: `./tools/config.protractor.js`) #### Tools Configuration * Tools global configs: `./tools/config.js` which is used on `./tools/helpers/grunt/config/project.js` * Proxy routing configuration ( see: `var backend = { ...` ) * Proxy Grunt.js Plugin : [grunt-connect-proxy](https://github.com/drewzboto/grunt-connect-proxy) | [Using grunt-connect-proxy](http://www.fettblog.eu/blog/2013/09/20/using-grunt-connect-proxy/) * To center and make more easy to manage Grunt.js tasks configurations was defined the file `./tools/helpers/grunt/config/project.js` #### Tips * If you use Sublime Text, check this out: * [[GitHub] the-front / sublime-angularjs-ee-snippets](https://github.com/the-front/sublime-angularjs-ee-snippets) - Sublime Text 2 / 3 Snippets and Completions for Angular.js, Angular UI Router and Require.js (focused to the angularjs-ee-boilerplate code) * [[GitHub] caiogondim / jasmine-sublime-snippets](https://github.com/caiogondim/jasmine-sublime-snippets) - Snippets for Jasmine, the BDD framework for testing JavaScript, in Sublime Text #### Known Issues ##### Mac OSX * [How do I fix the error EMFILE: Too many opened files? | grunt-contrib-watch - GitHub](https://github.com/gruntjs/grunt-contrib-watch#how-do-i-fix-the-error-emfile-too-many-opened-files) * [[SuperUser] How to change default ulimit values in Mac OS X 10.6?](https://superuser.com/questions/261023/how-to-change-default-ulimit-values-in-mac-os-x-10-6) This is because of your system's max opened file limit. For OSX the default is very low (256). Temporarily increase your limit with `ulimit -n 2048`, the number being the new max limit. In some versions of OSX the above solution doesn't work. In that case try `launchctl limit maxfiles 2048 2048` and restart your terminal. ##### Windows * Behind a NTLM proxy * run `npm install` two times, to install all dependencies ##### Protracto & Selenium - Firefox dos not work * When you uptade to last Firefox version and Selenium stop to work with * **Solution:** `keep selenium server jar always up to date` ### Publishing tool for GitHub gh-pages > Inside `./publisher` directory, available grunt.js commands * `grunt init` >> do project clone from GitHub inside `./publisher/local/gh-pages` directory and checkout `gh-pages` branch, which is used to update remote `gh-pages` branch on GitHub > Execute this command at once, before the following commands -- * `grunt publish` >> this task will invoke `grunt build:prod` command inside `./tools` directory, then copy generated files from `./dist` to `./publisher/local/gh-pages`, commit files and finally push to `gh-pages` branch on GitHub * `grunt publish:dev` - this task will copy files from `./src` to `./publisher/local/gh-pages`, commit files and finally push to `gh-pages` branch on GitHub ## Directories Structure ``` ./ /src >> project source /tools >> development tools /publisher >> publisher tool ``` ### Development ``` /tools /helpers /lib >> auxiliary processing /scripts >> automation processing /html_report_template jasmine.html >> jasmine html report template /grunt /config >> configuration files to grunt.js tasks /tasks >> custom grunt.js tasks /tests require.config.js >> load application files and test's specs for Karma Runner /templates >> templates files for grunt.js generate task config.js >> global configs for grunt.js tasks config.karma.js >> referenced on config.js config.protractor.js >> config for Protractor Gruntfile.js >> main grunt.js configuration file package.json >> node.js 'tools' project and dependencies configuration ``` ### Publishing ``` /publisher /helpers /grunt /config >> configuration files to grunt.js tasks /tasks >> custom grunt.js tasks Gruntfile.js >> main grunt.js configuration file package.json >> node.js 'publisher' project and dependencies configuration ``` ### Project > The directories structure of the project is organized following the BDD (Behavior Driven Development [wikipedia](https://en.wikipedia.org/wiki/Behavior-driven_development)) concept, where all one "use case" (behavior) is inside the same directory, which this allow code and behavior reuse ``` /src /app /bookmarks >> CRUD example with mock >> package.js map all js files in the directory this file is referenced as a dependency on /app/main/module.js /mock >> package.js map all js files in the directory this file is referenced as a dependency on /require.mock.load.js /tests/unit >> package.js map all js files in the directory this file is referenced as a dependency on /require.unit.load.js /tests/e2e >> files loaded from Protractor config specs regexp /about >> module referenced as a dependency on /app/main/module.js /help >> module referenced as a dependency on /app/main/module.js /home >> module referenced as a dependency on /app/main/module.js /main >> main application module where other modules are charged on /module.js >> package.js map all js files in the directory this file is referenced as a dependency on /ng.app.js /shared /fallback >> scripts for Internet Explorer /fend >> set of commons and useful reusable modules across projects and other modules /mock >> module that enables emulate the backend /less /bootstrap default.less >> default theme and configuration for Bootstrap, which is imported in /less/app.less >> other configurations and components /less app.less >> map .less files that generate /styles/app.css /styles app.css /vendor >> third party libraries (ex.: twitter bootstrap, jquery, angular.js, ...) require.mock.load.js >> list and reference all mocks to be loaded this file is referenced as a dependency on /ng.app.js require.unit.load.js >> list and reference all tests unit to be loaded this file is referenced as dependency on ./tools/helpers/tests/require.config.js ng.app.js >> where start Angular.js application require.config.js >> main configuration file to load all needed JavaScripts files to execute /ng.app.js index.html ```
the-front/angularjs-ee-ll-boilerplate
docs/en/README.md
Markdown
mit
11,914
;;; keydown-counter.asm -- Count keydown form P3.2 and outputs in P1 using LED ;; Author: Zeno Zeng <[email protected]> ;; Time-stamp: <2014-12-25 21:56:36 Zeno Zeng> ;;; Commentary: ;; Count keydown from P3.2 then ouputs using 8bit P1 (in LED) ;;; Code: ORG 0000H AJMP INIT ORG 0003H AJMP ONKEYDOWN INIT: CLR A MOV TCON, #01H ; 设置触发方式为脉冲,下降沿有效(IT0 = 1) MOV IE, #81H ; 中断总允许,允许 EX0(P3.2 引入) 外中断 (EA = 1, EX0 = 1) LISTENING: SJMP LISTENING ONKEYDOWN: INC A MOV P1, A RETI EXIT: END
zenozeng/ASM-80C51
keydown-counter.asm
Assembly
mit
670
var self = module.exports; self = (function(){ self.debug = true; self.prefix = '/kaskade'; self.ssl = false; /*{ key: {PEM}, cert: {PEM} }*/ self.port = 80; self.host = '0.0.0.0'; self.onConnectionClose = new Function(); self.redis = false; /*{ host: {String}, port: {Number}, options: {Object} }*/ self.init = function(cfg){ for(var c in cfg){ if(c in this) this[c] = cfg[c]; } }; })();
Aldlevine/Kaskade.js-node
lib/cfg.js
JavaScript
mit
577
# encoding: utf-8 require_relative "qipowl/version" require_relative "qipowl/constants" require_relative "qipowl/core/mapper" require_relative "qipowl/core/ruler" require_relative "qipowl/core/bowler" require_relative "qipowl/bowlers/html" require_relative "qipowl/bowlers/i_sp_ru" #require_relative "qipowl/bowlers/cmd" #require_relative "qipowl/bowlers/yaml" Encoding.default_external = Encoding::UTF_8 Encoding.default_internal = Encoding::UTF_8 module Qipowl extend self # A wrapper for the configuration block def configure &block instance_eval(&block) end def [](key) config[key.to_sym] end private def set(key, value) config[key.to_sym] = value end def add(key, value) config[key.to_sym] = [*config[key.to_sym]] << value end def config @config ||= Hash.new end def method_missing(sym, *args) if sym.to_s =~ /(.+)=$/ config[$1.to_sym] = args.first else config[sym.to_sym] end end end Qipowl::configure do set :bowlers, File.expand_path(File.join(__dir__, '..', 'config', 'bowlers')) end class Qipowl::Html attr_reader :bowler def self.parse s (@bowler ||= Qipowl::Ruler.new_bowler "html").execute s end end
mudasobwa/qipowl
lib/qipowl.rb
Ruby
mit
1,211
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Retina</title> <link rel="stylesheet" href="http://pic.lvmama.com/min/index.php?f=/styles/v6/header_new.css"> <link rel="stylesheet" href="css/monokai-sublime.css"> <link rel="stylesheet" href="css/docs.css"> <link rel="stylesheet" href="css/retina.css"> </head> <body> <header id="header"> <div id="logo"> NOVA </div> </header> <menu id="nav"> <li><a href="./">首页</a></li> </menu> <div id="everything"> <h1>Retina</h1> <h2>建议</h2> <blockquote> Ctrl + = 放大屏幕显示比例到200%或使用高分屏显示器以查看效果 </blockquote> <h3>普通图片</h3> <section> <div class="lvmama-logo"></div> </section> <h3>高分屏适配图片</h3> <section> <div class="lvmama-logo lvmama-logo-retina"></div> </section> <pre> <code> .lvmama-logo { background-image: url(../img/logo-61.png); width: 330px; height: 70px; } @media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min--moz-device-pixel-ratio: 1.5), only screen and (min-device-pixel-ratio: 1.5) { /* 当设备像素比不小于1.5的时候... */ .lvmama-logo-retina { background-image: url(../img/[email protected]); background-size: 100%; } } </code> </pre> <h2>评论</h2> <!-- 多说评论框 start --> <div class="ds-thread" data-thread-key="retina" data-title="NOVA" data-url="http://www.em2046.com/nova/docs/retina.html"></div> <!-- 多说评论框 end --> </div> <script src="js/jquery-1.12.1.js"></script> <script src="js/highlight.pack.js"></script> <script src="js/navigation.js"></script> </body> </html>
em2046/nova
docs/retina.html
HTML
mit
1,784
// // AppDelegate.h // testspinner // // Created by Christian Menschel on 29/09/15. // Copyright © 2015 TAPWORK. All rights reserved. // #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
tapwork/frozenrefreshcontrol
testspinner/AppDelegate.h
C
mit
286
<html><body> <h4>Windows 10 x64 (19041.264)</h4><br> <h2>_PPM_IDLE_STATES</h2> <font face="arial"> +0x000 InterfaceVersion : UChar<br> +0x001 IdleOverride : UChar<br> +0x002 EstimateIdleDuration : UChar<br> +0x003 ExitLatencyTraceEnabled : UChar<br> +0x004 NonInterruptibleTransition : UChar<br> +0x005 UnaccountedTransition : UChar<br> +0x006 IdleDurationLimited : UChar<br> +0x007 IdleCheckLimited : UChar<br> +0x008 StrictVetoBias : UChar<br> +0x00c ExitLatencyCountdown : Uint4B<br> +0x010 TargetState : Uint4B<br> +0x014 ActualState : Uint4B<br> +0x018 OldState : Uint4B<br> +0x01c OverrideIndex : Uint4B<br> +0x020 ProcessorIdleCount : Uint4B<br> +0x024 Type : Uint4B<br> +0x028 LevelId : Uint8B<br> +0x030 ReasonFlags : Uint2B<br> +0x038 InitiateWakeStamp : Uint8B<br> +0x040 PreviousStatus : Int4B<br> +0x044 PreviousCancelReason : Uint4B<br> +0x048 PrimaryProcessorMask : <a href="./_KAFFINITY_EX.html">_KAFFINITY_EX</a><br> +0x0f0 SecondaryProcessorMask : <a href="./_KAFFINITY_EX.html">_KAFFINITY_EX</a><br> +0x198 IdlePrepare : Ptr64 void <br> +0x1a0 IdlePreExecute : Ptr64 long <br> +0x1a8 IdleExecute : Ptr64 long <br> +0x1b0 IdlePreselect : Ptr64 unsigned long <br> +0x1b8 IdleTest : Ptr64 unsigned long <br> +0x1c0 IdleAvailabilityCheck : Ptr64 unsigned long <br> +0x1c8 IdleComplete : Ptr64 void <br> +0x1d0 IdleCancel : Ptr64 void <br> +0x1d8 IdleIsHalted : Ptr64 unsigned char <br> +0x1e0 IdleInitiateWake : Ptr64 unsigned char <br> +0x1e8 PrepareInfo : <a href="./_PROCESSOR_IDLE_PREPARE_INFO.html">_PROCESSOR_IDLE_PREPARE_INFO</a><br> +0x240 DeepIdleSnapshot : <a href="./_KAFFINITY_EX.html">_KAFFINITY_EX</a><br> +0x2e8 Tracing : Ptr64 <a href="./_PERFINFO_PPM_STATE_SELECTION.html">_PERFINFO_PPM_STATE_SELECTION</a><br> +0x2f0 CoordinatedTracing : Ptr64 <a href="./_PERFINFO_PPM_STATE_SELECTION.html">_PERFINFO_PPM_STATE_SELECTION</a><br> +0x2f8 ProcessorMenu : <a href="./_PPM_SELECTION_MENU.html">_PPM_SELECTION_MENU</a><br> +0x308 CoordinatedMenu : <a href="./_PPM_SELECTION_MENU.html">_PPM_SELECTION_MENU</a><br> +0x318 CoordinatedSelection : <a href="./_PPM_COORDINATED_SELECTION.html">_PPM_COORDINATED_SELECTION</a><br> +0x330 State : [1] <a href="./_PPM_IDLE_STATE.html">_PPM_IDLE_STATE</a><br> </font></body></html>
epikcraw/ggool
public/Windows 10 x64 (19041.264)/_PPM_IDLE_STATES.html
HTML
mit
2,573
# coding=utf-8 from setuptools import setup from Cython.Build import cythonize setup( name="cyfib", ext_modules=cythonize('cyfib.pyx', compiler_directives={'embedsignature': True}), )
tleonhardt/Python_Interface_Cpp
cython/wrap_c/setup.py
Python
mit
193
package org.eggermont.hm.cluster; import cern.colt.matrix.DoubleFactory1D; import cern.colt.matrix.DoubleMatrix1D; import cern.colt.matrix.DoubleMatrix2D; public class ClusterFactory { private final DoubleMatrix2D x; private final DoubleMatrix1D blocks; private final DoubleMatrix1D vMin; private final DoubleMatrix1D vMax; private final int ndof; public ClusterFactory(int d, int nidx, int ndof) { this.ndof = ndof; this.blocks = DoubleFactory1D.dense.make(d * nidx); this.x = blocks.like2D(nidx, d); this.vMin = DoubleFactory1D.dense.make(d); this.vMax = DoubleFactory1D.dense.make(d); } }
meggermo/hierarchical-matrices
src/main/java/org/eggermont/hm/cluster/ClusterFactory.java
Java
mit
669
using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Threading; using SharpDeflate; using vtortola.WebSockets; using vtortola.WebSockets.Rfc6455; namespace RohBot { public sealed class WebSocketServer<TClient> : IDisposable where TClient : WebSocketClient, new() { private class ClientHandle : IDisposable { private Action _dispose; public ClientHandle(Action dispose) { if (dispose == null) throw new ArgumentNullException(nameof(dispose)); _dispose = dispose; } public void Dispose() { _dispose?.Invoke(); _dispose = null; } } private CancellationTokenSource _cts; private WebSocketListener _listener; private object _clientsSync; private List<TClient> _clients; private IReadOnlyList<TClient> _clientsCache; public WebSocketServer(IPEndPoint endpoint) { var options = new WebSocketListenerOptions { PingTimeout = TimeSpan.FromSeconds(30) }; _cts = new CancellationTokenSource(); _listener = new WebSocketListener(endpoint, options); _clientsSync = new object(); _clients = new List<TClient>(); var rfc6455 = new WebSocketFactoryRfc6455(_listener); rfc6455.MessageExtensions.RegisterExtension(new WebSocketSharpDeflateExtension()); _listener.Standards.RegisterStandard(rfc6455); _listener.Start(); ListenAsync(); } public void Dispose() { _cts.Cancel(); _listener.Dispose(); } public IReadOnlyList<TClient> Clients { get { lock (_clientsSync) { return _clientsCache ?? (_clientsCache = _clients.ToList().AsReadOnly()); } } } private async void ListenAsync() { while (_listener.IsStarted) { WebSocket websocket; try { websocket = await _listener.AcceptWebSocketAsync(_cts.Token).ConfigureAwait(false); if (websocket == null) continue; } catch (Exception e) { Program.Logger.Error("Failed to accept websocket connection", e); continue; } var client = new TClient(); var clientHandle = new ClientHandle(() => { lock (_clientsSync) { _clients.Remove(client); _clientsCache = null; } }); client.Open(clientHandle, websocket, _cts.Token); lock (_clientsSync) { _clients.Add(client); _clientsCache = null; } } } } }
Rohansi/RohBot
RohBot/WebSocketServer.cs
C#
mit
3,255
/* eslint-disable no-undef */ const cukeBtnSubmit = '//button[@data-cuke="save-item"]'; const cukeInpSize = '//input[@data-cuke="size"]'; const cukeInpTitle = '//input[@data-cuke="title"]'; const cukeInpContent = '//textarea[@data-cuke="content"]'; const cukeSize = '//x-cuke[@id="size"]'; const cukeTitle = '//x-cuke[@id="title"]'; const cukeContent = '//x-cuke[@id="content"]'; /* const cukeHrefEdit = '//a[@data-cuke="edit-ite"]'; const cukeHrefDelete = '//a[@data-cuke="delete-item"]'; */ const cukeInvalidSize = '//span[@class="help-block error-block"]'; let size = ''; let title = ''; let content = ''; module.exports = function () { // Scenario: Create a new widget // ------------------------------------------------------------------------ this.Given(/^I have opened the 'add widgets' page : "([^"]*)"$/, function (_url) { browser.setViewportSize({ width: 1024, height: 480 }); browser.timeouts('implicit', 60000); browser.timeouts('page load', 60000); browser.url(_url); server.call('_widgets.wipe'); }); this.When(/^I create a "([^"]*)" millimetre "([^"]*)" item with text "([^"]*)",$/, function (_size, _title, _content) { size = _size; title = _title; content = _content; browser.waitForEnabled( cukeBtnSubmit ); browser.setValue(cukeInpTitle, title); browser.setValue(cukeInpSize, size); browser.setValue(cukeInpContent, content); browser.click(cukeBtnSubmit); }); this.Then(/^I see a new record with the same title, size and contents\.$/, function () { expect(browser.getText(cukeSize)).toEqual(size + ' millimetres.'); expect(browser.getText(cukeTitle)).toEqual(title); expect(browser.getText(cukeContent)).toEqual(content); }); // ======================================================================= // Scenario: Verify field validation // ------------------------------------------------------------------------ this.Given(/^I have opened the widgets list page : "([^"]*)"$/, function (_url) { browser.setViewportSize({ width: 1024, height: 480 }); browser.timeoutsImplicitWait(1000); browser.url(_url); }); /* let link = ''; this.Given(/^I choose to edit the "([^"]*)" item,$/, function (_widget) { link = '//a[@data-cuke="' + _widget + '"]'; browser.waitForExist( link ); browser.click(link); browser.waitForEnabled( cukeHrefEdit ); browser.click(cukeHrefEdit); }); */ this.When(/^I set 'Size' to "([^"]*)"$/, function (_size) { browser.setValue(cukeInpSize, _size); }); this.Then(/^I see the size validation hint "([^"]*)"\.$/, function (_message) { expect(browser.getText(cukeInvalidSize)).toEqual(_message); }); // ======================================================================= // Scenario: Fail to delete widget // ------------------------------------------------------------------------ let widget = ''; this.Given(/^I choose to view the "([^"]*)" item,$/, function (_widget) { widget = _widget; const cukeHrefWidget = `//a[@data-cuke="${widget}"]`; browser.waitForEnabled( cukeHrefWidget ); browser.click( cukeHrefWidget ); }); /* let href = null; this.When(/^I decide to delete the item,$/, function () { href = cukeHrefDelete; browser.waitForExist( href ); }); this.Then(/^I see it is disabled\.$/, function () { expect(browser.isEnabled( href )).toBe(true); }); */ // ======================================================================= // Scenario: Unable to update widget // ------------------------------------------------------------------------ /* this.When(/^I attempt to edit the item,$/, function () { href = cukeHrefEdit; browser.waitForExist( href ); }); */ // ======================================================================= // Scenario: Prohibited from add and from update // ------------------------------------------------------------------------ this.Given(/^I have opened the widgets editor page : "([^"]*)"$/, function (_url) { browser.setViewportSize({ width: 1024, height: 480 }); browser.timeouts('implicit', 60000); browser.timeouts('page load', 60000); browser.url(_url); }); /* this.Then(/^I see the warning "([^"]*)"$/, function (_warning) { expect(_warning).toEqual(browser.getText(cukeWarning)); }); */ // ======================================================================= // Scenario: Hide widget // ------------------------------------------------------------------------ /* this.Given(/^I have elected to "([^"]*)" the "([^"]*)" item\.$/, function (_cmd, _widget) { link = '//a[@data-cuke="' + _widget + '"]'; browser.waitForEnabled( link ); browser.click(link); let cukeHrefCmd = '//a[@data-cuke="' + _cmd + '-widget"]'; browser.waitForEnabled( cukeHrefCmd ); browser.click( cukeHrefCmd ); }); */ /* this.Then(/^I no longer see that widget record\.$/, function () { browser.waitForEnabled( cukeWidgetsList ); let item = browser.elements(link); expect(item.value.length).toEqual(0); }); */ };
warehouseman/meteor-mantra-kickstarter
.pkgs/mmks_widget/.e2e_tests/features/widgets/step_defs.js
JavaScript
mit
5,126
<!DOCTYPE html> <?php include("initial-header.php"); include("config.php"); include('swift/lib/swift_required.php'); $error = ""; if($_SERVER["REQUEST_METHOD"] == "POST") { // username and password sent from form $db = mysqli_connect(DB_SERVER,DB_USERNAME,DB_PASSWORD,DB_DATABASE); $myusername = mysqli_real_escape_string($db,$_POST['username']); $mypassword = mysqli_real_escape_string($db,$_POST['password']); $sql = "SELECT email_id, Password, salt FROM login WHERE email_id='$myusername' "; $result = mysqli_query($db,$sql); $row = mysqli_fetch_array($result,MYSQLI_ASSOC); $count = mysqli_num_rows($result); // If email ID exists in the login table if($count == 1) { $salt = $row["salt"]; $password_hash = $row["Password"]; $myhash = hash('sha512', $mypassword . $salt); //If the password is correct if($password_hash == $myhash){ $_SESSION['login_user'] = $myusername; $random = rand(100000,999999); $sql2 = "UPDATE login SET otp=". $random ." WHERE User_id='". $myusername. "'"; $querry = mysqli_query($db,$sql2); $to = $myusername; $subject = 'Dual Authentication for Gamify'; $body = 'Greetings. Your one time password is: '.$random; $headers = 'From: Gamify <[email protected]>' . "\r\n" . 'Reply-To: Gamify <[email protected]>' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $result = mail($to, $subject, $body, $headers); header('Location: duo_auth.php'); } else{ $error = "Your Login Name or Password is invalid"; } }else { $error = "Your Login Name or Password is invalid"; } } ?> <div class="page-content container"> <div class="row"> <div class="col-md-4 col-md-offset-4"> <div class="login-wrapper"> <div class="box"> <div class="content-wrap"> <h6>Sign In</h6> <form action = "" method = "post"> <div class="input-group"> <span class="input-group-addon"><i class="fa fa-envelope"></i></span> <input class="form-control" type="text" name = "username" placeholder="User Name" autofocus required> </div> <br> <div class="input-group"> <span class="input-group-addon"><i class="fa fa-key"></i></span> <input class="form-control" type="password" name = "password" placeholder="Password" required> </div> <div class="already"> <span><?php if (isset($error)) echo $error ?></span> </div> <div class="action"> <input type = "submit" class="btn btn-primary btn-block signup" value = " Login "/> </div> </form> <br><br> <p><h4><a href="fg_pwd.php">Forgot Password?</a></h4></p><br> <h4><p>Don't have an account?<a href="email_id_verification.php"> Register now!</a></p></h4> </div> </div> </div> </div> <?php include('initial-footer.php'); ?> </div> </div> <!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> <script src="https://code.jquery.com/jquery.js"></script> <!-- Include all compiled plugins (below), or include individual files as needed --> <script src="bootstrap/js/bootstrap.min.js"></script> <script src="js/custom.js"></script> </body> </html>
prash1987/GamifyWebsite
login.php
PHP
mit
3,756
package net.spy.digg.parsers; import java.io.IOException; import org.w3c.dom.Document; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; import net.spy.digg.Story; /** * Parse a stories response. */ public class StoriesParser extends TimePagedItemParser<Story> { @Override protected String getRootElementName() { return "stories"; } @Override protected void handleDocument(Document doc) throws SAXException, IOException { parseCommonFields(doc); final NodeList nl=doc.getElementsByTagName("story"); for(int i=0; i<nl.getLength(); i++) { addItem(new StoryImpl(nl.item(i))); } } }
dustin/java-digg
src/main/java/net/spy/digg/parsers/StoriesParser.java
Java
mit
621
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("OptimalizationFun")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("OptimalizationFun")] [assembly: AssemblyCopyright("Copyright © 2014")] [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("8497300e-6541-4c7b-a1cd-592c2f61773d")] // 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")]
mswietlicki/OptimalizationFun
OptimalizationFun/Properties/AssemblyInfo.cs
C#
mit
1,410
require "../test_helper" require "rorschart/data/rorschart_data" module Rorschart class TestPivotSeries < Minitest::Unit::TestCase def test_pivot # Given data = [ {"collector_tstamp"=> Date.parse("2013-11-02"), "series" => "A", "count"=> 1}, {"collector_tstamp"=> Date.parse("2013-11-02"), "series" => "B", "count"=> 2}, {"collector_tstamp"=> Date.parse("2013-11-02"), "series" => "C", "count"=> 3}, {"collector_tstamp"=> Date.parse("2013-11-02"), "series" => "D", "count"=> 4}, {"collector_tstamp"=> Date.parse("2013-12-01"), "series" => "A", "count"=> 5}, {"collector_tstamp"=> Date.parse("2013-12-01"), "series" => "B", "count"=> 6}, {"collector_tstamp"=> Date.parse("2013-12-01"), "series" => "D", "count"=> 7} ] # When pivot_series = PivotSeries.new(data) # assert expected_cols = [ {:type=>"date", :label=>"collector_tstamp"}, {:type=>"number", :label=>"A"}, {:type=>"number", :label=>"B"}, {:type=>"number", :label=>"C"}, {:type=>"number", :label=>"D"} ] expected_rows = [ [Date.parse("2013-11-02"), 1, 2, 3, 4], [Date.parse("2013-12-01"), 5, 6, nil, 7] ] assert_equal expected_cols, pivot_series.cols assert_equal expected_rows, pivot_series.rows end def test_pivot_with_sum_column # Given data = [ {"collector_tstamp"=> Date.parse("2013-11-02"), "series" => "A", "count"=> 1}, {"collector_tstamp"=> Date.parse("2013-11-02"), "series" => "B", "count"=> 2}, {"collector_tstamp"=> Date.parse("2013-11-02"), "series" => "C", "count"=> 3}, {"collector_tstamp"=> Date.parse("2013-11-02"), "series" => "D", "count"=> 4}, {"collector_tstamp"=> Date.parse("2013-12-01"), "series" => "A", "count"=> nil}, {"collector_tstamp"=> Date.parse("2013-12-01"), "series" => "B", "count"=> 6}, {"collector_tstamp"=> Date.parse("2013-12-01"), "series" => "D", "count"=> 7} ] # When pivot_series = PivotSeries.new(data, add_total_column: true) # assert expected_cols = [ {:type=>"date", :label=>"collector_tstamp"}, {:type=>"number", :label=>"Total"}, {:type=>"number", :label=>"A"}, {:type=>"number", :label=>"B"}, {:type=>"number", :label=>"C"}, {:type=>"number", :label=>"D"} ] expected_rows = [ [Date.parse("2013-11-02"), 10, 1, 2, 3, 4], [Date.parse("2013-12-01"), 13, nil, 6, nil, 7] ] assert_equal expected_cols, pivot_series.cols assert_equal expected_rows, pivot_series.rows end def test_pivot_with_empty_data # Given data = [] # When pivot_series = PivotSeries.new(data) # assert expected_cols = [] expected_rows = [] assert_equal expected_cols, pivot_series.cols assert_equal expected_rows, pivot_series.rows end end end
viadeo/rorschart
test/data/pivot_series_test.rb
Ruby
mit
3,811
/* * The MIT License (MIT): http://opensource.org/licenses/mit-license.php * * Copyright (c) 2013-2014, Chris Behrens * * 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. * */ #define __FIL_BUILDING_LOCKING__ #include "core/filament.h" #include "locking/fil_lock.h" typedef struct _pyfil_lock { PyObject_HEAD int locked; FilWaiterList waiters; } PyFilLock; typedef struct _pyfil_rlock { PyFilLock lock; /* must remain first. */ uint64_t owner; uint64_t count; } PyFilRLock; static PyFilLock *_lock_new(PyTypeObject *type, PyObject *args, PyObject *kw) { PyFilLock *self = (PyFilLock *)type->tp_alloc(type, 0); if (self != NULL) { fil_waiterlist_init(self->waiters); } return self; } static int _lock_init(PyFilLock *self, PyObject *args, PyObject *kwargs) { return 0; } static void _lock_dealloc(PyFilLock *self) { assert(fil_waiterlist_empty(self->waiters)); PyObject_Del(self); } static int __lock_acquire(PyFilLock *lock, int blocking, struct timespec *ts) { if (!lock->locked && fil_waiterlist_empty(lock->waiters)) { lock->locked = 1; return 0; } if (!blocking) { return 1; } int err = fil_waiterlist_wait(lock->waiters, ts, NULL); if (err < 0) { return err; } assert(lock->locked == 1); return 0; } static int __lock_release(PyFilLock *lock) { if (!lock->locked) { PyErr_SetString(PyExc_RuntimeError, "release without acquire"); return -1; } if (fil_waiterlist_empty(lock->waiters)) { lock->locked = 0; return 0; } /* leave 'locked' set because a different thread is just * going to grab it anyway. This prevents some races without * additional work to resolve them. */ fil_waiterlist_signal_first(lock->waiters); return 0; } static int __rlock_acquire(PyFilRLock *lock, int blocking, struct timespec *ts) { uint64_t owner; owner = fil_get_ident(); if (!lock->lock.locked && fil_waiterlist_empty(lock->lock.waiters)) { lock->lock.locked = 1; lock->owner = owner; lock->count = 1; return 0; } if (owner == lock->owner) { lock->count++; return 0; } if (!blocking) { return 1; } int err = fil_waiterlist_wait(lock->lock.waiters, ts, NULL); if (err) { return err; } assert(lock->lock.locked == 1); lock->owner = owner; lock->count = 1; return 0; } static int __rlock_release(PyFilRLock *lock) { if (!lock->lock.locked || (fil_get_ident() != lock->owner)) { PyErr_SetString(PyExc_RuntimeError, "cannot release un-acquired lock"); return -1; } if (--lock->count > 0) { return 0; } lock->owner = 0; if (fil_waiterlist_empty(lock->lock.waiters)) { lock->lock.locked = 0; return 0; } /* leave 'locked' set because a different thread is just * going to grab it anyway. This prevents some races without * additional work to resolve them. */ fil_waiterlist_signal_first(lock->lock.waiters); return 0; } PyDoc_STRVAR(_lock_acquire_doc, "Acquire the lock."); static PyObject *_lock_acquire(PyFilLock *self, PyObject *args, PyObject *kwargs) { static char *keywords[] = {"blocking", "timeout", NULL}; PyObject *blockingobj = NULL; PyObject *timeout = NULL; struct timespec tsbuf; struct timespec *ts; int blocking; int err; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O!O", keywords, &PyBool_Type, &blockingobj, &timeout)) { return NULL; } if (fil_timespec_from_pyobj_interval(timeout, &tsbuf, &ts) < 0) { return NULL; } blocking = (blockingobj == NULL || blockingobj == Py_True); err = __lock_acquire(self, blocking, ts); if (err < 0 && err != -ETIMEDOUT) { return NULL; } if (err == 0) { Py_INCREF(Py_True); return Py_True; } Py_INCREF(Py_False); return Py_False; } PyDoc_STRVAR(_lock_locked_doc, "Is the lock locked?"); static PyObject *_lock_locked(PyFilLock *self) { PyObject *res = (self->locked || !fil_waiterlist_empty(self->waiters)) ? Py_True : Py_False; Py_INCREF(res); return res; } PyDoc_STRVAR(_lock_release_doc, "Release the lock."); static PyObject *_lock_release(PyFilLock *self) { if (__lock_release(self) < 0) { return NULL; } Py_RETURN_NONE; } static PyObject *_lock_enter(PyFilLock *self) { int err = __lock_acquire(self, 1, NULL); if (err) { if (!PyErr_Occurred()) { PyErr_Format(PyExc_RuntimeError, "unexpected failure in Lock.__enter__: %d", err); } return NULL; } Py_INCREF(self); return (PyObject *)self; } static PyObject *_lock_exit(PyFilLock *self, PyObject *args) { return _lock_release(self); } PyDoc_STRVAR(_rlock_acquire_doc, "Acquire the lock."); static PyObject *_rlock_acquire(PyFilRLock *self, PyObject *args, PyObject *kwargs) { static char *keywords[] = {"blocking", "timeout", NULL}; PyObject *blockingobj = NULL; PyObject *timeout = NULL; struct timespec tsbuf; struct timespec *ts; int blocking; int err; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O!O", keywords, &PyBool_Type, &blockingobj, &timeout)) { return NULL; } if (fil_timespec_from_pyobj_interval(timeout, &tsbuf, &ts) < 0) { return NULL; } blocking = (blockingobj == NULL || blockingobj == Py_True); err = __rlock_acquire(self, blocking, ts); if (err < 0 && err != -ETIMEDOUT) { return NULL; } if (err == 0) { Py_INCREF(Py_True); return Py_True; } Py_INCREF(Py_False); return Py_False; } PyDoc_STRVAR(_rlock_locked_doc, "Is the lock locked (by someone else)?"); static PyObject *_rlock_locked(PyFilRLock *self) { uint64_t owner = fil_get_ident(); PyObject *res = ((self->lock.locked && self->owner != owner) || !fil_waiterlist_empty(self->lock.waiters)) ? Py_True : Py_False; Py_INCREF(res); return res; } PyDoc_STRVAR(_rlock_release_doc, "Release the lock."); static PyObject *_rlock_release(PyFilRLock *self) { if (__rlock_release(self) < 0) { return NULL; } Py_RETURN_NONE; } static PyObject *_rlock_enter(PyFilRLock *self) { int err = __rlock_acquire(self, 1, NULL); if (err) { if (!PyErr_Occurred()) { PyErr_Format(PyExc_RuntimeError, "unexpected failure in RLock.__enter__: %d", err); } return NULL; } Py_INCREF(self); return (PyObject *)self; } static PyObject *_rlock_exit(PyFilRLock *self, PyObject *args) { return _rlock_release(self); } static PyMethodDef _lock_methods[] = { { "acquire", (PyCFunction)_lock_acquire, METH_VARARGS|METH_KEYWORDS, _lock_acquire_doc }, { "release", (PyCFunction)_lock_release, METH_NOARGS, _lock_release_doc }, { "locked", (PyCFunction)_lock_locked, METH_NOARGS, _lock_locked_doc }, { "__enter__", (PyCFunction)_lock_enter, METH_NOARGS, NULL }, { "__exit__", (PyCFunction)_lock_exit, METH_VARARGS, NULL }, { NULL, NULL } }; static PyMethodDef _rlock_methods[] = { { "acquire", (PyCFunction)_rlock_acquire, METH_VARARGS|METH_KEYWORDS, _rlock_acquire_doc }, { "release", (PyCFunction)_rlock_release, METH_NOARGS, _rlock_release_doc }, { "locked", (PyCFunction)_rlock_locked, METH_NOARGS, _rlock_locked_doc }, { "__enter__", (PyCFunction)_rlock_enter, METH_NOARGS, NULL }, { "__exit__", (PyCFunction)_rlock_exit, METH_VARARGS, NULL }, { NULL, NULL } }; static PyTypeObject _lock_type = { PyVarObject_HEAD_INIT(0, 0) "_filament.locking.Lock", /* tp_name */ sizeof(PyFilLock), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)_lock_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ FIL_DEFAULT_TPFLAGS, /* tp_flags */ 0, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ _lock_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ (initproc)_lock_init, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ (newfunc)_lock_new, /* tp_new */ PyObject_Del, /* tp_free */ 0, /* tp_is_gc */ 0, /* tp_bases */ 0, /* tp_mro */ 0, /* tp_cache */ 0, /* tp_subclasses */ 0, /* tp_weaklist */ 0, /* tp_del */ 0, /* tp_version_tag */ }; /* Re-entrant lock. We can use the same calls here */ static PyTypeObject _rlock_type = { PyVarObject_HEAD_INIT(0, 0) "_filament.locking.RLock", /* tp_name */ sizeof(PyFilRLock), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)_lock_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ FIL_DEFAULT_TPFLAGS, /* tp_flags */ 0, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ _rlock_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ (initproc)_lock_init, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ (newfunc)_lock_new, /* tp_new */ PyObject_Del, /* tp_free */ 0, /* tp_is_gc */ 0, /* tp_bases */ 0, /* tp_mro */ 0, /* tp_cache */ 0, /* tp_subclasses */ 0, /* tp_weaklist */ 0, /* tp_del */ 0, /* tp_version_tag */ }; /****************/ PyFilLock *fil_lock_alloc(void) { return _lock_new(&_lock_type, NULL, NULL); } PyFilRLock *fil_rlock_alloc(void) { return (PyFilRLock *)_lock_new(&_rlock_type, NULL, NULL); } int fil_lock_acquire(PyFilLock *lock, int blocking, struct timespec *ts) { return __lock_acquire(lock, blocking, ts); } int fil_rlock_acquire(PyFilRLock *rlock, int blocking, struct timespec *ts) { return __rlock_acquire(rlock, blocking, ts); } int fil_lock_release(PyFilLock *lock) { return __lock_release(lock); } int fil_rlock_release(PyFilRLock *rlock) { return __rlock_release(rlock); } int fil_lock_type_init(PyObject *module) { PyFilCore_Import(); if (PyType_Ready(&_lock_type) < 0) { return -1; } if (PyType_Ready(&_rlock_type) < 0) { return -1; } Py_INCREF((PyObject *)&_lock_type); if (PyModule_AddObject(module, "Lock", (PyObject *)&_lock_type) != 0) { Py_DECREF((PyObject *)&_lock_type); return -1; } Py_INCREF((PyObject *)&_rlock_type); if (PyModule_AddObject(module, "RLock", (PyObject *)&_rlock_type) != 0) { Py_DECREF((PyObject *)&_rlock_type); return -1; } return 0; }
comstud/filament
src/locking/fil_lock.c
C
mit
16,390
package de.thomas.dreja.ec.musicquiz.gui.dialog; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.app.DialogFragment; import android.content.DialogInterface; import android.os.Bundle; import de.thomas.dreja.ec.musicquiz.R; import de.thomas.dreja.ec.musicquiz.ctrl.PlaylistResolver.SortOrder; public class SortOrderSelectionDialog extends DialogFragment { private SortOrderSelectionListener listener; @Override public Dialog onCreateDialog(Bundle savedInstanceState) { String[] items = new String[SortOrder.values().length]; for(int i=0; i<items.length; i++) { items[i] = SortOrder.values()[i].getName(getResources()); } AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(R.string.sort_by) .setItems(items, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { listener.onSortOrderSelected(SortOrder.values()[which]); } }); return builder.create(); } public interface SortOrderSelectionListener { public void onSortOrderSelected(SortOrder order); } @Override public void onAttach(Activity activity) { super.onAttach(activity); // Verify that the host activity implements the callback interface try { // Instantiate the NoticeDialogListener so we can send events to the host listener = (SortOrderSelectionListener) activity; } catch (ClassCastException e) { // The activity doesn't implement the interface, throw exception throw new ClassCastException(activity.toString() + " must implement SortOrderSelectionListener"); } } }
Nanobot5770/DasMusikQuiz
src/de/thomas/dreja/ec/musicquiz/gui/dialog/SortOrderSelectionDialog.java
Java
mit
1,823
/* * Panel */ .panel { margin: 5rem auto; max-width: 64rem; background: $white; border: 0.4rem solid $black; box-shadow: 5px 5px 0px $black; &:first-child { margin-top: 0; } &:last-child { margin-bottom: 0; } } .panel-header { padding: 2rem; background: $secondary; border-bottom: 0.4rem solid $black; } .panel-title { color: $white; } .panel-content { padding: 3rem 2rem; }
scottdejonge/bonafide-bangers
src/styles/components/panel.css
CSS
mit
401
angular-multi-select-tree ============================= A native Angular multi select tree. No JQuery. ![BrowserStack Status](https://www.browserstack.com/automate/badge.svg?badge_key=<badge_key>) #### Demo Page: [Demo] (http://htmlpreview.github.io/?https://github.com/kjvelarde/angular-multiselectsearchtree/blob/master/demo/index.html) #### Features: Very Easy to Use: - Plug and Play component - Tree List - Databind - Filter/NoFilter by search textbox - Checkbox - Select one only or Multiselect - NO JQuery #### Design details: Custom element using Angular Directive and Templating #### Callbacks: This is your onchange :) ##### Usage: Get this awesome component to your project by: ```sh bower install kjvelarde-angular-multiselectsearchtree --save # bower install long name ehhfsaduasdu lol . just kidding use the first one :) ``` Make sure to load the scripts in your html. ```html <link rel="stylesheet" href="../dist/kjvelarde-multiselect-searchtree.min.css"> <script type="text/javascript" src="../dist/angular-multi-select-tree.min.js"></script> <script type="text/javascript" src="../dist/angular-multi-select-tree.tpl.js"></script> ``` And Inject the module as dependency to your angular app. ``` angular.module('[YOURAPPNAMEHERE!]', ['multiselect-searchtree', '....']); ``` ###### Html Structure: ```html <multiselect-searchtree multi-select="true" data-input-model="data" data-output-model="selectedItem2" data-callback="CustomCallback(item, selectedItems)" data-select-only-leafs="true"> </multiselect-searchtree> ``` That's what all you have to do. ##### License MIT, see [LICENSE.md](./LICENSE.md).
kjvelarde/angular-multiselectsearchtree
README.md
Markdown
mit
1,739
// // DNTag.h // DNTagView // // Created by dawnnnnn on 16/9/1. // Copyright © 2016年 dawnnnnn. All rights reserved. // #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> NS_ASSUME_NONNULL_BEGIN @interface DNTag : NSObject @property (nonatomic, copy) NSString *text; @property (nonatomic, copy) NSAttributedString *attributedText; @property (nonatomic, strong) UIColor *textColor; @property (nonatomic, strong) UIColor *bgColor; @property (nonatomic, strong) UIColor *highlightedBgColor; @property (nonatomic, strong) UIColor *borderColor; @property (nonatomic, strong) UIImage *bgImg; @property (nonatomic, strong) UIFont *font; @property (nonatomic, assign) CGFloat cornerRadius; @property (nonatomic, assign) CGFloat borderWidth; ///like padding in css @property (nonatomic, assign) UIEdgeInsets padding; ///if no font is specified, system font with fontSize is used @property (nonatomic, assign) CGFloat fontSize; ///default:YES @property (nonatomic, assign) BOOL enable; - (nonnull instancetype)initWithText: (nonnull NSString *)text; + (nonnull instancetype)tagWithText: (nonnull NSString *)text; @end NS_ASSUME_NONNULL_END
dawnnnnn/DNTagView
DNTagViewDemo/TagView/DNTag.h
C
mit
1,153
--- seo: title: Scheduling Parameters description: Scheduling an email with SMTP keywords: SMTP, send email, scheduling title: Scheduling Parameters weight: 10 layout: page navigation: show: true --- With scheduling, you can send large volumes of email in queued batches or target individual recipients by specifying a custom UNIX timestamp parameter. Using the parameters defined below, you can queue batches of emails targeting individual recipients. {% info %} **Emails can be scheduled up to 72 hours in advance.** However, this scheduling constraint does not apply to campaigns sent via [Marketing Campaigns]({{root_url}}/User_Guide/Marketing_Campaigns/index.html). {% endinfo%} This parameter allows SendGrid to begin processing a customer’s email requests before sending. SendGrid queues the messages and releases them when the timestamp indicates. This technique allows for a more efficient way to distribute large email requests and can **improve overall mail delivery time** performance. This functionality: * Improves efficiency of processing and distributing large volumes of email. * Reduces email pre-processing time. * Enables you to time email arrival to increase open rates. * Is available for free to all SendGrid customers. {% info %} Cancel Scheduled sends by including a batch ID with your send. For more information, check out [Cancel Scheduled Sends]({{root_url}}/API_Reference/Web_API_v3/cancel_schedule_send.html)! {% endinfo %} {% warning %} Using both `send_at` and `send_each_at` is not valid. Setting both causes your request to be dropped. {% endwarning %} {% anchor h2 %} Send At {% endanchor %} To schedule a send request for a large batch of emails, use the `send_at` parameter which will send all emails at approximately the same time. `send_at` is a [UNIX timestamp](https://en.wikipedia.org/wiki/Unix_time). <h4>Example of send_at email header</h4> {% codeblock lang:json %} { "send_at": 1409348513 } {% endcodeblock %} {% anchor h2 %} Send Each At {% endanchor %} To schedule a send request for individual recipients; use `send_each_at` to send emails to each recipient at the specified time. `send_each_at` is a sequence of UNIX timestamps, provided as an array. There must be one timestamp per email you wish to send. <h4>Example of send_each_at email header</h4> {% codeblock lang:json %} { "to": [ "<[email protected]>", "[email protected]", "[email protected]", "<[email protected]>", "[email protected]", "[email protected]" ], "send_each_at": [ 1409348513, 1409348514, 1409348515 ] } {% endcodeblock %} To allow for the cancellation of a scheduled send, you must include a `batch_id` with your send. To generate a valid `batch_id`, use the [batch id generation endpoint]({{root_url}}/API_Reference/Web_API_v3/cancel_scheduled_send.html#Cancel-Scheduled-Sends). A `batch_id` is valid for 10 days (864,000 seconds) after generation. <h4>Example of including a batch_id</h4> {% codeblock lang:json %} { "to": [ "<[email protected]>", "[email protected]", "[email protected]", "<[email protected]>", "[email protected]", "[email protected]" ], "send_at": 1409348513, "batch_id": "MWQxZmIyODYtNjE1Ni0xMWU1LWI3ZTUtMDgwMDI3OGJkMmY2LWEzMmViMjYxMw" } {% endcodeblock %} {% anchor h2 %} Additional Resources {% endanchor h2 %} - [SMTP Service Crash Course](https://sendgrid.com/blog/smtp-service-crash-course/) - [Getting Started with the SMTP API]({{root_url}}/API_Reference/SMTP_API/getting_started_smtp.html) - [Integrating with SMTP]({{root_url}}/API_Reference/SMTP_API/integrating_with_the_smtp_api.html) - [Building an SMTP Email]({{root_url}}/API_Reference/SMTP_API/building_an_smtp_email.html)
katieporter/docs
source/API_Reference/SMTP_API/scheduling_parameters.md
Markdown
mit
3,769
#pragma once #include "FtInclude.h" #include <string> namespace ft { class Library { public: Library(); ~Library(); FT_Library library = nullptr; Library(const Library&) = delete; Library(Library&&) = delete; Library& operator = (const Library&) = delete; Library& operator=(Library&&) = delete; std::string getVersionString() const; private: static int initialized; }; }
vladimirgamalian/fontbm
src/freeType/FtLibrary.h
C
mit
441
package com.github.fhtw.swp.tutorium.guice; import com.github.fhtw.swp.tutorium.composite.Leaf; import com.github.fhtw.swp.tutorium.composite.LeafTypeProvider; import com.github.fhtw.swp.tutorium.reflection.AnnotatedTypeFinder; import org.reflections.Configuration; import javax.inject.Inject; import java.util.Set; public class LeafTypeProviderImpl implements LeafTypeProvider { private final Configuration configuration; @Inject public LeafTypeProviderImpl(Configuration configuration) { this.configuration = configuration; } @Override public Set<Class<?>> getLeafTypes() { return new AnnotatedTypeFinder(configuration, Leaf.class).getAnnotatedTypes(); } }
fhtw-swp-tutorium/java-swp-test-tool
test-console/src/main/java/com/github/fhtw/swp/tutorium/guice/LeafTypeProviderImpl.java
Java
mit
709
#!/bin/sh tokenizer() { STRNG="${1}" DELIM="${2}" while : do NEW="${STRNG%${DELIM}}" while case "$NEW" in *${DELIM}*);; *)break;; esac do NEW="${NEW%${DELIM}*}" done TOKEN="${NEW%${DELIM}*}" STRNG="${STRNG#${TOKEN}${DELIM}}" printf "%s\n" "$TOKEN" case "$STRNG" in *${DELIM}*) ;; *) [ -n "$d" ] && break || d="1" ;; esac done } which(){ for i in $(tokenizer $PATH ":" ) do #echo "${i}" # test directory walk [ -d "${i}/${1}" ] && break [ -x "${i}/${1}" ] && echo "${i}/${1}" && exit done } which $@
csitd/shell-utils
which.sh
Shell
mit
732
// // RegionContainerViewController.h // MH4U Dex // // Created by Joseph Goldberg on 3/6/15. // Copyright (c) 2015 Joseph Goldberg. All rights reserved. // #import <UIKit/UIKit.h> @class Region; @interface RegionContainerViewController : UIViewController @property (nonatomic, strong) Region *region; @end
vokal/MH4U-Dex
MH4U Dex/RegionContainerViewController.h
C
mit
316
--- layout: post title: "Welcome to Jekyll!" date: 2015-12-13 00:34:28 -0600 author: kyletaylored category: jekyll image: get-started-with-jekyll.png --- You’ll find this post in your `_posts` directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run `jekyll serve`, which launches a web server and auto-regenerates your site when a file is updated. To add new posts, simply add a file in the `_posts` directory that follows the convention `YYYY-MM-DD-name-of-post.ext` and includes the necessary front matter. Take a look at the source for this post to get an idea about how it works. Jekyll also offers powerful support for code snippets: {% highlight ruby %} def print_hi(name) puts "Hi, #{name}" end print_hi('Tom') #=> prints 'Hi, Tom' to STDOUT. {% endhighlight %} Check out the [Jekyll docs][jekyll-docs] for more info on how to get the most out of Jekyll. File all bugs/feature requests at [Jekyll’s GitHub repo][jekyll-gh]. If you have questions, you can ask them on [Jekyll Talk][jekyll-talk]. [jekyll-docs]: http://jekyllrb.com/docs/home [jekyll-gh]: https://github.com/jekyll/jekyll [jekyll-talk]: https://talk.jekyllrb.com/
OpenDenton/opendenton.github.io
_drafts/welcome-to-jekyll.markdown
Markdown
mit
1,251
# cooper document with one key example class RevisionedObject include Cooper::Document revision_field :key, type: String end describe 'Updating documents' do let(:object) do RevisionedObject.new end it 'works like Mongoid::Document' do object.key = 'value0' object.save object.update_attributes(key: 'value1') expect(object.key).to eq 'value1' end end
floum/cooper
features/updating_documents_spec.rb
Ruby
mit
386
<?php namespace BackendBundle\Tests\Controller; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; class DefaultControllerTest extends WebTestCase { public function testIndex() { $client = static::createClient(); $crawler = $client->request('GET', '/'); $this->assertContains('Hello World', $client->getResponse()->getContent()); } }
haciel/sistema_comtable
tests/BackendBundle/Controller/DefaultControllerTest.php
PHP
mit
394
# AIT_MAIKON マイコン演習最終課題<br> 詳しくはwiki見て
soiya/AIT_MAIKON
README.md
Markdown
mit
71
--- title: The “Example” of Rest date: 07/09/2021 --- Besides the examples we already have looked at, this idea of types and symbols can apply to the biblical concept of rest as well. To see this, we go to the New Testament book of Hebrews. `Read Hebrews 4:1–11. What is the remaining promise of entering His rest referring to? How does Israel’s experience during the Exodus and the wilderness wanderings offer additional insights into the idea of entering into God’s rest?` The theme of perseverance and faithfulness is very important here. Though talking about the seventh-day Sabbath, the main focus of these verses (and what came before; see Hebrews 3:7–19) is really a call for God’s people to be persevering in faith; that is, to remain faithful to the Lord and the gospel. These passages remind the reader to take the lessons learned from God’s leading in the past seriously, “so that no one may fall by the same sort of disobedience” (Heb. 4:11, ESV). Pay attention, this is an opportunity! Israel did hear the gospel, the text continues, but the Word did not profit them. Instead of having their faith strengthened by trust and obedience, they chose rebellion (compare with Heb. 3:7–15), and thus, they never experienced the rest that God wanted for them. Hebrews 4:3 points to the close relationship between faith and rest. We can enter into His rest only when we believe and trust the One who promised rest and who can deliver on this promise, and that is, of course, Jesus Christ. `Read Hebrews 4:3 again. What was the main problem with the people referred to? What lesson can we take from this for ourselves, we who have had the “gospel . . . preached to us as well as to them” (Heb. 4:2, NKJV)?` The early Christian community accepted God’s prior revelation (what we call the “Old Testament”) and believed that Jesus Christ was the Lamb of God, the Sacrifice for their sins. And by faith in the Sacrifice, they could experience salvation in Jesus and the rest that we are offered in Him. `How can an understanding of what it means to be saved by the blood of Jesus help us enter into the kind of rest that we can have in Jesus, knowing that we are saved by grace and not by works?` --- #### Additional Reading: Selected Quotes from Ellen G. White There remaineth therefore a rest to the people of God. For he that is entered into his rest, he also hath ceased from his own works, as God [did] from his. Let us labour therefore to enter into that rest, lest any man fall after the same example of unbelief. [Hebrews 4:9–11]. The rest here spoken of is the rest of grace, obtained by following the prescription, Labor diligently. Those who learn of Jesus His meekness and lowliness find rest in the experience of practicing His lessons. It is not in indolence, in selfish ease and pleasure-seeking, that rest is obtained. Those who are unwilling to give the Lord faithful, earnest, loving service will not find spiritual rest in this life or in the life to come. Only from earnest labor comes peace and joy in the Holy Spirit—happiness on earth and glory hereafter.—Ellen G. White Comments, in _The SDA Bible Commentary_, vol. 7, p. 928. Rest is found when all self-justification, all reasoning from a selfish standpoint, is put away. Entire self-surrender, an acceptance of His ways, is the secret of perfect rest in His love. Do just what He has told you to do, and be assured that God will do all that He has said He would do. Have you come to Him, renouncing all your makeshifts, all your unbelief, all your self-righteousness? Come just as you are, weak, helpless, and ready to die. What is the “rest” promised?—It is the consciousness that God is true, that He never disappoints the one who comes to Him. His pardon is full and free, and His acceptance means rest to the soul, rest in His love.—_Our High Calling_, p. 97. We shall be saved eternally when we enter in through the gates into the city. Then we may rejoice that we are saved, eternally saved. But until then we need to heed the injunction of the apostle, and to “fear, lest, a promise being left us of entering into his rest, any of us should seem to come short of it” (Hebrews 4:1). Having a knowledge of Canaan, singing the songs of Canaan, rejoicing in the prospect of entering into Canaan, did not bring the children of Israel into the vineyards and olive groves of the Promised Land. They could make it theirs in truth only by occupation, by complying with the conditions, by exercising living faith in God, by appropriating His promises to themselves. Christ is the author and finisher of our faith, and when we yield to His hand we shall steadily grow in grace and in the knowledge of our Lord and Saviour. We shall make progress until we reach the full stature of men and women in Christ. Faith works by love, and purifies the soul, expelling the love of sin that leads to rebellion against, and transgression of, the law of God.—_That I May Know Him_, p. 162.
Adventech/sabbath-school-lessons
src/en/2021-03/11/04.md
Markdown
mit
5,019
using System; using System.Net; using Microsoft.Extensions.Logging; namespace CakesNoteProxy { public static class NoteProxyConfigure { public static ILoggerFactory LoggerFactory; public static class NoteApi { public static string SiteFqdn { get; private set; } public static string UserId { get; private set; } public static bool IsIntro { get; private set; } static NoteApi() { SiteFqdn = "https://note.mu"; UserId = "info"; IsIntro = true; } public static void SetGlobal(string noteSiteFqdn) { if ( noteSiteFqdn!=null) SiteFqdn = noteSiteFqdn; } public static void SetMyNote(string noteUserId, bool isIntro) { if (noteUserId != null) UserId = noteUserId; IsIntro = isIntro; } public static readonly string ApiRoot = "/api/v1"; } public static class NoteCache { public static int CachedItemsCountHardLimit = 50; public static TimeSpan MonitoringThreadInterval = TimeSpan.FromSeconds(12); public static TimeSpan CacheLifecycleTimeSpan = TimeSpan.FromSeconds(720); public static double CacheLifecycleSpeculativeExecutionRate = 0.8; } } }
SiroccoHub/CakesNoteProxy
src/CakesNoteProxy/NoteProxyConfigure.cs
C#
mit
1,514
module HealthSeven::V2_5 class Rq1 < ::HealthSeven::Segment # Anticipated Price attribute :anticipated_price, St, position: "RQ1.1" # Manufacturer Identifier attribute :manufacturer_identifier, Ce, position: "RQ1.2" # Manufacturer's Catalog attribute :manufacturer_s_catalog, St, position: "RQ1.3" # Vendor ID attribute :vendor_id, Ce, position: "RQ1.4" # Vendor Catalog attribute :vendor_catalog, St, position: "RQ1.5" # Taxable attribute :taxable, Id, position: "RQ1.6" # Substitute Allowed attribute :substitute_allowed, Id, position: "RQ1.7" end end
niquola/health_seven
lib/health_seven/2.5/segments/rq1.rb
Ruby
mit
581
using System; using Lunt.IO; namespace Lunt { /// <summary> /// Represent a dependency to an asset. /// </summary> public sealed class AssetDependency { private readonly FilePath _path; private readonly long _fileSize; private readonly string _checksum; /// <summary> /// Gets the path of the dependency. /// </summary> /// <value>The path of the dependency.</value> public FilePath Path { get { return _path; } } /// <summary> /// Gets the file size of the dependency. /// </summary> /// <value>The file size of the dependency.</value> public long FileSize { get { return _fileSize; } } /// <summary> /// Gets the checksum of the dependency. /// </summary> /// <value>The checksum of the dependency.</value> public string Checksum { get { return _checksum; } } /// <summary> /// Initializes a new instance of the <see cref="AssetDependency" /> class. /// </summary> /// <param name="path">The path.</param> /// <param name="fileSize">The file size.</param> /// <param name="checksum">The checksum.</param> public AssetDependency(FilePath path, long fileSize, string checksum) { if (path == null) { throw new ArgumentNullException("path"); } if (checksum == null) { throw new ArgumentNullException("checksum"); } _path = path; _fileSize = fileSize; _checksum = checksum; } } }
lunt/lunt
src/Lunt/AssetDependency.cs
C#
mit
1,748
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include "liste.h" #include "atl.h" #include "es.h" #define FILE_ATLETI "atleti.txt" #define FILE_ESERCIZI "esercizi.txt" #define MAX_NOME 25 #define LUNG_CODICE 5 #define non_strutturato ;; #ifdef _WIN32 #define F_CLEAR "cls" #else #define F_CLEAR "clear" #endif Atleta inputCercaAtleta(Lista); void makeDotTxt(char*, char*); FILE *inputStampaSuFile(); int main() { FILE *fp, *fEs; Atleta tmpAtl=newAtleta(); Lista atleti=newAtlCollection(); tabellaEs esercizi=newEsCollection(); char uInput[100], fileTxt[10]; char codice[LUNG_CODICE+1], nome[MAX_NOME+1], cognome[MAX_NOME+1]; char categoria[MAX_NOME+1], data[11]; int scelta=-1; int x,y; // file ESERCIZI if ((fp=fopen(FILE_ESERCIZI, "r"))==NULL){ printf("Errore! Impossibile aprire il file \"%s\"!\n", FILE_ESERCIZI); exit(1); } caricaEsercizi(esercizi, fp); fclose(fp); // ------------------------------------------------------------------------- // file degli ATLETI (riciclo fp) if ((fp=fopen(FILE_ATLETI, "r"))==NULL){ printf("Errore! Impossibile aprire il file \"%s\"!\n", FILE_ATLETI); exit(1); } caricaAtleti(atleti, fp); fclose(fp); // menu' for(non_strutturato) { system(F_CLEAR); puts("01. Stampa contenuto anagrafica"); puts("02. Stampa gli atleti divisi per categoria"); puts("03. Aggiornamento monte ore settimanali"); puts("04. Ricerca atleta per codice o cognome parziale"); puts("05. Aggiungi un atleta"); puts("06. Cancella un atleta"); for (x=80; x-->0; printf("-")); puts(""); // linea orizzontale puts("07. Caricare / salvare esercizi di un atleta"); puts("08. Modificare set / ripetizioni di un esercizio di un atleta"); puts("09. Aggiungi un esercizio"); puts("10. Cancella un esercizio"); for (x=80; x-->0; printf("-")); puts(""); puts("0. Esci"); puts(""); printf("> "); scanf("%d", &scelta); switch (scelta) { case 0: return 0; case 1: // stampa contetnuto anagrafica fp=inputStampaSuFile(); stampaAnagrafica(atleti, fp); if (fp!=stdout) fclose(fp); break; case 2: // stamapa divisi per categoria stampaPerCategoria(atleti); break; case 3: // aggiornamento monte ore settimanli if ((tmpAtl=inputCercaAtleta(atleti))==NULL) break; printf("Monte ore attuali: %d\n", getOreAtleta(tmpAtl)); printf("Nuovo monte ore: "); scanf("%d", &x); modificaOreAtl(tmpAtl, x); puts("Monte ore aggiornato correttamente!"); break; case 4: // ricerca atleta inputCercaAtleta(atleti); break; case 5: // aggiungi atleta printf("Codice: "); scanf("%s", codice); printf("Nome: "); scanf("%s", nome); printf("Cognome: "); scanf("%s", cognome); printf("Cateogria: "); scanf("%s", categoria); printf("Data : "); scanf("%s", data); printf("Monte ore: "); scanf("%d", &x); aggiungiAtletaByPar(atleti, codice, nome, cognome, categoria, data, x); puts("Atleta aggiunto correttamente!"); break; case 6: // cancellazione atleta if ((tmpAtl=inputCercaAtleta(atleti))==NULL) break; printf("Rimuovere l'atleta trovato? [s/n] "); scanf("%s", uInput); if (tolower(uInput[0])=='s') { cancellaAtleta(atleti, tmpAtl); puts("Atleta cancellato con successo!"); } break; case 7: // caricare / salvare esericizi per un atleta if ((tmpAtl=inputCercaAtleta(atleti))==NULL) break; if (eserciziCaricatiAtl(tmpAtl)) { // se gli esercizi sono già stati caricati fp=inputStampaSuFile(); stampaTuttiEs(getListaEsercizi(tmpAtl), fp); break; } //else: cerco di caricare il piano esercizi per l'altleta makeDotTxt(fileTxt, getCodiceAtleta(tmpAtl)); if ((fEs=fopen(fileTxt, "r"))!=NULL) { // se ho trovato un file con il codice dell'atleta... caricaPianoEsercizi(getListaEsercizi(tmpAtl), esercizi, fEs); puts("Piano degli esercizi caricato correttamente"); fclose(fEs); } else { printf("Non ho trovato un piano esercizi per %s\n", getCodiceAtleta(tmpAtl)); } break; case 8: // modificare il numero di set/ripetizioni if ((tmpAtl=inputCercaAtleta(atleti))==NULL) break; if (!eserciziCaricatiAtl(tmpAtl)){ printf("Esercizi non caricati per \"%s\"", getCodiceAtleta(tmpAtl)); break; } // se gli esercizi sono già stati caricati printf("Nome dell'esercizio per modificare set/ripetizioni: "); scanf("%s", uInput); printf("Nuovo n* set: "); scanf("%d", &x); printf("Nuovo n* ripetizioni: "); scanf("%d", &y); if(modificaPianoEsByName(getListaEsercizi(tmpAtl), uInput, x, y)){ puts("Modifiche effettuate con successo!"); } else { puts("Errore! Esercizio non trovato."); } break; case 9: // aggiunta di un esercizio // ho bisogno sia dei set/ripetizioni da mettere nella lista, sia // dell'esercizio da far pountare quindi del nome, della // categoria e del tipo di esercizio if ((tmpAtl=inputCercaAtleta(atleti))==NULL) break; printf("Nome dell'esercizio da aggiungere: "); scanf("%s", uInput); printf("Nuovo n* set: "); scanf("%d", &x); printf("Nuovo n* ripetizioni: "); scanf("%d", &y); if(aggiungiEs(getListaEsercizi(tmpAtl), esercizi, uInput, x, y)) { puts("Esercizio aggiunto con successo!"); } else { printf("Impossibile trovare l'esercizio \"%s\"!\n", uInput); } break; case 10: // cancellazione di un esercizio if ((tmpAtl=inputCercaAtleta(atleti))==NULL) break; if (!eserciziCaricatiAtl(tmpAtl)){ printf("Esercizi non caricati per \"%s\"", getCodiceAtleta(tmpAtl)); break; } // se gli esercizi sono già stati caricati printf("Nome dell'esercizio da cancellare: "); scanf("%s", uInput); // scorro tutti gli elementi della lista con p=head della lista if (cancellaPianoEsByName(getListaEsercizi(tmpAtl), uInput)) puts("Esercizio cancellato con successo!"); else puts("Errore! Esercizio non trovato!"); break; default: puts("Comando non trovato."); } getc(stdin); // prendo il ritorno a capo della scanf printf("\nPremere invio per tornare al menu'... "); getc(stdin); // aspetto che l'utente prema invio } return 0; } Atleta inputCercaAtleta(Lista l) { char c[MAX_NOME+1]; Atleta atl; printf("Codice o cognome parziale dell'atleta: "); scanf("%s", c); if ((atl=cercaAtleta(l, c))!=NULL) { stampaAtleta(atl, stdout); return atl; } else { puts("Atleta non trovato"); return NULL; } } FILE *inputStampaSuFile() { FILE *fp; char c[3], f[100]; printf("Stampa su file? [s/n] "); scanf("%s", c); if (tolower(c[0])=='s') { printf("Inserisci il nome del file: "); scanf("%s", f); if ((fp=fopen(f, "w"))==NULL) { printf("Errore! Impossibile aprire il file \"%s\"", f); printf("Stampo a video...\n"); return stdout; } else { return fp; } } else { return stdout; } } void makeDotTxt(char *dst, char *src) { strcpy(dst, src); strcat(dst, ".txt"); }
supermirtillo/polito-c-apa
L08/E04/main.c
C
mit
8,509
#include "ofQuickTimeGrabber.h" #include "ofUtils.h" #if !defined(TARGET_LINUX) && !defined(MAC_OS_X_VERSION_10_7) //--------------------------------- #ifdef OF_VIDEO_CAPTURE_QUICKTIME //--------------------------------- //-------------------------------------------------------------- static ComponentResult frameIsGrabbedProc(SGChannel sgChan, short nBufferNum, Boolean *pbDone, long lRefCon); static ComponentResult frameIsGrabbedProc(SGChannel sgChan, short nBufferNum, Boolean *pbDone, long lRefCon){ ComponentResult err = SGGrabFrameComplete( sgChan, nBufferNum, pbDone ); bool * havePixChanged = (bool *)lRefCon; *havePixChanged = true; return err; } //--------------------------------- #endif //--------------------------------- //-------------------------------------------------------------------- ofQuickTimeGrabber::ofQuickTimeGrabber(){ //--------------------------------- #ifdef OF_VIDEO_CAPTURE_QUICKTIME //--------------------------------- initializeQuicktime(); bSgInited = false; gSeqGrabber = nullptr; offscreenGWorldPixels = nullptr; //--------------------------------- #endif //--------------------------------- // common bIsFrameNew = false; bVerbose = false; bGrabberInited = false; bChooseDevice = false; deviceID = 0; //width = 320; // default setting //height = 240; // default setting //pixels = nullptr; attemptFramerate = -1; } //-------------------------------------------------------------------- ofQuickTimeGrabber::~ofQuickTimeGrabber(){ close(); //--------------------------------- #ifdef OF_VIDEO_CAPTURE_QUICKTIME //--------------------------------- if (offscreenGWorldPixels != nullptr){ delete[] offscreenGWorldPixels; offscreenGWorldPixels = nullptr; } //--------------------------------- #endif //--------------------------------- } //-------------------------------------------------------------------- void ofQuickTimeGrabber::setVerbose(bool bTalkToMe){ bVerbose = bTalkToMe; } //-------------------------------------------------------------------- void ofQuickTimeGrabber::setDeviceID(int _deviceID){ deviceID = _deviceID; bChooseDevice = true; } //-------------------------------------------------------------------- void ofQuickTimeGrabber::setDesiredFrameRate(int framerate){ attemptFramerate = framerate; } //--------------------------------------------------------------------------- bool ofQuickTimeGrabber::setPixelFormat(ofPixelFormat pixelFormat){ //note as we only support RGB we are just confirming that this pixel format is supported if( pixelFormat == OF_PIXELS_RGB ){ return true; } ofLogWarning("ofQuickTimeGrabber") << "setPixelFormat(): requested pixel format " << pixelFormat << " not supported"; return false; } //--------------------------------------------------------------------------- ofPixelFormat ofQuickTimeGrabber::getPixelFormat() const { //note if you support more than one pixel format you will need to return a ofPixelFormat variable. return OF_PIXELS_RGB; } //-------------------------------------------------------------------- bool ofQuickTimeGrabber::setup(int w, int h){ //--------------------------------- #ifdef OF_VIDEO_CAPTURE_QUICKTIME //--------------------------------- //---------------------------------- 1 - open the sequence grabber if( !qtInitSeqGrabber() ){ ofLogError("ofQuickTimeGrabber") << "initGrabber(): unable to initialize the seq grabber"; return false; } //---------------------------------- 2 - set the dimensions //width = w; //height = h; MacSetRect(&videoRect, 0, 0, w, h); //---------------------------------- 3 - buffer allocation // Create a buffer big enough to hold the video data, // make sure the pointer is 32-byte aligned. // also the rgb image that people will grab offscreenGWorldPixels = (unsigned char*)malloc(4 * w * h + 32); pixels.allocate(w, h, OF_IMAGE_COLOR); #if defined(TARGET_OSX) && defined(__BIG_ENDIAN__) QTNewGWorldFromPtr (&(videogworld), k32ARGBPixelFormat, &(videoRect), nullptr, nullptr, 0, (offscreenGWorldPixels), 4 * w); #else QTNewGWorldFromPtr (&(videogworld), k24RGBPixelFormat, &(videoRect), nullptr, nullptr, 0, (pixels.getPixels()), 3 * w); #endif LockPixels(GetGWorldPixMap(videogworld)); SetGWorld (videogworld, nullptr); SGSetGWorld(gSeqGrabber, videogworld, nil); //---------------------------------- 4 - device selection bool didWeChooseADevice = bChooseDevice; bool deviceIsSelected = false; //if we have a device selected then try first to setup //that device if(didWeChooseADevice){ deviceIsSelected = qtSelectDevice(deviceID, true); if(!deviceIsSelected && bVerbose) ofLogError("ofQuickTimeGrabber") << "initGrabber(): unable to open device[" << deviceID << "], will attempt other devices"; } //if we couldn't select our required device //or we aren't specifiying a device to setup //then lets try to setup ANY device! if(deviceIsSelected == false){ //lets list available devices listDevices(); setDeviceID(0); deviceIsSelected = qtSelectDevice(deviceID, false); } //if we still haven't been able to setup a device //we should error and stop! if( deviceIsSelected == false){ goto bail; } //---------------------------------- 5 - final initialization steps OSStatus err; err = SGSetChannelUsage(gVideoChannel,seqGrabPreview); if ( err != noErr ) goto bail; //----------------- callback method for notifying new frame err = SGSetChannelRefCon(gVideoChannel, (long)&bHavePixelsChanged ); if(!err) { VideoBottles vb; /* get the current bottlenecks */ vb.procCount = 9; err = SGGetVideoBottlenecks(gVideoChannel, &vb); if (!err) { myGrabCompleteProc = NewSGGrabCompleteBottleUPP(frameIsGrabbedProc); vb.grabCompleteProc = myGrabCompleteProc; /* add our GrabFrameComplete function */ err = SGSetVideoBottlenecks(gVideoChannel, &vb); } } err = SGSetChannelBounds(gVideoChannel, &videoRect); if ( err != noErr ) goto bail; err = SGPrepare(gSeqGrabber, true, false); //theo swapped so preview is true and capture is false if ( err != noErr ) goto bail; err = SGStartPreview(gSeqGrabber); if ( err != noErr ) goto bail; bGrabberInited = true; loadSettings(); if( attemptFramerate >= 0 ){ err = SGSetFrameRate(gVideoChannel, IntToFixed(attemptFramerate) ); if ( err != noErr ){ ofLogError("ofQuickTimeGrabber") << "initGrabber: couldn't setting framerate to " << attemptFramerate << ": OSStatus " << err; } } ofLogNotice("ofQuickTimeGrabber") << " inited grabbed "; ofLogNotice("ofQuickTimeGrabber") << "-------------------------------------"; // we are done return true; //--------------------- (bail) something's wrong ----- bail: ofLogError("ofQuickTimeGrabber") << "***** ofQuickTimeGrabber error *****"; ofLogError("ofQuickTimeGrabber") << "------------------------------------"; //if we don't close this - it messes up the next device! if(bSgInited) qtCloseSeqGrabber(); bGrabberInited = false; return false; //--------------------------------- #else //--------------------------------- return false; //--------------------------------- #endif //--------------------------------- } //-------------------------------------------------------------------- bool ofQuickTimeGrabber::isInitialized() const{ return bGrabberInited; } //-------------------------------------------------------------------- vector<ofVideoDevice> ofQuickTimeGrabber::listDevices() const{ vector <ofVideoDevice> devices; //--------------------------------- #ifdef OF_VIDEO_CAPTURE_QUICKTIME //--------------------------------- bool bNeedToInitGrabberFirst = false; if (!bSgInited) bNeedToInitGrabberFirst = true; //if we need to initialize the grabbing component then do it if( bNeedToInitGrabberFirst ){ if( !qtInitSeqGrabber() ){ return devices; } } ofLogNotice("ofQuickTimeGrabber") << "-------------------------------------"; /* //input selection stuff (ie multiple webcams) //from http://developer.apple.com/samplecode/SGDevices/listing13.html //and originally http://lists.apple.com/archives/QuickTime-API/2008/Jan/msg00178.html */ SGDeviceList deviceList; SGGetChannelDeviceList (gVideoChannel, sgDeviceListIncludeInputs, &deviceList); unsigned char pascalName[64]; unsigned char pascalNameInput[64]; //this is our new way of enumerating devices //quicktime can have multiple capture 'inputs' on the same capture 'device' //ie the USB Video Class Video 'device' - can have multiple usb webcams attached on what QT calls 'inputs' //The isight for example will show up as: //USB Video Class Video - Built-in iSight ('input' 1 of the USB Video Class Video 'device') //Where as another webcam also plugged whill show up as //USB Video Class Video - Philips SPC 1000NC Webcam ('input' 2 of the USB Video Class Video 'device') //this means our the device ID we use for selection has to count both capture 'devices' and their 'inputs' //this needs to be the same in our init grabber method so that we select the device we ask for int deviceCount = 0; ofLogNotice("ofQuickTimeGrabber") << "listing available capture devices"; for(int i = 0 ; i < (*deviceList)->count ; ++i) { SGDeviceName nameRec; nameRec = (*deviceList)->entry[i]; SGDeviceInputList deviceInputList = nameRec.inputs; int numInputs = 0; if( deviceInputList ) numInputs = ((*deviceInputList)->count); memcpy(pascalName, (*deviceList)->entry[i].name, sizeof(char) * 64); //this means we can use the capture method if(nameRec.flags != sgDeviceNameFlagDeviceUnavailable){ //if we have a capture 'device' (qt's word not mine - I would prefer 'system' ) that is ready to be used //we go through its inputs to list all physical devices - as there could be more than one! for(int j = 0; j < numInputs; j++){ //if our 'device' has inputs we get their names here if( deviceInputList ){ SGDeviceInputName inputNameRec = (*deviceInputList)->entry[j]; memcpy(pascalNameInput, inputNameRec.name, sizeof(char) * 64); } ofLogNotice() << "device [" << deviceCount << "] " << p2cstr(pascalName) << " - " << p2cstr(pascalNameInput); ofVideoDevice vd; vd.id = deviceCount; vd.deviceName = p2cstr(pascalName); vd.bAvailable = true; devices.push_back(vd); //we count this way as we need to be able to distinguish multiple inputs as devices deviceCount++; } }else{ ofLogNotice("ofQuickTimeGrabber") << "(unavailable) device [" << deviceCount << "] " << p2cstr(pascalName); ofVideoDevice vd; vd.id = deviceCount; vd.deviceName = p2cstr(pascalName); vd.bAvailable = false; devices.push_back(vd); deviceCount++; } } ofLogNotice("ofQuickTimeGrabber") << "-------------------------------------"; //if we initialized the grabbing component then close it if( bNeedToInitGrabberFirst ){ qtCloseSeqGrabber(); } //--------------------------------- #endif //--------------------------------- return devices; } //-------------------------------------------------------------------- void ofQuickTimeGrabber::update(){ //--------------------------------- #ifdef OF_VIDEO_CAPTURE_QUICKTIME //--------------------------------- if (bGrabberInited == true){ SGIdle(gSeqGrabber); // set the top pixel alpha = 0, so we can know if it // was a new frame or not.. // or else we will process way more than necessary // (ie opengl is running at 60fps +, capture at 30fps) if (bHavePixelsChanged){ #if defined(TARGET_OSX) && defined(__BIG_ENDIAN__) convertPixels(offscreenGWorldPixels, pixels.getPixels(), width, height); #endif } } // newness test for quicktime: if (bGrabberInited == true){ bIsFrameNew = false; if (bHavePixelsChanged == true){ bIsFrameNew = true; bHavePixelsChanged = false; } } //--------------------------------- #endif //--------------------------------- } //--------------------------------------------------------------------------- ofPixels& ofQuickTimeGrabber::getPixels(){ return pixels; } //--------------------------------------------------------------------------- const ofPixels& ofQuickTimeGrabber::getPixels() const { return pixels; } //--------------------------------------------------------------------------- bool ofQuickTimeGrabber::isFrameNew() const { return bIsFrameNew; } //-------------------------------------------------------------------- float ofQuickTimeGrabber::getWidth() const { return pixels.getWidth(); } //-------------------------------------------------------------------- float ofQuickTimeGrabber::getHeight() const { return pixels.getHeight(); } //-------------------------------------------------------------------- void ofQuickTimeGrabber::clearMemory(){ pixels.clear(); } //-------------------------------------------------------------------- void ofQuickTimeGrabber::close(){ //--------------------------------- #ifdef OF_VIDEO_CAPTURE_QUICKTIME //--------------------------------- qtCloseSeqGrabber(); DisposeSGGrabCompleteBottleUPP(myGrabCompleteProc); //--------------------------------- #endif //--------------------------------- clearMemory(); } //-------------------------------------------------------------------- void ofQuickTimeGrabber::videoSettings(void){ //--------------------------------- #ifdef OF_VIDEO_CAPTURE_QUICKTIME //--------------------------------- Rect curBounds, curVideoRect; ComponentResult err; // Get our current state err = SGGetChannelBounds (gVideoChannel, &curBounds); if (err != noErr){ ofLogError("ofQuickTimeGrabber") << "videoSettings(): couldn't get get channel bounds: ComponentResult " << err; return; } err = SGGetVideoRect (gVideoChannel, &curVideoRect); if (err != noErr){ ofLogError("ofQuickTimeGrabber") << "videoSettings(): couldn't get video rect: ComponentResult " << err; return; } // Pause err = SGPause (gSeqGrabber, true); if (err != noErr){ ofLogError("ofQuickTimeGrabber") << "videoSettings(): couldn't set pause: ComponentResult " << err; return; } #ifdef TARGET_OSX //load any saved camera settings from file loadSettings(); static SGModalFilterUPP gSeqGrabberModalFilterUPP = NewSGModalFilterUPP(SeqGrabberModalFilterUPP); ComponentResult result = SGSettingsDialog(gSeqGrabber, gVideoChannel, 0, nil, 0, gSeqGrabberModalFilterUPP, nil); if (result != noErr){ ofLogError("ofQuickTimeGrabber") << "videoSettings(): settings dialog error: ComponentResult " << err; return; } //save any changed settings to file saveSettings(); #else SGSettingsDialog(gSeqGrabber, gVideoChannel, 0, nil, seqGrabSettingsPreviewOnly, nullptr, 0); #endif SGSetChannelBounds(gVideoChannel, &videoRect); SGPause (gSeqGrabber, false); //--------------------------------- #endif //--------------------------------- } //-------------------------------------------------------------------- #ifdef TARGET_OSX //-------------------------------------------------------------------- //--------------------------------------------------------------------- bool ofQuickTimeGrabber::saveSettings(){ if (bGrabberInited != true) return false; ComponentResult err; UserData mySGVideoSettings = nullptr; // get the SGChannel settings cofigured by the user err = SGGetChannelSettings(gSeqGrabber, gVideoChannel, &mySGVideoSettings, 0); if ( err != noErr ){ ofLogError("ofQuickTimeGrabber") << "saveSettings(): couldn't get camera settings: ComponentResult " << err; return false; } string pref = "ofVideoSettings-"+deviceName; CFStringRef cameraString = CFStringCreateWithCString(kCFAllocatorDefault,pref.c_str(),kCFStringEncodingMacRoman); //get the settings using the key "ofVideoSettings-the name of the device" SaveSettingsPreference( cameraString, mySGVideoSettings); DisposeUserData(mySGVideoSettings); return true; } //--------------------------------------------------------------------- bool ofQuickTimeGrabber::loadSettings(){ if (bGrabberInited != true || deviceName.length() == 0) return false; ComponentResult err; UserData mySGVideoSettings = nullptr; // get the settings using the key "ofVideoSettings-the name of the device" string pref = "ofVideoSettings-"+deviceName; CFStringRef cameraString = CFStringCreateWithCString(kCFAllocatorDefault,pref.c_str(),kCFStringEncodingMacRoman); GetSettingsPreference(cameraString, &mySGVideoSettings); if (mySGVideoSettings){ Rect curBounds, curVideoRect; //we need to make sure the dimensions don't get effected //by our preferences // Get our current state err = SGGetChannelBounds (gVideoChannel, &curBounds); if (err != noErr){ ofLogError("ofQuickTimeGrabber") << "loadSettings(): couldn't set channel bounds: ComponentResult " << err; } err = SGGetVideoRect (gVideoChannel, &curVideoRect); if (err != noErr){ ofLogError("ofQuickTimeGrabber") << "loadSettings(): couldn't set video rect: ComponentResult " << err; } // use the saved settings preference to configure the SGChannel err = SGSetChannelSettings(gSeqGrabber, gVideoChannel, mySGVideoSettings, 0); if ( err != noErr ) { ofLogError("ofQuickTimeGrabber") << "loadSettings(): couldn't set channel settings: ComponentResult " << err; return false; } DisposeUserData(mySGVideoSettings); // Pause err = SGPause (gSeqGrabber, true); if (err != noErr){ ofLogError("ofQuickTimeGrabber") << "loadSettings(): couldn't set pause: ComponentResult " << err; } SGSetChannelBounds(gVideoChannel, &videoRect); SGPause (gSeqGrabber, false); }else{ ofLogWarning("ofQuickTimeGrabber") << "loadSettings(): no camera settings to load"; return false; } return true; } //------------------------------------------------------ bool ofQuickTimeGrabber::qtInitSeqGrabber(){ if (bSgInited != true){ OSErr err = noErr; ComponentDescription theDesc; Component sgCompID; // this crashes when we get to // SGNewChannel // we get -9405 as error code for the channel // ----------------------------------------- // gSeqGrabber = OpenDefaultComponent(SeqGrabComponentType, 0); // this seems to work instead (got it from hackTV) // ----------------------------------------- theDesc.componentType = SeqGrabComponentType; theDesc.componentSubType = nullptr; theDesc.componentManufacturer = 'appl'; theDesc.componentFlags = nullptr; theDesc.componentFlagsMask = nullptr; sgCompID = FindNextComponent (nullptr, &theDesc); // ----------------------------------------- if (sgCompID == nullptr){ ofLogError("ofQuickTimeGrabber") << "qtInitSeqGrabber(): findNextComponent did not return a valid component"; return false; } gSeqGrabber = OpenComponent(sgCompID); err = GetMoviesError(); if (gSeqGrabber == nullptr || err) { ofLogError("ofQuickTimeGrabber") << "qtInitSeqGrabber(): couldn't get default sequence grabber component: OSErr " << err; return false; } err = SGInitialize(gSeqGrabber); if (err != noErr) { ofLogError("ofQuickTimeGrabber") << "qtInitSeqGrabber(): can't initialize sequence grabber component: OSErr " << err; return false; } err = SGSetDataRef(gSeqGrabber, 0, 0, seqGrabDontMakeMovie); if (err != noErr) { ofLogError("ofQuickTimeGrabber") << "qtInitSeqGrabber(): can't set the destination data reference: OSErr " << err; return false; } // windows crashes w/ out gworld, make a dummy for now... // this took a long time to figure out. err = SGSetGWorld(gSeqGrabber, 0, 0); if (err != noErr) { ofLogError("ofQuickTimeGrabber") << "qtInitSeqGrabber(): setting up the gworld: OSErr " << err; return false; } err = SGNewChannel(gSeqGrabber, VideoMediaType, &(gVideoChannel)); if (err != noErr) { ofLogError("ofQuickTimeGrabber") << "qtInitSeqGrabber(): couldn't create a new channel: OSErr " << err; ofLogError("ofQuickTimeGrabber") << "qtInitSeqGrabber(): check if you have any qt capable cameras attached"; return false; } bSgInited = true; return true; } return false; } //-------------------------------------------------------------------- bool ofQuickTimeGrabber::qtCloseSeqGrabber(){ if (gSeqGrabber != nullptr){ SGStop (gSeqGrabber); CloseComponent (gSeqGrabber); gSeqGrabber = nullptr; bSgInited = false; return true; } return false; } //-------------------------------------------------------------------- bool ofQuickTimeGrabber::qtSelectDevice(int deviceNumber, bool didWeChooseADevice){ //note - check for memory freeing possibly needed for the all SGGetChannelDeviceList mac stuff // also see notes in listDevices() regarding new enunemeration method. //Generate a device list and enumerate //all devices availble to the channel SGDeviceList deviceList; SGGetChannelDeviceList(gVideoChannel, sgDeviceListIncludeInputs, &deviceList); unsigned char pascalName[64]; unsigned char pascalNameInput[64]; int numDevices = (*deviceList)->count; if(numDevices == 0){ ofLogError("ofQuickTimeGrabber") << "no capture devices found"; return false; } int deviceCount = 0; for(int i = 0 ; i < numDevices; ++i) { SGDeviceName nameRec; nameRec = (*deviceList)->entry[i]; SGDeviceInputList deviceInputList = nameRec.inputs; int numInputs = 0; if( deviceInputList ) numInputs = ((*deviceInputList)->count); memcpy(pascalName, (*deviceList)->entry[i].name, sizeof(char) * 64); memset(pascalNameInput, 0, sizeof(char)*64); //this means we can use the capture method if(nameRec.flags != sgDeviceNameFlagDeviceUnavailable){ //if we have a capture 'device' (qt's word not mine - I would prefer 'system' ) that is ready to be used //we go through its inputs to list all physical devices - as there could be more than one! for(int j = 0; j < numInputs; j++){ //if our 'device' has inputs we get their names here if( deviceInputList ){ SGDeviceInputName inputNameRec = (*deviceInputList)->entry[j]; memcpy(pascalNameInput, inputNameRec.name, sizeof(char) * 64); } //if the device number matches we try and setup the device //if we didn't specifiy a device then we will try all devices till one works! if( deviceCount == deviceNumber || !didWeChooseADevice ){ ofLogNotice("ofQuickTimeGrabber") << "attempting to open device [" << deviceCount << "] " << p2cstr(pascalName) << " - " << p2cstr(pascalNameInput); OSErr err1 = SGSetChannelDevice(gVideoChannel, pascalName); OSErr err2 = SGSetChannelDeviceInput(gVideoChannel, j); int successLevel = 0; //if there were no errors then we have opened the device without issue if ( err1 == noErr && err2 == noErr){ successLevel = 2; } //parameter errors are not fatal so we will try and open but will caution the user else if ( (err1 == paramErr || err1 == noErr) && (err2 == noErr || err2 == paramErr) ){ successLevel = 1; } //the device is opened! if ( successLevel > 0 ){ deviceName = (char *)p2cstr(pascalName); deviceName += "-"; deviceName += (char *)p2cstr(pascalNameInput); if(successLevel == 2){ ofLogNotice("ofQuickTimeGrabber") << "device " << deviceName << " opened successfully"; } else{ ofLogWarning("ofQuickTimeGrabber") << "device " << deviceName << " opened with some paramater errors, should be fine though!"; } //no need to keep searching - return that we have opened a device! return true; }else{ //if we selected a device in particular but failed we want to go through the whole list again - starting from 0 and try any device. //so we return false - and try one more time without a preference if( didWeChooseADevice ){ ofLogWarning("ofQuickTimeGrabber") << "problems setting device [" << deviceNumber << "] " << p2cstr(pascalName) << " - " << p2cstr(pascalNameInput) << " *****"; return false; }else{ ofLogWarning("ofQuickTimeGrabber") << "unable to open device, trying next device"; } } } //we count this way as we need to be able to distinguish multiple inputs as devices deviceCount++; } }else{ //ofLogError("ofQuickTimeGrabber") << "(unavailable) device [" << deviceCount << "] " << p2cstr(pascalName); deviceCount++; } } return false; } //--------------------------------- #endif //--------------------------------- #endif
murataka9/iOSinOF-NativeGUISample
of_v0.9.3_ios_release/libs/openFrameworks/video/ofQuickTimeGrabber.cpp
C++
mit
25,185
# frozen_string_literal: true require 'spec_helper' describe 'logging' do it "should have a logger" do expect(Dummy).to respond_to(:logger) end it "should be able to log debug methods" do expect(Dummy.logger).to respond_to(:debug) end it "should be settable" do expect(Dummy).to respond_to(:logger=) log = double Dummy.logger = log expect(Dummy.logger).to eq(log) end end
controlshift/vertebrae
spec/logger_spec.rb
Ruby
mit
412
// // RepeatExpression.h // iLogo // // Created by Yuhua Mai on 10/27/13. // Copyright (c) 2013 Yuhua Mai. All rights reserved. // #import "ScopedExpression.h" //#import "Expression.h" @interface RepeatExpression : ScopedExpression { Expression *variableExpression; NSMutableArray *commandExpression; } - (void)convert:(NSMutableArray*)commandList; - (NSMutableArray*)evaluate:(TurtleCommand*)lastTurtleCommand; @end
myhgew/iLogo
iLogo/iLogo/model/expression/RepeatExpression.h
C
mit
436
// Copyright (c) 2015-2018 William W. Fisher (at gmail dot com) // This file is distributed under the MIT License. #include "ofp/tablestatus.h" #include "ofp/writable.h" using namespace ofp; bool TableStatus::validateInput(Validation *context) const { size_t length = context->length(); if (length < sizeof(TableStatus) + sizeof(TableDesc)) { log_debug("TableStatus too small", length); return false; } size_t remainingLength = length - sizeof(TableStatus); context->setLengthRemaining(remainingLength); // FIXME: make sure there is only one table? return table().validateInput(context); } UInt32 TableStatusBuilder::send(Writable *channel) { UInt8 version = channel->version(); UInt32 xid = channel->nextXid(); UInt16 msgLen = UInt16_narrow_cast(sizeof(msg_) + table_.writeSize(channel)); msg_.header_.setVersion(version); msg_.header_.setLength(msgLen); msg_.header_.setXid(xid); channel->write(&msg_, sizeof(msg_)); table_.write(channel); channel->flush(); return xid; }
byllyfish/oftr
src/ofp/tablestatus.cpp
C++
mit
1,028
@charset "UTF-8"; /* MFG Labs iconset 1.0 ------------------------------------------------------- License ------------------------------------------------------- • The MFG Labs iconset font is licensed under the SIL Open Font License - http://scripts.sil.org/OFL • MFG Labs inconset CSS files are licensed under the MIT License - http://opensource.org/licenses/mit-license.html • The MFG Labs iconset pictograms are licensed under the CC BY 3.0 License - http://creativecommons.org/licenses/by/3.0/ • Attribution is no longer required in Font Awesome 3.0, but much appreciated: MFG Labs inconset by MFG Labs Contact ------------------------------------------------------- Email: [email protected] Twitter: http://twitter.com/mfg_labs */ @font-face { font-family: 'mfg_labs_iconsetregular'; src: url("/fonts/mfglabs/mfglabsiconset-webfont.eot"); src: url("/fonts/mfglabs/mfglabsiconset-webfont.eot?#iefix") format("embedded-opentype"), url("/fonts/mfglabs/mfglabsiconset-webfont.woff") format("woff"), url("/fonts/mfglabs/mfglabsiconset-webfont.ttf") format("truetype"), url("/fonts/mfglabs/mfglabsiconset-webfont.svg#mfg_labs_iconsetregular") format("svg"); font-weight: normal; font-style: normal; } i, .icon { font-family: 'mfg_labs_iconsetregular'; font-style: normal; speak: none; font-weight: normal; font-size: 1em; -webkit-font-smoothing: antialiased; } .icon2x { font-size: 2em; } .icon3x { font-size: 3em; } /* style exemples */ .gradient { color: #999; text-shadow: 1px 1px 1px rgba(27, 27, 27, 0.19); background-image: -webkit-gradient(linear, left top, left bottom, from(#b6b6b6), to(#3c3c3c)); background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent; transition: all 0.1s ease-in-out; } .gradient:hover, .gradient .current { color: #eee; text-shadow: 0px 0px 3px rgba(255, 255, 255, 0.25); background-image: -webkit-gradient(linear, left top, left bottom, from(white), to(#bbbbbb)); } /* MFG Labs iconset uses the Unicode Private Use Area (PUA) to ensure screen readers do not read off random characters that represent icons. We also use semantic unicode when they are available for the icon we provide. */ .icon-cloud:before { content: "\2601"; } .icon-at:before { content: "\0040"; } .icon-plus:before { content: "\002B"; } .icon-minus:before { content: "\2212"; } .icon-arrow_up:before { content: "\2191"; } .icon-arrow_down:before { content: "\2193"; } .icon-arrow_right:before { content: "\2192"; } .icon-arrow_left:before { content: "\2190"; } .icon-chevron_down:before { content: "\f004"; } .icon-chevron_up:before { content: "\f005"; } .icon-chevron_right:before { content: "\f006"; } .icon-chevron_left:before { content: "\f007"; } .icon-reorder:before { content: "\f008"; } .icon-list:before { content: "\f009"; } .icon-reorder_square:before { content: "\f00a"; } .icon-reorder_square_line:before { content: "\f00b"; } .icon-coverflow:before { content: "\f00c"; } .icon-coverflow_line:before { content: "\f00d"; } .icon-pause:before { content: "\f00e"; } .icon-play:before { content: "\f00f"; } .icon-step_forward:before { content: "\f010"; } .icon-step_backward:before { content: "\f011"; } .icon-fast_forward:before { content: "\f012"; } .icon-fast_backward:before { content: "\f013"; } .icon-cloud_upload:before { content: "\f014"; } .icon-cloud_download:before { content: "\f015"; } .icon-data_science:before { content: "\f016"; } .icon-data_science_black:before { content: "\f017"; } .icon-globe:before { content: "\f018"; } .icon-globe_black:before { content: "\f019"; } .icon-math_ico:before { content: "\f01a"; } .icon-math:before { content: "\f01b"; } .icon-math_black:before { content: "\f01c"; } .icon-paperplane_ico:before { content: "\f01d"; } .icon-paperplane:before { content: "\f01e"; } .icon-paperplane_black:before { content: "\f01f"; } /* \f020 doesn't work in Safari. all shifted one down */ .icon-color_balance:before { content: "\f020"; } .icon-star:before { content: "\2605"; } .icon-star_half:before { content: "\f022"; } .icon-star_empty:before { content: "\2606"; } .icon-star_half_empty:before { content: "\f024"; } .icon-reload:before { content: "\f025"; } .icon-heart:before { content: "\2665"; } .icon-heart_broken:before { content: "\f028"; } .icon-hashtag:before { content: "\f029"; } .icon-reply:before { content: "\f02a"; } .icon-retweet:before { content: "\f02b"; } .icon-signin:before { content: "\f02c"; } .icon-signout:before { content: "\f02d"; } .icon-download:before { content: "\f02e"; } .icon-upload:before { content: "\f02f"; } .icon-placepin:before { content: "\f031"; } .icon-display_screen:before { content: "\f032"; } .icon-tablet:before { content: "\f033"; } .icon-smartphone:before { content: "\f034"; } .icon-connected_object:before { content: "\f035"; } .icon-lock:before { content: "\F512"; } .icon-unlock:before { content: "\F513"; } .icon-camera:before { content: "\F4F7"; } .icon-isight:before { content: "\f039"; } .icon-video_camera:before { content: "\f03a"; } .icon-random:before { content: "\f03b"; } .icon-message:before { content: "\F4AC"; } .icon-discussion:before { content: "\f03d"; } .icon-calendar:before { content: "\F4C5"; } .icon-ringbell:before { content: "\f03f"; } .icon-movie:before { content: "\f040"; } .icon-mail:before { content: "\2709"; } .icon-pen:before { content: "\270F"; } .icon-settings:before { content: "\9881"; } .icon-measure:before { content: "\f044"; } .icon-vector:before { content: "\f045"; } .icon-vector_pen:before { content: "\2712"; } .icon-mute_on:before { content: "\f047"; } .icon-mute_off:before { content: "\f048"; } .icon-home:before { content: "\2302"; } .icon-sheet:before { content: "\f04a"; } .icon-arrow_big_right:before { content: "\21C9"; } .icon-arrow_big_left:before { content: "\21C7"; } .icon-arrow_big_down:before { content: "\21CA"; } .icon-arrow_big_up:before { content: "\21C8"; } .icon-dribbble_circle:before { content: "\f04f"; } .icon-dribbble:before { content: "\f050"; } .icon-facebook_circle:before { content: "\f051"; } .icon-facebook:before { content: "\f052"; } .icon-git_circle_alt:before { content: "\f053"; } .icon-git_circle:before { content: "\f054"; } .icon-git:before { content: "\f055"; } .icon-octopus:before { content: "\f056"; } .icon-twitter_circle:before { content: "\f057"; } .icon-twitter:before { content: "\f058"; } .icon-google_plus_circle:before { content: "\f059"; } .icon-google_plus:before { content: "\f05a"; } .icon-linked_in_circle:before { content: "\f05b"; } .icon-linked_in:before { content: "\f05c"; } .icon-instagram:before { content: "\f05d"; } .icon-instagram_circle:before { content: "\f05e"; } .icon-mfg_icon:before { content: "\f05f"; } .icon-xing:before { content: "\F532"; } .icon-xing_circle:before { content: "\F533"; } .icon-mfg_icon_circle:before { content: "\f060"; } .icon-user:before { content: "\f061"; } .icon-user_male:before { content: "\f062"; } .icon-user_female:before { content: "\f063"; } .icon-users:before { content: "\f064"; } .icon-file_open:before { content: "\F4C2"; } .icon-file_close:before { content: "\f067"; } .icon-file_alt:before { content: "\f068"; } .icon-file_close_alt:before { content: "\f069"; } .icon-attachment:before { content: "\f06a"; } .icon-check:before { content: "\2713"; } .icon-cross_mark:before { content: "\274C"; } .icon-cancel_circle:before { content: "\F06E"; } .icon-check_circle:before { content: "\f06d"; } .icon-magnifying:before { content: "\F50D"; } .icon-inbox:before { content: "\f070"; } .icon-clock:before { content: "\23F2"; } .icon-stopwatch:before { content: "\23F1"; } .icon-hourglass:before { content: "\231B"; } .icon-trophy:before { content: "\f074"; } .icon-unlock_alt:before { content: "\F075"; } .icon-lock_alt:before { content: "\F510"; } .icon-arrow_doubled_right:before { content: "\21D2"; } .icon-arrow_doubled_left:before { content: "\21D0"; } .icon-arrow_doubled_down:before { content: "\21D3"; } .icon-arrow_doubled_up:before { content: "\21D1"; } .icon-link:before { content: "\f07B"; } .icon-warning:before { content: "\2757"; } .icon-warning_alt:before { content: "\2755"; } .icon-magnifying_plus:before { content: "\f07E"; } .icon-magnifying_minus:before { content: "\f07F"; } .icon-white_question:before { content: "\2754"; } .icon-black_question:before { content: "\2753"; } .icon-stop:before { content: "\f080"; } .icon-share:before { content: "\f081"; } .icon-eye:before { content: "\f082"; } .icon-trash_can:before { content: "\f083"; } .icon-hard_drive:before { content: "\f084"; } .icon-information_black:before { content: "\f085"; } .icon-information_white:before { content: "\f086"; } .icon-printer:before { content: "\f087"; } .icon-letter:before { content: "\f088"; } .icon-soundcloud:before { content: "\f089"; } .icon-soundcloud_circle:before { content: "\f08A"; } .icon-anchor:before { content: "\2693"; } .icon-female_sign:before { content: "\2640"; } .icon-male_sign:before { content: "\2642"; } .icon-joystick:before { content: "\F514"; } .icon-high_voltage:before { content: "\26A1"; } .icon-fire:before { content: "\F525"; } .icon-newspaper:before { content: "\F4F0"; } .icon-chart:before { content: "\F526"; } .icon-spread:before { content: "\F527"; } .icon-spinner_1:before { content: "\F528"; } .icon-spinner_2:before { content: "\F529"; } .icon-chart_alt:before { content: "\F530"; } .icon-label:before { content: "\F531"; } .icon-brush:before { content: "\E000"; } .icon-refresh:before { content: "\E001"; } .icon-node:before { content: "\E002"; } .icon-node_2:before { content: "\E003"; } .icon-node_3:before { content: "\E004"; } .icon-link_2_nodes:before { content: "\E005"; } .icon-link_3_nodes:before { content: "\E006"; } .icon-link_loop_nodes:before { content: "\E007"; } .icon-node_size:before { content: "\E008"; } .icon-node_color:before { content: "\E009"; } .icon-layout_directed:before { content: "\E010"; } .icon-layout_radial:before { content: "\E011"; } .icon-layout_hierarchical:before { content: "\E012"; } .icon-node_link_direction:before { content: "\E013"; } .icon-node_link_short_path:before { content: "\E014"; } .icon-node_cluster:before { content: "\E015"; } .icon-display_graph:before { content: "\E016"; } .icon-node_link_weight:before { content: "\E017"; } .icon-more_node_links:before { content: "\E018"; } .icon-node_shape:before { content: "\E00A"; } .icon-node_icon:before { content: "\E00B"; } .icon-node_text:before { content: "\E00C"; } .icon-node_link_text:before { content: "\E00D"; } .icon-node_link_color:before { content: "\E00E"; } .icon-node_link_shape:before { content: "\E00F"; } .icon-credit_card:before { content: "\F4B3"; } .icon-disconnect:before { content: "\F534"; } .icon-graph:before { content: "\F535"; } .icon-new_user:before { content: "\F536"; } html { font-size: 12pt; font-family: 'PT Sans', Helvetica, Arial, sans-serif; overflow-y: scroll; } body { padding: 0; margin: 0; } a { color: #006DCE; text-decoration: none; border-bottom: 1px solid #006DCE; } a.pseudo { border-bottom-style: dashed; } i.icon { color: #006DCE; cursor: pointer; } i.icon.warning { color: #C70000; } a.pseudo.warning { color: #C70000; border-bottom-color: #C70000; } button { border: 1px solid #E8E8E8; background: #FBFBFB; border-radius: 7px; padding: 10px 15px; margin: 5px; font-weight: bold; color: #5F5F5F; } button:disabled { color: #5F5F5F; } button.warning { border: 1px solid #8C0000; background: #CA0000; color: white; } input, textarea, .pseudo-input-text { border-radius: 5px; border: 1px solid #E8E8E8; padding: 0.3rem 0.5rem; font-size: 1rem; } .arrow-up, .arrow-down, .arrow-right, .arrow-left { width: 0; height: 0; border-width: 5px; border-style: solid; border-color: transparent; } .arrow-up { border-top: none; border-bottom-color: black; } .arrow-down { border-top-color: black; border-bottom: none; } .arrow-right { border-left-color: black; border-right: none; } .arrow-left { border-right-color: black; border-left: none; } /****************/ .logo { text-align: center; padding: 3rem 3rem 3rem 3rem; font-weight: bold; font-size: 1.5rem; } .logo__title__span { padding: 1rem; letter-spacing: 0.75rem; background: #EEEFAA; } .category-picker__category { cursor: pointer; padding: 0 5px; } .category-picker__category__title { display: inline; } .category-picker__category__empty { font-style: italic; } .category-picker__category--selected .category-picker__category__title { border-bottom: none; color: inherit; } .category-picker__category--selected .category-picker__category__empty { background: #EEEFAA; } .category-picker__category--selected { background: #EEEFAA; } .edit-expense { display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-flex-direction: column; -ms-flex-direction: column; flex-direction: column; } .edit-expense > table > tbody > tr > td { vertical-align: top; } .edit-expense__row { display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-flex-direction: row; -ms-flex-direction: row; flex-direction: row; } .edit-expense__row > table { margin: 0 1rem; } .edit-expense__field__label { font-weight: bold; } .edit-expense__field__input { padding-bottom: 1rem; } .edit-expense__category-picker-wrapper { border: 1px solid #E8E8E8; border-radius: 5px; padding: 0; } .edit-expense__category-picker-wrapper > .category-picker > .category-picker__category:first-child { border-radius: 5px 5px 0 0; } .edit-expense__category-picker-wrapper > .category-picker > .category-picker__category:last-child { border-radius: 0 0 5px 5px; } .edit-expense__controls { display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-justify-content: center; -ms-flex-pack: center; justify-content: center; } .edit-category-list__category__title { display: inline; font-weight: bold; } .edit-category-list__category--selected .edit-category-list__category__title { background: #EEEFAA; border-bottom: none; color: inherit; } .edit-category-list__category__controls { opacity: 0.075; display: inline; } .edit-category-list__category__content { display: inline-block; padding: 0.4rem 0.4rem; } .edit-category-list__category:hover .edit-category-list__category__content { background: #EEEFAA; } .edit-category-list .edit-category-list__category:hover .edit-category-list__category__controls { opacity: 1; } .edit-category-list__children { padding-left: 20px; } .edit-category-list__empty { font-style: italic; } .edit-category-list__new-root-category { margin: 1rem 0; } .edit-category-list__new-root-category .edit-category-list__new-root-category__link.pseudo { margin: 0; } .edit-category-list a.pseudo { font-size: 0.8rem; margin: 0 0.8rem; } .edit-category-list i.icon { font-size: 0.8rem; margin: 0 0.8rem; } .modal-container { position: fixed; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.72); display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-justify-content: center; -ms-flex-pack: center; justify-content: center; z-index: 9999; } .modal-container__column { display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-justify-content: center; -ms-flex-pack: center; justify-content: center; -webkit-flex-direction: column; -ms-flex-direction: column; flex-direction: column; } .modal-container__column__cell { background: white; border-radius: 4px; padding: 0.5rem; } .modal-container__msg { margin: 1rem; } .modal-container__msg.warning { color: #C70000; } .modal-container__controls { text-align: center; margin: 1rem 0 0; } .wait-indicator { position: fixed; top: 0; left: 0; background: orange; width: 100%; text-align: center; font-size: 0.70rem; color: white; font-weight: bold; opacity: 0.65; padding: 0.25rem 0; } .error-panel { position: fixed; top: 0; left: 0; background: #CE0000; width: 100%; text-align: center; font-size: 0.70rem; color: white; font-weight: bold; opacity: 0.75; padding: 0.25rem 0; z-index: 9999; } .user-panel { position: fixed; top: 0; right: 20px; background: #EEEFAA; text-align: center; font-size: 0.70rem; color: white; font-weight: bold; padding: 0.5rem 0.75rem; } .tabs-container__labels { display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-flex-direction: row; -ms-flex-direction: row; flex-direction: row; -webkit-justify-content: center; -ms-flex-pack: center; justify-content: center; } .tabs-container__labels__label { padding: 0.5rem 1rem; display: inline-block; border-radius: 5px; margin: 0 5px; } .tabs-container__labels__label--active { background: #EEEFAA; } .tabs-container__content { padding: 1rem; display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-justify-content: center; -ms-flex-pack: center; justify-content: center; } .history { display: -webkit-flex; display: -ms-flexbox; display: flex; /* Customize category picker for filters */ } .history__title { font-weight: bold; margin: 1rem 0; } .history__filters { width: 200px; padding: 0rem 0rem 0rem 1rem; } .history__results { width: 600px; } .history__year-month-filter__year { font-weight: bold; margin: 0.5rem 0 0 0; } .history__year-month-filter__month { margin: 0.25rem 1rem; } .history__year-month-filter__item--active span { background: #EEEFAA; } .history__current-filter { margin: 1rem 0; font-size: 0.75rem; color: #999; font-style: italic; } .history__filters .category-picker__category { margin: 0.1rem 0.3rem; padding: 0.2rem; cursor: pointer; } .history__filters .category-picker__category__title { display: inline; border-bottom: 1px dashed #006DCE; color: #006DCE; } .history__filters .category-picker__category__empty { font-style: italic; } .history__filters .category-picker__category--selected .category-picker__category__title { background: #EEEFAA; border-bottom: none; color: inherit; } .history__filters .category-picker__children { padding-left: 20px; } .empty-history-msg { margin: 1rem; font-style: italic; } .expense-list__group__title { font-weight: bold; margin: 1rem 0; } .expense-list .expense-list__expense { display: -webkit-flex; display: -ms-flexbox; display: flex; padding: 0 0 1rem 0; } .expense-list .expense-list__expense__time { margin: 0rem 1rem; color: #ABABAB; font-size: 0.5rem; font-style: italic; line-height: 1.5rem; } .expense-list .expense-list__expense__amount { font-style: italic; font-weight: bold; display: inline; } .expense-list .expense-list__expense__desc1 { font-size: 1rem; display: inline; } .expense-list .expense-list__expense__desc2 { color: #ABABAB; font-size: 0.75rem; font-style: italic; } .expense-list .expense-list__expense__controls { visibility: hidden; padding-left: 1rem; } .expense-list .expense-list__expense__controls a.pseudo { margin: 0 1rem; font-size: 0.8rem; } .expense-list .expense-list__expense:hover .expense-list__expense__controls { visibility: visible; } .confirm-dialog { padding: 1rem; } .confirm-dialog__msg { font-weight: bold; text-align: center; } .confirm-dialog__controls { text-align: center; padding: 1rem 0.5rem 0rem 0.5rem; } .confirm-dialog__controls > button { margin: 0 0.25rem; } .drop-down-container { position: relative; } .drop-down-container__bg { position: fixed; background: rgba(0, 0, 0, 0.25); width: 100%; height: 100%; top: 0; left: 0; } .drop-down-container__body { position: absolute; z-index: 99999; top: 0; left: 0; padding: 1rem; border-radius: 4px; background: white; box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); } .sum-table-statistics__year__month { font-weight: bold; padding: 0.8rem 0.8rem; text-align: right; } .sum-table-statistics__year__category { font-style: italic; padding: 0.25rem 0.8rem; } .sum-table-statistics__year__value { padding: 0.25rem 0.8rem; white-space: nowrap; text-align: right; } .sum-table-statistics__year__value__dif { font-size: 0.75rem; } .sum-table-statistics__year__value__dif--plus { color: red; } .sum-table-statistics__year__value__dif--minus { color: green; } .sum-table-statistics__year__value__dif--zero { color: #dedede; } .sum-table-statistics__year__total__title { font-style: italic; font-weight: bold; padding: 0.25rem 0.8rem 0.25rem 0; } .sum-table-statistics__year__total__value { padding: 0.25rem 0.8rem; white-space: nowrap; text-align: right; font-weight: bold; } .sum-table-statistics__year__total__dif { font-size: 0.75rem; } .sum-table-statistics__year__total__dif--plus { color: red; } .sum-table-statistics__year__total__dif--minus { color: green; } .sum-table-statistics__controls { margin: 1rem 0; } .unauthorized { margin: auto 0; } .unauthorized__caption { font-size: 1.5rem; text-align: center; padding: 1rem; } .unauthorized__button { text-align: center; } .unauthorized__button a { border: 0; } .date-time-picker .modal-container__column__cell { padding: 0; } .date-time-picker__modal-content { display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-flex-direction: column; -ms-flex-direction: column; flex-direction: column; -webkit-align-items: stretch; -ms-flex-align: stretch; align-items: stretch; } .date-time-picker__modal-content__section { border-bottom: 1px dashed #D6D6D6; padding: 1rem; display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-flex-direction: row; -ms-flex-direction: row; flex-direction: row; -webkit-justify-content: center; -ms-flex-pack: center; justify-content: center; } .date-time-picker__modal-content__section:last-child { border-bottom: none; } .date-time-picker__modal-content__controls { padding: 0.2rem; } .date-time-picker .pseudo-input-text { cursor: pointer; } .date-picker { display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-flex-direction: column; -ms-flex-direction: column; flex-direction: column; -webkit-align-items: center; -ms-flex-align: center; align-items: center; } .date-picker__months__title { font-weight: bold; padding: 0 1rem; } .date-picker__calendar { margin: 0.75rem 0; } .date-picker__calendar__header { font-weight: bold; } .date-picker__calendar__cell { text-align: center; padding: 0.2rem 0.3rem; cursor: default; } .date-picker__calendar__cell--active { background: #EEEFAA; } .date-picker__calendar__cell--another-month { color: black; opacity: 0.20; } .date-picker__calendar__cell--weekend { color: #DC0000; } .time-picker { display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-flex-direction: row; -ms-flex-direction: row; flex-direction: row; } .time-picker__input { font-size: 2rem; width: 40px; text-align: center; border: none; } .v-counter { display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-flex-direction: column; -ms-flex-direction: column; flex-direction: column; -webkit-align-items: stretch; -ms-flex-align: stretch; align-items: stretch; margin: 0.2rem; } .v-counter__middle { border-left: 1px solid #E8E8E8; border-right: 1px solid #E8E8E8; display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-justify-content: center; -ms-flex-pack: center; justify-content: center; -webkit-flex-direction: row; -ms-flex-direction: row; flex-direction: row; } .v-counter__button { display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-justify-content: center; -ms-flex-pack: center; justify-content: center; margin: 0; outline: none; } .v-counter__button--up { border-radius: 5px 5px 0 0; } .v-counter__button--down { border-radius: 0 0 5px 5px; } .h-counter { display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-flex-direction: row; -ms-flex-direction: row; flex-direction: row; -webkit-align-items: stretch; -ms-flex-align: stretch; align-items: stretch; margin: 0.2rem; } .h-counter__middle { border-bottom: 1px solid #E8E8E8; border-top: 1px solid #E8E8E8; display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-justify-content: center; -ms-flex-pack: center; justify-content: center; -webkit-flex-direction: column; -ms-flex-direction: column; flex-direction: column; } .h-counter__button { display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-justify-content: center; -ms-flex-pack: center; justify-content: center; margin: 0; outline: none; } .h-counter__button--up { border-radius: 0 5px 5px 0; } .h-counter__button--down { border-radius: 5px 0 0 5px; } .h-counter__button--up, .h-counter__button--down { padding: 6px 10px; }
moneytrack/moneytrack.github.io
styles/main.css
CSS
mit
26,617
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title>Post It App</title> <link rel="apple-touch-icon" sizes="57x57" href="/icon2015/apple-icon-57x57.png"> <link rel="apple-touch-icon" sizes="60x60" href="/icon2015/apple-icon-60x60.png"> <link rel="apple-touch-icon" sizes="72x72" href="/icon2015/apple-icon-72x72.png"> <link rel="apple-touch-icon" sizes="76x76" href="/icon2015/apple-icon-76x76.png"> <link rel="apple-touch-icon" sizes="114x114" href="/icon2015/apple-icon-114x114.png"> <link rel="apple-touch-icon" sizes="120x120" href="/icon2015/apple-icon-120x120.png"> <link rel="apple-touch-icon" sizes="144x144" href="/icon2015/apple-icon-144x144.png"> <link rel="apple-touch-icon" sizes="152x152" href="/icon2015/apple-icon-152x152.png"> <link rel="apple-touch-icon" sizes="180x180" href="/icon2015/apple-icon-180x180.png"> <link rel="icon" type="image/png" sizes="192x192" href="/icon2015/android-icon-192x192.png"> <link rel="icon" type="image/png" sizes="32x32" href="/icon2015/favicon-32x32.png"> <link rel="icon" type="image/png" sizes="96x96" href="/icon2015/favicon-96x96.png"> <link rel="icon" type="image/png" sizes="16x16" href="/icon2015/favicon-16x16.png"> <link rel="manifest" href="/manifest.json"> <meta name="msapplication-TileColor" content="#ffffff"> <meta name="msapplication-TileImage" content="/icon2015/ms-icon-144x144.png"> <meta name="theme-color" content="#ffffff"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css"> <link rel="stylesheet" type="text/css" href="css/main.css"/> <link rel="stylesheet" type="text/css" href="bower_components/font-awesome/css/font-awesome.css"/> </head> <body> <div class="fullpage title imgbackground"> <div class="title-text"> Post IT app <p> Partner offer </p> </div> <a href="#content" class="arrow-down arrow-animation"><i class="fa fa-arrow-down"></i></a> </div> <div id="content"> <div class="container"> <div class="row"> <div class="text-center" style="padding-bottom:5vh;"> <h1>Hi!</h1> </div> <div class="col-md-offset-2 col-md-8 text-center"> <p> <b>Post IT app</b> has for aim to get youth interested in IT and to empower them in providing the basic IT concepts, <i>all without programming</i>. </p> <p>For the last two years, we have conducted a workshop for high school students, in which we teach them how to create business models and paper prototypes of applications. </p> <p>One of our main objectives is to train tomorrow’s decision makers in the digital world. </p> <p> Our second main objective is to question the stereotypical image of IT: we want to show that IT is a fun, challenging and creative field which can be explored regardless of gender, background, personality traits of skills! </p> <p style="padding-top:1em; padding-bottom:0.5em;"> A part of: </p> <a href="http://gbgtechweek.com" style="margin-left:3em"><img src="img/Gbgtechweek_solid.png"></a> </div> </div> </div> </div> <div class="onepage walker imgbackground" id="frågor"> <div class="container"> <div class="row"> <div class="col-md-offset-1 col-md-11" style="padding-bottom:4vh"> <h1 style="padding-bottom:3vh"> Packages </h1> </div> <div class="col-md-offset-1 col-md-5" style="padding-bottom:4vh"> <h4 class="gloria">Bronze Partnership <br> 1000kr</h4> <p>Small Logo in our video *</p> <p>Small Logo and explanatory text as a sponsor on social media</p> <p>Small Logo and name on our website *</p> <p>Small Logo in presentation</p> </div> <div class="col-md-5" style="padding-bottom:4vh"> <h4 class="gloria">Silver Partnership <br> 3000kr</h4> <p> <small>Everything in partnership bronze +</small> </p> <p>Silver sponsor on our website</p> <p>Logo and explanatory text as a sponsor on social media</p> <p>Logo in our presentation and an expressed thanks</p> </div> </div> <div class="row"> <div class="col-md-offset-1 col-md-5" style="padding-bottom:4vh"> <h4 class="gloria">Gold Partnership <br> 6000kr</h4> <p> <small>Everything in silver Partnership +</small> </p> <p>Big and clear thank you in the presentation</p> <p>2 seconds video time with a large logo *</p> <p>Slogans and medium sized logo on T-Shirts! *</p> </div> <div class="col-md-5" style="padding-bottom:4vh"> <h4 class="gloria">Platinum Partnership <br> 10000kr</h4> <p> <small>Everything in gold Partnership +</small> </p> <p> 4 second special video time with a large logo *</p> <p>Very clear communication that you are a co-organizer who made all that extra cool possible!</p> <p> The opportunity to pitch a whole minute!</p> </div> </div> <div class="row"> <div class=" col-md-10" style="padding-bottom:4vh"> <p>* Video and Tshirt requires that we reach our financial target of 20 000 SEK.</p> <p>PS: in the Silver, Gold and Platinum packages, we provide you with the possibility to distribute advertising goodies to our students.</p> </div> </div> </div> </div> </div> </div> </div> <script src="bower_components/jquery/dist/jquery.min.js"></script> <script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script> <script src="js/main.js"></script> <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-61692156-1', 'auto'); ga('send', 'pageview'); </script> </body> </html>
AleksandarFaraj/postitapp
index.html
HTML
mit
7,026
#!/bin/sh # CYBERWATCH SAS - 2017 # # Security fix for USN-2950-5 # # Security announcement date: 2016-05-25 00:00:00 UTC # Script generation date: 2017-01-01 21:05:27 UTC # # Operating System: Ubuntu 14.04 LTS # Architecture: x86_64 # # Vulnerable packages fix on version: # - samba:2:4.3.9+dfsg-0ubuntu0.14.04.3 # # Last versions recommanded by security team: # - samba:2:4.3.11+dfsg-0ubuntu0.14.04.4 # # CVE List: # - CVE-2015-5370 # - CVE-2016-2110 # - CVE-2016-2111 # - CVE-2016-2112 # - CVE-2016-2113 # - CVE-2016-2114 # - CVE-2016-2115 # - CVE-2016-2118 # # More details: # - https://www.cyberwatch.fr/vulnerabilites # # Licence: Released under The MIT License (MIT), See LICENSE FILE sudo apt-get install --only-upgrade samba=2:4.3.11+dfsg-0ubuntu0.14.04.4 -y
Cyberwatch/cbw-security-fixes
Ubuntu_14.04_LTS/x86_64/2016/USN-2950-5.sh
Shell
mit
794
require 'delegate' module Bizflow module BusinessModel class SimpleWrapper < SimpleDelegator def self.wrap(item) new item end def self.wraps(items) res = items.map do |item| new item end res end end end end
sljuka/bizflow
lib/bizflow/business_model/simple_wrapper.rb
Ruby
mit
294
class Solution { public int solution(int[] A) { int[] temArray = new int[A.length + 2]; for (int i = 0; i < A.length; i++) { temArray[A[i]] = 1; } for (int i = 1; i < temArray.length + 1; i++) { if(temArray[i] == 0){ return i; } } return A[A.length - 1] + 1; } }
majusko/codility
PermMissingElem.java
Java
mit
392
function EditMovieCtrl(MovieService,$stateParams) { // ViewModel const edit = this; edit.title = 'Edit Movies' + $stateParams.id; edit.back = function(){ window.history.back() } edit.checker = function(bool){ if(bool=='true') return true; if(bool=='false') return false; } edit.click = function(bool,key){ edit.data[key] = !bool } MovieService.getID($stateParams.id).then(function(results){ if(results.status===404) edit.data.movies='not found' edit.data = results }) // MovieService.get().then(function(results){ // edit.movies = results // }) edit.processForm = function(){ MovieService.put(edit.data).then(function(res){ console.log(res) }) } } EditMovieCtrl.$inject=['MovieService','$stateParams'] export default { name: 'EditMovieCtrl', fn: EditMovieCtrl };
johndoechang888/popcorn
fe/app/js/controllers/EditMovieCtrl.js
JavaScript
mit
882
# CGGameCircle Marmalade Lua Binding for Game Circle
agramonte/CGGameCircle
README.md
Markdown
mit
53
/** * @fileoverview Rule to require or disallow line breaks inside braces. * @author Toru Nagashima */ "use strict"; //------------------------------------------------------------------------------ // Requirements //------------------------------------------------------------------------------ let astUtils = require("../ast-utils"); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ // Schema objects. let OPTION_VALUE = { oneOf: [ { enum: ["always", "never"] }, { type: "object", properties: { multiline: { type: "boolean" }, minProperties: { type: "integer", minimum: 0 } }, additionalProperties: false, minProperties: 1 } ] }; /** * Normalizes a given option value. * * @param {string|Object|undefined} value - An option value to parse. * @returns {{multiline: boolean, minProperties: number}} Normalized option object. */ function normalizeOptionValue(value) { let multiline = false; let minProperties = Number.POSITIVE_INFINITY; if (value) { if (value === "always") { minProperties = 0; } else if (value === "never") { minProperties = Number.POSITIVE_INFINITY; } else { multiline = Boolean(value.multiline); minProperties = value.minProperties || Number.POSITIVE_INFINITY; } } else { multiline = true; } return {multiline: multiline, minProperties: minProperties}; } /** * Normalizes a given option value. * * @param {string|Object|undefined} options - An option value to parse. * @returns {{ObjectExpression: {multiline: boolean, minProperties: number}, ObjectPattern: {multiline: boolean, minProperties: number}}} Normalized option object. */ function normalizeOptions(options) { if (options && (options.ObjectExpression || options.ObjectPattern)) { return { ObjectExpression: normalizeOptionValue(options.ObjectExpression), ObjectPattern: normalizeOptionValue(options.ObjectPattern) }; } let value = normalizeOptionValue(options); return {ObjectExpression: value, ObjectPattern: value}; } //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ module.exports = { meta: { docs: { description: "enforce consistent line breaks inside braces", category: "Stylistic Issues", recommended: false }, fixable: "whitespace", schema: [ { oneOf: [ OPTION_VALUE, { type: "object", properties: { ObjectExpression: OPTION_VALUE, ObjectPattern: OPTION_VALUE }, additionalProperties: false, minProperties: 1 } ] } ] }, create: function(context) { let sourceCode = context.getSourceCode(); let normalizedOptions = normalizeOptions(context.options[0]); /** * Reports a given node if it violated this rule. * * @param {ASTNode} node - A node to check. This is an ObjectExpression node or an ObjectPattern node. * @param {{multiline: boolean, minProperties: number}} options - An option object. * @returns {void} */ function check(node) { let options = normalizedOptions[node.type]; let openBrace = sourceCode.getFirstToken(node); let closeBrace = sourceCode.getLastToken(node); let first = sourceCode.getTokenOrCommentAfter(openBrace); let last = sourceCode.getTokenOrCommentBefore(closeBrace); let needsLinebreaks = ( node.properties.length >= options.minProperties || ( options.multiline && node.properties.length > 0 && first.loc.start.line !== last.loc.end.line ) ); /* * Use tokens or comments to check multiline or not. * But use only tokens to check whether line breaks are needed. * This allows: * var obj = { // eslint-disable-line foo * a: 1 * } */ first = sourceCode.getTokenAfter(openBrace); last = sourceCode.getTokenBefore(closeBrace); if (needsLinebreaks) { if (astUtils.isTokenOnSameLine(openBrace, first)) { context.report({ message: "Expected a line break after this opening brace.", node: node, loc: openBrace.loc.start, fix: function(fixer) { return fixer.insertTextAfter(openBrace, "\n"); } }); } if (astUtils.isTokenOnSameLine(last, closeBrace)) { context.report({ message: "Expected a line break before this closing brace.", node: node, loc: closeBrace.loc.start, fix: function(fixer) { return fixer.insertTextBefore(closeBrace, "\n"); } }); } } else { if (!astUtils.isTokenOnSameLine(openBrace, first)) { context.report({ message: "Unexpected line break after this opening brace.", node: node, loc: openBrace.loc.start, fix: function(fixer) { return fixer.removeRange([ openBrace.range[1], first.range[0] ]); } }); } if (!astUtils.isTokenOnSameLine(last, closeBrace)) { context.report({ message: "Unexpected line break before this closing brace.", node: node, loc: closeBrace.loc.start, fix: function(fixer) { return fixer.removeRange([ last.range[1], closeBrace.range[0] ]); } }); } } } return { ObjectExpression: check, ObjectPattern: check }; } };
lauracurley/2016-08-ps-react
node_modules/eslint/lib/rules/object-curly-newline.js
JavaScript
mit
7,202
import random, math import gimp_be #from gimp_be.utils.quick import qL from gimp_be.image.layer import editLayerMask from effects import mirror import numpy as np import UndrawnTurtle as turtle def brushSize(size=-1): """" Set brush size """ image = gimp_be.gimp.image_list()[0] drawable = gimp_be.pdb.gimp_image_active_drawable(image) if size < 1: size = random.randrange(2, ((image.height + image.width) / 8)) gimp_be.pdb.gimp_context_set_brush_size(size) # Set brush opacity def brushOpacity(op=-1): if op == -1: op = random.randrange(15, 100) gimp_be.pdb.gimp_brushes_set_opacity(op) return op # Set random brush color no parameters set random def brushColor(r1=-1, g1=-1, b1=-1, r2=-1, g2=-1, b2=-1): if not r1 == -1: gimp_be.pdb.gimp_context_set_foreground((r1, g1, b1)) if not r2 == -1: gimp_be.pdb.gimp_context_set_background((r2, g2, b2)) elif r1 == -1: r1 = random.randrange(0, 255) g1 = random.randrange(0, 255) b1 = random.randrange(0, 255) r2 = random.randrange(0, 255) g2 = random.randrange(0, 255) b2 = random.randrange(0, 255) gimp_be.pdb.gimp_context_set_foreground((r1, g1, b1)) gimp_be.pdb.gimp_context_set_background((r2, g2, b2)) return (r1, g1, b1, r2, g2, b2) #set gray scale color def grayColor(gray_color): gimp_be.pdb.gimp_context_set_foreground((gray_color, gray_color, gray_color)) # Set random brush def randomBrush(): num_brushes, brush_list = gimp_be.pdb.gimp_brushes_get_list('') brush_pick = brush_list[random.randrange(0, len(brush_list))] gimp_be.pdb.gimp_brushes_set_brush(brush_pick) return brush_pick # Set random brush dynamics def randomDynamics(): dynamics_pick = random.choice(gimp_be.pdb.gimp_dynamics_get_list('')[1]) gimp_be.pdb.gimp_context_set_dynamics(dynamics_pick) return dynamics_pick def qL(): # quick new layer gimp_be.addNewLayer() image = gimp_be.gimp.image_list()[0] drawable = gimp_be.pdb.gimp_image_active_drawable(image) gimp_be.pdb.gimp_edit_fill(drawable, 1) def drawLine(points): image = gimp_be.gimp.image_list()[0] drawable = gimp_be.pdb.gimp_image_active_drawable(image) gimp_be.pdb.gimp_paintbrush_default(drawable, len(points), points) def drawSpiral(n=140, angle=61, step=10, center=[]): coord=[] nt=turtle.Turtle() if center == []: image = gimp_be.gimp.image_list()[0] center=[image.width/2,image.height/2] for step in range(n): coord.append(int(nt.position()[0]*10)+center[0]) coord.append(int(nt.position()[1]*10)+center[1]) nt.forward(step) nt.left(angle) coord.append(int(nt.position()[0]*10)+center[0]) coord.append(int(nt.position()[1]*10)+center[1]) drawLine(coord) def drawRays(rays=32, rayLength=100, centerX=0, centerY=0): """" draw N rays from center in active drawable with current brush """ image = gimp_be.gimp.image_list()[0] drawable = gimp_be.pdb.gimp_image_active_drawable(image) if centerX == 0: centerX = image.width/2 if centerY == 0: centerY = image.height/2 ray_gap = int(360.0/rays) for ray in range(0,rays): ctrlPoints = centerX, centerY, centerX + rayLength * math.sin(math.radians(ray*ray_gap)), centerY + rayLength * math.cos(math.radians(ray*ray_gap)) drawLine(ctrlPoints) def drawRandomRays(rays=32, length=100, centerX=0, centerY=0,noise=0.3): image = gimp_be.gimp.image_list()[0] drawable = gimp_be.pdb.gimp_image_active_drawable(image) if centerX == 0: centerX = image.width/2 if centerY == 0: centerY = image.height/2 ray_gap = 360.0/rays for ray in range(0,rays): rayLength=random.choice(range(int(length-length*noise),int(length+length*noise))) random_angle=random.choice(np.arange(0.0,360.0,0.01)) ctrlPoints = [ centerX, centerY, centerX + int(rayLength * math.sin(math.radians(random_angle))), int(centerY + rayLength * math.cos(math.radians(random_angle)))] drawLine(ctrlPoints) def spikeBallStack(depth=20, layer_mode=6, flatten=0): for x in range(1,depth): image = gimp_be.gimp.image_list()[0] drawable = gimp_be.pdb.gimp_image_active_drawable(image) qL() gimp_be.pdb.gimp_layer_set_mode(gimp_be.pdb.gimp_image_get_active_layer(image), layer_mode) drawRandomRays(rays=random.choice([32,64,128,4]), length=(image.height/2-image.height/12), centerX=image.width/2, centerY=image.height/2,noise=random.choice([0.3,0.1,0.8])) if flatten: if not x%flatten: gimp_be.pdb.gimp_image_flatten(image) def randomStrokes(num = 4, opt = 1): """ Draw random strokes of random size and random position """ image = gimp_be.gimp.image_list()[0] drawable = gimp_be.pdb.gimp_image_active_drawable(image) r = random.randrange for loopNum in range(0, num): if opt == 1: brushSize(35) drawLine(ctrlPoints) # draw random color bars, opt 3 uses random blend def drawBars(barNum=10, opt=3): image = gimp_be.gimp.image_list()[0] drawable = gimp_be.pdb.gimp_image_active_drawable(image) barWidth =image.width/ barNum barLeft = 0 color = -1 for loopNum in range(0, barNum): gimp_be.pdb.gimp_image_select_rectangle(image, 2, barLeft, 0, barWidth, image.height) barLeft = barLeft + barWidth if opt == 3: randomBlend() elif opt == 2: color = brushColor() gimp_be.pdb.gimp_edit_bucket_fill_full(drawable, 0, 0, 100, 0, 1, 0, gimp_be.SELECT_CRITERION_COMPOSITE, 0, 0) else: gimp_be.pdb.gimp_edit_bucket_fill_full(drawable, 0, 0, 100, 0, 1, 0, gimp_be.SELECT_CRITERION_COMPOSITE, 0, 0) gimp_be.pdb.gimp_selection_none(image) return (barNum, opt, color) # draw carbon nano tube def drawCNT(): image = gimp_be.gimp.image_list()[0] drawable = gimp_be.pdb.gimp_image_active_drawable(image) drawSinWave(1, 4, image.height * .42, 0, image.height / 2) gimp_be.pdb.gimp_paintbrush(drawable, 0, 4, (0, (image.height - 80),image.width, (image.height - 80)), 0, 0) gimp_be.pdb.gimp_paintbrush(drawable, 0, 4, (0, 80,image.width, 80), 0, 0) # draw sine wave def drawSinWave(bar_space=32, bar_length=-1, mag=70, x_offset=-1, y_offset=-1): image = gimp_be.gimp.image_list()[0] if y_offset == -1: y_offset = image.height/2 if x_offset == -1: x_offset = 0 if bar_length == -1: bar_length = image.height/6 steps = image.width / bar_space x = 0 for cStep in range(0, steps): x = cStep * bar_space + x_offset y = int(round(math.sin(x) * mag) + y_offset) ctrlPoints = x, int(y - round(bar_length / 2)), x, int(y + round(bar_length / 2)) drawLine(ctrlPoints) # draw sine wave def drawSinWaveDouble(barSpace, barLen, mag): image = gimp_be.gimp.image_list()[0] steps =image.width/ barSpace x = 0 for cStep in range(1, steps): x = cStep * barSpace y = int(abs(round(math.sin(x) * mag + image.height / 2))) ctrlPoints = x, int(y - round(barLen / 2)), x, int(y + round(barLen / 2)) drawLine(ctrlPoints) # draw a single brush point def drawBrush(x1, y1): image = gimp_be.gimp.image_list()[0] drawable = gimp_be.pdb.gimp_image_active_drawable(image) ctrlPoints = (x1, y1, x1, y1) drawLine(ctrlPoints) # draw multiple brush points def drawMultiBrush(brush_strokes=24): image = gimp_be.gimp.image_list()[0] grid_width=image.width/int(math.sqrt(brush_strokes)) grid_height=image.height/int(math.sqrt(brush_strokes)) coord_x=0 coord_y = 0 for i in range(0, int(math.sqrt(brush_strokes))): coord_x = coord_x + grid_width for x in range(0, int(math.sqrt(brush_strokes))): coord_y = coord_y + grid_height drawBrush(coord_x, coord_y) coord_y = 0 #draw grid of dots, this is for remainder mapping, this incomplete and temp. ####====DONT FORGET def dotGrid(): image = gimp_be.gimp.image_list()[0] drawable = gimp_be.pdb.gimp_image_active_drawable(image) for i in range(10,image.width-10,20): for x in range(10, image.height-10,20): grayColor(abs(i^3-x^3)%256) drawBrush(i+10,x+10) # draws random dots, opt does random color def randomCircleFill(num=20, size=100, opt=3, sq=1): image = gimp_be.gimp.image_list()[0] drawable = gimp_be.pdb.gimp_image_active_drawable(image) for loopNum in range(0, num): cirPar = [random.randrange(0,image.width), random.randrange(0, image.height), random.randrange(10, size), random.randrange(10, size)] if opt % 2 == 0: brushColor() if sq: gimp_be.pdb.gimp_ellipse_select(image, cirPar[0], cirPar[1], cirPar[2], cirPar[2], 2, 1, 0, 0) else: gimp_be.pdb.gimp_ellipse_select(image, cirPar[0], cirPar[1], cirPar[2], cirPar[3], 2, 1, 0, 0) if opt % 3 == 3: randomBlend() else: gimp_be.pdb.gimp_edit_bucket_fill_full(drawable, 0, 0, 100, 0, 1, 0, gimp_be.SELECT_CRITERION_COMPOSITE, 0, 0) gimp_be.pdb.gimp_selection_none(image) def randomRectFill(num=20, size=100, opt=3, sq=0): # draws square, opt does random color image = gimp_be.gimp.image_list()[0] drawable = gimp_be.pdb.gimp_image_active_drawable(image) selectMode = 2 if opt % 5 == 0: selectMode = 0 for loopNum in range(0, num): if opt % 2 == 0: brushColor() rectPar = [random.randrange(0,image.width), random.randrange(0, image.height), random.randrange(10, size), random.randrange(10, size)] if sq: gimp_be.pdb.gimp_image_select_rectangle(image, 2, rectPar[0], rectPar[1], rectPar[2], rectPar[2]) else: gimp_be.pdb.gimp_image_select_rectangle(image, 2, rectPar[0], rectPar[1], rectPar[2], rectPar[3]) if opt % 3 == 0: randomBlend() else: gimp_be.pdb.gimp_edit_bucket_fill_full(drawable, 0, 0, 100, 0, 1, 0, gimp_be.SELECT_CRITERION_COMPOSITE, 0, 0) gimp_be.pdb.gimp_selection_none(image) def randomBlend(): # Random Blend tool test blend_mode = 0 paint_mode = 0 gradient_type = random.randrange(0, 10) opacity = random.randrange(20, 100) offset = 0 repeat = random.randrange(0, 2) reverse = 0 supersample = 0 max_depth = random.randrange(1, 9) threshold = 0 threshold = random.randrange(0, 1) dither = 0 image = gimp_be.gimp.image_list()[0] drawable = gimp_be.pdb.gimp_image_active_drawable(image) brushColor() x1 = random.randrange(0,image.width) y1 = random.randrange(0, image.height) x2 = random.randrange(0,image.width) y2 = random.randrange(0, image.height) gimp_be.pdb.gimp_blend(drawable, blend_mode, paint_mode, gradient_type, opacity, offset, repeat, reverse, supersample, max_depth, threshold, dither, x1, y1, x2, y2) def randomPoints(num=12): d = [] for x in range(num): d.append(choice(range(boarder,image.width-boarder))) d.append(choice(range(boarder,image.height-boarder))) return d def drawInkBlot(option=''): image=gimp_be.gimp.image_list()[0] layer=gimp_be.pdb.gimp_image_get_active_layer(image) if 'trippy' in option: layer_copy = gimp_be.pdb.gimp_layer_copy(layer, 0) gimp_be.pdb.gimp_image_add_layer(image, layer_copy,1) randomBlend() mask = gimp_be.pdb.gimp_layer_create_mask(layer,5) gimp_be.pdb.gimp_image_add_layer_mask(image, layer,mask) editLayerMask(1) randomCircleFill(num=15,size=800) brushColor(255,255,255) randomCircleFill(num=50,size=100) randomCircleFill(num=5,size=300) brushColor(0) randomCircleFill(num=20,size=600) randomCircleFill(num=50,size=400) randomCircleFill(num=100,size=100) brushColor(255,255,255) randomCircleFill(num=50,size=100) brushColor(0) drawable = gimp_be.pdb.gimp_image_active_drawable(image) brushSize() strokes=[random.randrange(0,image.width/2),random.randrange(0,image.height),random.randrange(0,image.width/2),random.randrange(0,image.height)] gimp_be.pdb.gimp_smudge(drawable, random.choice([1,5,10,50,100]), len(strokes), strokes) brushSize() strokes=[random.randrange(0,image.width/2),random.randrange(0,image.height),random.randrange(0,image.width/2),random.randrange(0,image.height)] gimp_be.pdb.gimp_smudge(drawable, random.choice([1,5,10,50,100]), len(strokes), strokes) mirror('h') if 'trippy' in option and random.choice([0,1]): drawable = gimp_be.pdb.gimp_image_active_drawable(image) gimp_be.pdb.gimp_invert(drawable) editLayerMask(0) def inkBlotStack(depth=16,layer_mode=6, flatten=0): for x in range(1,depth): image = gimp_be.gimp.image_list()[0] drawable = gimp_be.pdb.gimp_image_active_drawable(image) qL() gimp_be.pdb.gimp_layer_set_mode(gimp_be.pdb.gimp_image_get_active_layer(image), layer_mode) drawInkBlot() if flatten: if not x%flatten: flatten() def gridCenters(grid=[]): if grid==[]: grid=[4,3] image = gimp_be.gimp.image_list()[0] row_width = image.width/(grid[0]) columb_height = image.height/(grid[1]) tile_centers = [] for row in range(0,grid[0]): for columb in range(0,grid[1]): tile_centers.append([row_width*row+row_width/2,columb_height*columb+columb_height/2]) return tile_centers def tile(grid=[],option="mibd",irregularity=0.3): image=gimp_be.gimp.image_list()[0] layer=gimp_be.pdb.gimp_image_get_active_layer(image) if grid==[]: if image.height == image.width: grid=[4,4] elif image.height < image.width: grid=[3,4] else: grid=[4,3] if "m" in option: mask = gimp_be.pdb.gimp_layer_create_mask(layer,0) gimp_be.pdb.gimp_image_add_layer_mask(image, layer,mask) editLayerMask(1) drawable = gimp_be.pdb.gimp_image_active_drawable(image) grid_spacing = image.width/grid[0] tile_centers=gridCenters(grid) if irregularity > 0.0: i_tiles=[] for tile in tile_centers: tile[0]=tile[0]+random.randrange((-1*int(grid_spacing*irregularity)),int(grid_spacing*irregularity)) tile[1]=tile[1]+random.randrange((-1*int(grid_spacing*irregularity)),int(grid_spacing*irregularity)) i_tiles.append(tile) tile_centers=i_tiles if "b" in option: randomBrush() if "d" in option: randomDynamics() brushSize(grid_spacing) brushColor(0,0,0) for tile in tile_centers: if "m" in option: editLayerMask(1) if irregularity == 0: gimp_be.pdb.gimp_paintbrush_default(drawable, len(tile), tile) elif random.randrange(50.0*irregularity)+random.randrange(50.0*irregularity)>50.0: randomDynamics() else: gimp_be.pdb.gimp_paintbrush_default(drawable, len(tile), tile) if "g" in option: gimp_be.pdb.plug_in_gauss(image, drawable, 20.0, 20.0, 0) if "w" in option: gimp_be.pdb.plug_in_whirl_pinch(image, drawable, 90, 0.0, 1.0) if "i" in option: gimp_be.pdb.gimp_invert(drawable) if "m" in option: editLayerMask(0) def drawAkuTree(branches=6,tree_height=0, position=0): image = gimp_be.gimp.image_list()[0] drawable = gimp_be.pdb.gimp_image_active_drawable(image) if position==0: position=[] position.append(random.randrange(image.width)) position.append(random.randrange(4*tree_height/3, 3*image.height/4)) if tree_height == 0: tree_height=random.randrange(position[1]/3, position[1]-position[1]/25) print 'position:' + str(position) #draw trunk trunk=[position[0],position[1],position[0],position[1]-tree_height] trunk_size=tree_height/40+3 print str(trunk) print 'tree_height: ' + str(tree_height) print 'trunk size: ' + str(trunk_size) brushSize(trunk_size) drawLine(trunk) for node in range(branches): node_base=[position[0],position[1]-((node*tree_height+1)/branches+tree_height/25+random.randrange(-1*tree_height/12,tree_height/12))] base_length=tree_height/25 node_end=[] if node%2==0: node_end=[node_base[0]+base_length/2,node_base[1]-base_length/2] brushSize(2*trunk_size/3) drawLine([node_base[0],node_base[1],node_end[0],node_end[1]]) brushSize(trunk_size/3) drawLine([node_end[0],node_end[1],node_end[0],node_end[1]-tree_height/12-(tree_height/48)]) else: node_end=[node_base[0]-base_length/2,node_base[1]-base_length/2] brushSize(2*trunk_size/3) drawLine([node_base[0],node_base[1],node_end[0],node_end[1]]) brushSize(trunk_size/3) drawLine([node_end[0],node_end[1],node_end[0],node_end[1]-(tree_height/12)]) def drawAkuForest(num=25): for x in range(num): drawAkuTree() # draw a tree def drawTree(x1=-1, y1=-1, angle=270, depth=9, recursiondepth=0): image = gimp_be.gimp.image_list()[0] drawable = gimp_be.pdb.gimp_image_active_drawable(image) if x1 == -1: x1 = image.width/2 if y1 == -1: y1 = image.height/2 x2 = x1 + int(math.cos(math.radians(angle)) * depth * 10.0) y2 = y1 + int(math.sin(math.radians(angle)) * depth * 10.0) ctrlPoints = (x1, y1, x2, y2) if recursiondepth <= 2: brushColor(87, 53, 12) elif depth == 1: brushColor(152, 90, 17) elif depth <= 3: brushColor(7, 145, 2) brushSize(depth * 4 + 5) gimp_be.pdb.gimp_paintbrush_default(drawable, len(ctrlPoints), ctrlPoints) if depth > 0: drawTree(x2, y2, angle - 20, depth - 1, recursiondepth + 1) drawTree(x2, y2, angle + 20, depth - 1, recursiondepth + 1) # draw a tree with 3 branches per node def drawTriTree(x1=-1, y1=-1, angle=270, depth=6, recursiondepth=0, size=10): image = gimp_be.gimp.image_list()[0] drawable = gimp_be.pdb.gimp_image_active_drawable(image) if x1 == -1: x1 = image.width/2 if y1 == -1: y1 = image.height/2 if depth: x2 = x1 + int(math.cos(math.radians(angle)) * depth * size) + random.randrange(-12, 12) y2 = y1 + int(math.sin(math.radians(angle)) * depth * size) + random.randrange(-12, 12) ctrlPoints = (x1, y1, x2, y2) brushSize(depth + int(size/10)) brushColor() gimp_be.pdb.gimp_paintbrush_default(drawable, len(ctrlPoints), ctrlPoints) drawTriTree(x2, y2, angle - 30, depth - 1, recursiondepth + 1,size) drawTriTree(x2, y2, angle, depth - 1, recursiondepth + 1,size) drawTriTree(x2, y2, angle + 30, depth - 1, recursiondepth + 1,size) # draw random color tri-tree def drawColorTriTree(x1=-1, y1=-1, angle=270, depth=9, recursiondepth=0): image = gimp_be.gimp.image_list()[0] drawable = gimp_be.pdb.gimp_image_active_drawable(image) if x1 == -1: x1 = image.width/2 if y1 == -1: y1 = image.height/2 brushSize(depth + 1) if depth: x2 = x1 + int(math.cos(math.radians(angle)) * depth * 10.0) + random.randrange(-12, 12) y2 = y1 + int(math.sin(math.radians(angle)) * depth * 10.0) + random.randrange(-12, 12) ctrlPoints = (x1, y1, x2, y2) gimp_be.pdb.gimp_paintbrush_default(drawable, len(ctrlPoints), ctrlPoints) drawColorTriTree(x2, y2, angle - 20 + random.choice(-10, -5, 0, 5, 10), depth - 1, recursiondepth + 1) drawColorTriTree(x2, y2, angle + random.choice(-10, -5, 0, 5, 10), depth - 1, recursiondepth + 1) drawColorTriTree(x2, y2, angle + 20 + random.choice(-10, -5, 0, 5, 10), depth - 1, recursiondepth + 1) # draw a tree def drawOddTree(x1=-1, y1=-1, angle=270, depth=9, recursiondepth=0): image = gimp_be.gimp.image_list()[0] drawable = gimp_be.pdb.gimp_image_active_drawable(image) if x1 == -1: x1 = image.width/2 if y1 == -1: y1 = image.height/2 brushSize((depth * 8 + 30)) if depth: x2 = x1 + int(math.cos(math.radians(angle)) * depth * 10.0) y2 = y1 + int(math.sin(math.radians(angle)) * depth * 10.0) ctrlPoints = (x1, y1, x2, y2) gimp_be.pdb.gimp_paintbrush_default(drawable, len(ctrlPoints), ctrlPoints) if not random.randrange(0, 23) == 23: drawTree(x2, y2, angle - 20, depth - 1, recursiondepth + 1) if depth % 2 == 0: drawTree(x2, y2, angle + 20, depth - 1, recursiondepth + 1) if (depth + 1) % 4 == 0: drawTree(x2, y2, angle + 20, depth - 1, recursiondepth + 1) if depth == 5: drawTree(x2, y2, angle - 45, depth - 1, recursiondepth + 1) drawTree(x2, y2, angle + 45, depth - 1, recursiondepth + 1) # draw a tree def drawForestTree(x1=-1, y1=-1, angle=270, depth=7, size=10, recursiondepth=0): image = gimp_be.gimp.image_list()[0] drawable = gimp_be.pdb.gimp_image_active_drawable(image) if x1 == -1: x1 = image.width/2 if y1 == -1: y1 = image.height/2 if depth: x2 = x1 + int(math.cos(math.radians(angle)) * depth * 10.0) y2 = y1 + int(math.sin(math.radians(angle)) * depth * 10.0) ctrlPoints = (x1, y1, x2, y2) brushSize(depth * depth * (int(size / ((image.height - y1)) / image.height)) + 4) gimp_be.pdb.gimp_paintbrush_default(drawable, len(ctrlPoints), ctrlPoints) if not random.randrange(0, 23) == 23: drawForestTree(x2, y2, angle - 20, depth - 1, size, recursiondepth + 1) if random.randrange(0, 23) == 23: drawForestTree(x2, y2, angle - random.randrange(-30, 30), depth - 1, size, recursiondepth + 1) drawForestTree(x2, y2, angle - random.randrange(-30, 30), depth - 1, size, recursiondepth + 1) drawForestTree(x2, y2, angle - random.randrange(-30, 30), depth - 1, size, recursiondepth + 1) else: drawForestTree(x2, y2, angle - random.randrange(15, 50), depth - 1, size, recursiondepth + 1) if depth % 2 == 0: drawForestTree(x2, y2, angle + 20, depth - 1, size, recursiondepth + 1) if (depth + 1) % 4 == 0: drawForestTree(x2, y2, angle + 20, depth - 1, size, recursiondepth + 1) if depth == 5: drawForestTree(x2, y2, angle - 45, depth - 1, size, recursiondepth + 1) drawForestTree(x2, y2, angle + 45, depth - 1, size, recursiondepth + 1) # draw a series of trees with a y position based on depth def drawForest(trees, options): image = gimp_be.gimp.image_list()[0] for tree in range(0, trees): y1 = 2 * (image.height / 3) + random.randrange(-1 * (image.height / 5), image.height / 5) x1 = random.randrange(image.width / 20, 19 * (image.width / 20)) angle = random.randrange(250, 290) size = (y1 / (2.0 * (image.height / 3.0) + (image.height / 5.0))) + 4 depth = random.randrange(3, 7) drawForestTree(x1, y1, angle, depth, size) #draws polygon of N sides at a x-y location def drawPolygon(sides=5,size=300,x_pos=0,y_pos=0, angle_offset=0): image = gimp_be.gimp.image_list()[0] drawable = gimp_be.pdb.gimp_image_active_drawable(image) if y_pos==0: y_pos=image.height/2 if x_pos==0: x_pos=image.width/2 degree_between_points=360/sides points_list=[] for x in range(0,sides+1): point_degree=degree_between_points*x+angle_offset points_list.append(int(round(math.sin(math.radians(point_degree))*size))+x_pos) points_list.append(int(round(math.cos(math.radians(point_degree))*size))+y_pos) fade_out=0 method=0 gradient_length=0 gimp_be.pdb.gimp_paintbrush(drawable, fade_out, len(points_list), points_list, method, gradient_length) #draw a grid of polygons of N sides def drawPolygonGrid(size=60,sides=3, angle_offset=0): image = gimp_be.gimp.image_list()[0] drawable = gimp_be.pdb.gimp_image_active_drawable(image) if sides%2 == 1 or sides>4: for y in range(0-image.height/10,image.height+image.height/10, size): x_loop=0 for x in range(0-image.width/10, image.width+image.width/10, size): if x_loop%2==1: drawPolygon(sides,size-size/2,x-(size/2),y,360/sides) else: drawPolygon(sides,size-size/2,x,y,0) x_loop=x_loop+1 else: for x in range(0-image.height/10,image.height+image.height/10, size): for y in range(0-image.width/10, image.width+image.width/10, size): drawPolygon(sides,size/3,x,y,0) degree_between_points=360/sides points_list=[] for x in range(0,sides+1): point_degree=math.radians(degree_between_points*x+angle_offset) points_list.append(int(round(math.sin(point_degree)*size))) points_list.append(int(round(math.cos(point_degree)*size))) fade_out=0 method=0 gradient_length=0 gimp_be.pdb.gimp_paintbrush(drawable, fade_out, len(points_list), points_list, method, gradient_length) def drawFrygon(sides=5,size=300,x_pos=0,y_pos=0, angle_offset=0): image = gimp_be.gimp.image_list()[0] drawable = gimp_be.pdb.gimp_image_active_drawable(image) if y_pos==0: y_pos=image.height/2 if x_pos==0: x_pos=image.width/2 degree_between_points=360/sides points_list=[] for x in range(0,sides+1): point_degree=degree_between_points*x+angle_offset points_list.append(int(round(math.sin(point_degree)*size))+y_pos) points_list.append(int(round(math.cos(point_degree)*size))+x_pos) fade_out=0 method=0 gradient_length=0 gimp_be.pdb.gimp_paintbrush(drawable, fade_out, len(points_list), points_list, method, gradient_length) def drawFrygonGrid(size=120,sides=13): global height, width if sides%2 == 1: for x in range(0,height,size): x_deep=0 for y in range(0, width,size): if x_deep%2==1: drawFrygon(sides,size,x,y-(size/2),0) else: drawFrygon(sides,size,x,y,0) x_deep=x_deep+1 else: for x in range(0,height, size): for y in range(0, width, size): drawFrygon(sides,size,x,y,0)
J216/gimp_be
gimp_be/draw/draw.py
Python
mit
26,770
import {Option} from "./option"; export class HelpOption extends Option { /** * */ constructor() { super(); this.shortName = 'h'; this.longName = 'help'; this.argument = ''; } }
scipper/angularjs-cli
src/angularjs-cli/options/help.option.ts
TypeScript
mit
210
import * as React from 'react'; import { createIcon } from '../Icon'; export const ShieldIcon = createIcon( <path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z" />, 'ShieldIcon' );
keystonejs/keystone
design-system/packages/icons/src/icons/ShieldIcon.tsx
TypeScript
mit
186
"use strict"; var GLOBAL_MOUNT_POINT_MAX = Math.pow(2, 53); var util = { uuid: function(){ return Math.ceil(Math.random() * GLOBAL_MOUNT_POINT_MAX); } }; module.exports = util;
Ovaldi/node-cqrs
src/util.js
JavaScript
mit
194
<?php namespace ToyLang\Core\Lexer; use ToyLang\Core\Lexer\Token\Token; use ToyLang\Core\Lexer\Token\TokenType; interface Lexer { /** * @param TokenType $tokenType * @return $this */ public function addTokenType(TokenType $tokenType); /** * @param TokenType[] $tokenTypes * @return $this */ public function addTokenTypes($tokenTypes); /** * @param $input * @return Token[] */ public function tokenize($input); }
estelsmith/toy-language
src/Core/Lexer/Lexer.php
PHP
mit
486
// // HomeDateContainerView.h // XQDemo // // Created by XiangqiTu on 15-4-13. // // #import <UIKit/UIKit.h> @interface HomeDateContainerView : UIView - (void)caculateDateWithTimestamp:(NSString *)timestamp; @end
XiangqiTu/XQDemo
XQDemo/XQDemo/Sections/HomePageCoverFlow/SubView/HomeDateContainerView.h
C
mit
220
require 'test_helper' class CustomerQuestionshipTest < ActiveSupport::TestCase # test "the truth" do # assert true # end end
chinxianjun/autorepair
test/unit/customer_questionship_test.rb
Ruby
mit
134
/** * @author Mat Groves http://matgroves.com/ @Doormat23 */ /** * A DisplayObjectContainer represents a collection of display objects. * It is the base class of all display objects that act as a container for other objects. * * @class DisplayObjectContainer * @extends DisplayObject * @constructor */ PIXI.DisplayObjectContainer = function() { PIXI.DisplayObject.call( this ); /** * [read-only] The of children of this container. * * @property children * @type Array<DisplayObject> * @readOnly */ this.children = []; } // constructor PIXI.DisplayObjectContainer.prototype = Object.create( PIXI.DisplayObject.prototype ); PIXI.DisplayObjectContainer.prototype.constructor = PIXI.DisplayObjectContainer; /** * Adds a child to the container. * * @method addChild * @param child {DisplayObject} The DisplayObject to add to the container */ PIXI.DisplayObjectContainer.prototype.addChild = function(child) { if(child.parent != undefined) { //// COULD BE THIS??? child.parent.removeChild(child); // return; } child.parent = this; this.children.push(child); // update the stage refference.. if(this.stage) { var tmpChild = child; do { if(tmpChild.interactive)this.stage.dirty = true; tmpChild.stage = this.stage; tmpChild = tmpChild._iNext; } while(tmpChild) } // LINKED LIST // // modify the list.. var childFirst = child.first var childLast = child.last; var nextObject; var previousObject; // this could be wrong if there is a filter?? if(this._filters || this._mask) { previousObject = this.last._iPrev; } else { previousObject = this.last; } nextObject = previousObject._iNext; // always true in this case // need to make sure the parents last is updated too var updateLast = this; var prevLast = previousObject; while(updateLast) { if(updateLast.last == prevLast) { updateLast.last = child.last; } updateLast = updateLast.parent; } if(nextObject) { nextObject._iPrev = childLast; childLast._iNext = nextObject; } childFirst._iPrev = previousObject; previousObject._iNext = childFirst; // need to remove any render groups.. if(this.__renderGroup) { // being used by a renderTexture.. if it exists then it must be from a render texture; if(child.__renderGroup)child.__renderGroup.removeDisplayObjectAndChildren(child); // add them to the new render group.. this.__renderGroup.addDisplayObjectAndChildren(child); } } /** * Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown * * @method addChildAt * @param child {DisplayObject} The child to add * @param index {Number} The index to place the child in */ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index) { if(index >= 0 && index <= this.children.length) { if(child.parent != undefined) { child.parent.removeChild(child); } child.parent = this; if(this.stage) { var tmpChild = child; do { if(tmpChild.interactive)this.stage.dirty = true; tmpChild.stage = this.stage; tmpChild = tmpChild._iNext; } while(tmpChild) } // modify the list.. var childFirst = child.first; var childLast = child.last; var nextObject; var previousObject; if(index == this.children.length) { previousObject = this.last; var updateLast = this; var prevLast = this.last; while(updateLast) { if(updateLast.last == prevLast) { updateLast.last = child.last; } updateLast = updateLast.parent; } } else if(index == 0) { previousObject = this; } else { previousObject = this.children[index-1].last; } nextObject = previousObject._iNext; // always true in this case if(nextObject) { nextObject._iPrev = childLast; childLast._iNext = nextObject; } childFirst._iPrev = previousObject; previousObject._iNext = childFirst; this.children.splice(index, 0, child); // need to remove any render groups.. if(this.__renderGroup) { // being used by a renderTexture.. if it exists then it must be from a render texture; if(child.__renderGroup)child.__renderGroup.removeDisplayObjectAndChildren(child); // add them to the new render group.. this.__renderGroup.addDisplayObjectAndChildren(child); } } else { throw new Error(child + " The index "+ index +" supplied is out of bounds " + this.children.length); } } /** * [NYI] Swaps the depth of 2 displayObjects * * @method swapChildren * @param child {DisplayObject} * @param child2 {DisplayObject} * @private */ PIXI.DisplayObjectContainer.prototype.swapChildren = function(child, child2) { if(child === child2) { return; } var index1 = this.children.indexOf(child); var index2 = this.children.indexOf(child2); if(index1 < 0 || index2 < 0) { throw new Error("swapChildren: Both the supplied DisplayObjects must be a child of the caller."); } this.removeChild(child); this.removeChild(child2); if(index1 < index2) { this.addChildAt(child2, index1); this.addChildAt(child, index2); } else { this.addChildAt(child, index2); this.addChildAt(child2, index1); } } /** * Returns the Child at the specified index * * @method getChildAt * @param index {Number} The index to get the child from */ PIXI.DisplayObjectContainer.prototype.getChildAt = function(index) { if(index >= 0 && index < this.children.length) { return this.children[index]; } else { throw new Error(child + " Both the supplied DisplayObjects must be a child of the caller " + this); } } /** * Removes a child from the container. * * @method removeChild * @param child {DisplayObject} The DisplayObject to remove */ PIXI.DisplayObjectContainer.prototype.removeChild = function(child) { var index = this.children.indexOf( child ); if ( index !== -1 ) { // unlink // // modify the list.. var childFirst = child.first; var childLast = child.last; var nextObject = childLast._iNext; var previousObject = childFirst._iPrev; if(nextObject)nextObject._iPrev = previousObject; previousObject._iNext = nextObject; if(this.last == childLast) { var tempLast = childFirst._iPrev; // need to make sure the parents last is updated too var updateLast = this; while(updateLast.last == childLast) { updateLast.last = tempLast; updateLast = updateLast.parent; if(!updateLast)break; } } childLast._iNext = null; childFirst._iPrev = null; // update the stage reference.. if(this.stage) { var tmpChild = child; do { if(tmpChild.interactive)this.stage.dirty = true; tmpChild.stage = null; tmpChild = tmpChild._iNext; } while(tmpChild) } // webGL trim if(child.__renderGroup) { child.__renderGroup.removeDisplayObjectAndChildren(child); } child.parent = undefined; this.children.splice( index, 1 ); } else { throw new Error(child + " The supplied DisplayObject must be a child of the caller " + this); } } /* * Updates the container's children's transform for rendering * * @method updateTransform * @private */ PIXI.DisplayObjectContainer.prototype.updateTransform = function() { if(!this.visible)return; PIXI.DisplayObject.prototype.updateTransform.call( this ); for(var i=0,j=this.children.length; i<j; i++) { this.children[i].updateTransform(); } }
MKelm/pixi.js
src/pixi/display/DisplayObjectContainer.js
JavaScript
mit
7,407
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> <link rel="stylesheet" href="style.css"> <link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet"> <!-- Latest compiled and minified JavaScript --> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> <title>TSA Website Design</title> </head> <body> <div id="background"> <img src="dscovrblured.jpg" class="stretch"> </div> <nav id="mainNav" class="navbar navbar-inverse navbar-fixed-top"> <div align="center" class="container-fluid"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar1" aria-expanded="false" aria-controls="navbar"> <span class="sr-only">Navigation Toggle</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <!--<a class="navbar-brand page-scroll" href="index.html">Privatization of Space Exploration</a>--> </div> <div style="text-align:center" class="collapse navbar-collapse" id="navbar1"> <ul class="nav navbar-nav navbar-right"> <li> <a class="page-scroll" href="index.html">Home</a> </li> <li class="dropdown"> <a class="dropdown-toggle" data-toggle="dropdown" href="#b2">Space Enterprises <span class="caret"></span></a> <ul class="dropdown-menu"> <li> <a href="#b21">SpaceX</a> </li> <li> <a href="#b22">Blue Origin</a> </li> <li> <a href="#b23">Vigin Galactic</a> </li> <li> <a href="#b24">XCOR</a> </li> <li> <a href="#b25">Starchaser Industries</a> </li> <li> <a href="#b26">Bigelow Aerospace</a> </li> <li> <a href="#b27">Lockheed Martin</a> </li> <li> <a href="#b28">Orbital ATK</a> </li> <li> <a href="#b29">Scaled Composites</a> </li> </ul> </li> <li> <a class="page-scroll" href="#b2">Timeline of Events</a> </li> <li> <a class="page-scroll" href="#b3">Evolution of Vehicles</a> </li> <li> <a class="page-scroll" href="#d4">Careers & Interviews</a> </li> <li> <a class="page-scroll" href="#d5">Impacts and Advantages</a> </li> <li> <a class="page-scroll" href="#d6">Careers & Interviews</a> </li> <li> <a class="page-scroll" href="#d7">Resources</a> </li> </ul> </div> </div> </nav> <p> <div class="container-fluid"> <div class="row"> <a href="aboutspacex.html"> <img src="spacexheaderwithlogofaded.png" class="img-responsive"> </a> </div> <!---NIEN---> </div> </p> <div class="container"> <div class="panel panel-default"> <div class="panel-body"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque vitae sapien id est dignissim venenatis. Maecenas quis gravida ipsum, a pharetra nisi. Etiam ornare arcu eu diam luctus convallis. Cras dictum diam augue, sed porttitor nibh euismod ac. Proin ullamcorper, velit ac rutrum fermentum, nunc urna bibendum augue, in scelerisque nisl sapien ac nunc. Ut id faucibus lorem, vel finibus mi. Nunc pharetra elit non libero dictum venenatis. Vestibulum vel massa in odio viverra maximus quis eu velit. Nulla auctor ut ligula at dapibus. Ut id tincidunt orci. Sed et consequat urna. Cras eu consequat dolor. Integer fringilla at nisl eu venenatis. Ut vulputate accumsan mauris, vel porttitor nunc maximus non. Morbi convallis ornare laoreet. Maecenas sagittis consequat consectetur. Mauris placerat dignissim neque quis lacinia. Phasellus ut dapibus mi, sit amet pretium leo. Praesent eget placerat nisl. Duis dictum nisi vitae maximus hendrerit. Pellentesque porta neque ac malesuada volutpat. Morbi quis erat nisl. Quisque eros sem, molestie et fermentum eu, efficitur ac mi. Sed euismod ipsum enim, ultrices sodales nisl auctor eget. Etiam vel mi convallis, vulputate magna a, dictum enim. Cras eleifend lorem placerat tortor venenatis, non venenatis dolor lacinia. Morbi augue massa, interdum at neque nec, congue pretium libero. Aenean tempor pellentesque hendrerit. Morbi eget dui lectus. Suspendisse potenti. Suspendisse non enim faucibus, condimentum tellus eget, posuere sem. Aenean volutpat luctus tincidunt. Vestibulum at cursus turpis, in vestibulum nunc. Sed scelerisque erat in finibus auctor. Suspendisse euismod ante diam, in fermentum elit tempus vel. Nulla auctor enim nec eros semper, nec sollicitudin libero pharetra. Fusce ut finibus neque. Fusce augue risus, semper a consectetur sit amet, congue a nunc. In mattis euismod sem at pretium. Nunc lacinia semper felis, non tincidunt magna placerat vitae. Quisque facilisis vel sapien sit amet vulputate. Nulla facilisi. In vel tortor libero. Vestibulum pharetra congue metus, et vestibulum tellus ultrices quis. Phasellus vel eros et libero suscipit feugiat. Vivamus pretium malesuada vulputate. Suspendisse egestas metus sit amet dapibus ullamcorper. Quisque elementum tempus nulla id mattis. Quisque iaculis interdum erat, id varius lectus ultricies et. Aenean sit amet arcu rutrum, vulputate arcu ac, consequat nunc. Phasellus vel risus ante. Suspendisse efficitur felis neque, non semper sapien scelerisque ut. Fusce vel libero vitae enim tincidunt sollicitudin. Nunc id ligula cursus, fringilla lectus id, fermentum purus. </div> </div> </div> </body> </html>
BedrockSolid/BedrockSolid.github.io
aboutspacex.html
HTML
mit
6,716
function ga() {} var _gaq = []
NonLogicalDev/ucsd_cat125
client/scripts/ga.js
JavaScript
mit
31
export { default } from 'ember-stripe-elements/components/stripe-card';
code-corps/ember-stripe-elements
app/components/stripe-card.js
JavaScript
mit
72
<?php return [ /** *-------------------------------------------------------------------------- * Default Broadcaster *-------------------------------------------------------------------------- * * This option controls the default broadcaster that will be used by the * framework when an event needs to be broadcast. You may set this to * any of the connections defined in the "connections" array below. * * Supported: "pusher", "redis", "log", "null" * */ 'default' => env('BROADCAST_DRIVER', 'null'), /** *-------------------------------------------------------------------------- * Broadcast Connections *-------------------------------------------------------------------------- * * Here you may define all of the broadcast connections that will be used * to broadcast events to other systems or over websockets. Samples of * each available type of connection are provided inside this array. * */ 'connections' => [ 'pusher' => [ 'driver' => 'pusher', 'key' => env('PUSHER_APP_KEY'), 'secret' => env('PUSHER_APP_SECRET'), 'app_id' => env('PUSHER_APP_ID'), 'options' => [ 'cluster' => env('PUSHER_APP_CLUSTER'), 'encrypted' => true, ], ], 'redis' => [ 'driver' => 'redis', 'connection' => 'default', ], 'log' => [ 'driver' => 'log', ], 'null' => [ 'driver' => 'null', ], ], ];
lioneil/pluma
config/broadcasting.php
PHP
mit
1,626
--- name: Bug report about: Create a report to help us improve --- **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior: 1. Go to '...' 2. use option '...' 3. See error **Expected behavior** A clear and concise description of what you expected to happen. **Desktop (please complete the following information):** - OS: [e.g. iOS] **nibetaseries version** Add the version of nibetaseries you are using **Additional context** Add any other context about the problem here.
HBClab/NiBetaSeries
.github/ISSUE_TEMPLATE/bug_report.md
Markdown
mit
546
#include "binary_buffer.hpp" #include <iterator> #include <algorithm> #include <sstream> #include <boost/endian/conversion.hpp> using boost::endian::native_to_big; using boost::endian::big_to_native; namespace { using aria::byte; template <typename P> void append_bytes_to_vector(std::vector<byte> & vec, P primitive) { auto * begin = reinterpret_cast<byte *>(&primitive); auto * end = begin + sizeof(primitive); std::copy(begin, end, std::back_inserter(vec)); } template <typename P> P read_primitive_and_advance(const byte * buffer, size_t size, size_t & offset, const std::string & name) { size_t stride = sizeof(P); if (offset + stride <= size) { auto i = reinterpret_cast<const P *>(buffer + offset); offset += stride; return big_to_native(*i); } else { throw aria::internal::buffer_error("Insufficient bytes available to read " + name + "."); } } } aria::internal::buffer_error::buffer_error(const char *what) : std::runtime_error(what) { } aria::internal::buffer_error::buffer_error(const std::string &what) : std::runtime_error(what) { } void aria::internal::binary_buffer_writer::write_uint8(uint8_t i) { _bytes.push_back(static_cast<byte>(i)); } void aria::internal::binary_buffer_writer::write_uint16(uint16_t i) { append_bytes_to_vector(_bytes, native_to_big(i)); } void aria::internal::binary_buffer_writer::write_uint32(uint32_t i) { append_bytes_to_vector(_bytes, native_to_big(i)); } void aria::internal::binary_buffer_writer::write_uint64(uint64_t i) { append_bytes_to_vector(_bytes, native_to_big(i)); } void aria::internal::binary_buffer_writer::write_string(const std::string &str) { write_uint32(str.size()); for (auto c : str) { _bytes.push_back(static_cast<byte>(c)); } } void aria::internal::binary_buffer_writer::write_bytes(const std::vector<aria::byte> &bytes) { write_uint32(bytes.size()); std::copy(bytes.begin(), bytes.end(), std::back_inserter(_bytes)); } std::vector<aria::byte> aria::internal::binary_buffer_writer::take_buffer() { std::vector<byte> buffer; _bytes.swap(buffer); return buffer; } aria::internal::binary_buffer_reader::binary_buffer_reader(const std::vector<byte> * buffer) : _buffer_start(buffer->data()), _buffer_size(buffer->size()), _offset(0) { } uint8_t aria::internal::binary_buffer_reader::read_uint8() { return read_primitive_and_advance<uint8_t>(_buffer_start, _buffer_size, _offset, "uint8"); } uint16_t aria::internal::binary_buffer_reader::read_uint16() { return read_primitive_and_advance<uint16_t>(_buffer_start, _buffer_size, _offset, "uint16"); } uint32_t aria::internal::binary_buffer_reader::read_uint32() { return read_primitive_and_advance<uint32_t>(_buffer_start, _buffer_size, _offset, "uint32"); } uint64_t aria::internal::binary_buffer_reader::read_uint64() { return read_primitive_and_advance<uint64_t>(_buffer_start, _buffer_size, _offset, "uint64"); } std::string aria::internal::binary_buffer_reader::read_string() { uint32_t size; try { size = read_uint32(); } catch (buffer_error) { throw buffer_error("Insufficient bytes available to read string size."); } if (_offset + size <= _buffer_size) { auto data = reinterpret_cast<const char *>(_buffer_start + _offset); _offset += size; return std::string(data, size);; } else { assert(_offset <= _buffer_size); auto available = _buffer_size - _offset; std::stringstream ss; ss << "Expected " << size << " bytes of string data, but only " << available << " available bytes in buffer."; throw buffer_error(ss.str()); } } std::vector<byte> aria::internal::binary_buffer_reader::read_bytes() { uint32_t size; try { size = read_uint32(); } catch (buffer_error) { throw buffer_error("Insufficient bytes available to read data size."); } if (_offset + size <= _buffer_size) { auto data = _buffer_start + _offset; _offset += size; return std::vector<byte>(data, data + size); } else { assert(_offset <= _buffer_size); auto available = _buffer_size - _offset; std::stringstream ss; ss << "Expected " << size << " bytes of data, but only " << available << " available bytes in buffer."; throw buffer_error(ss.str()); } }
Andlon/aria
src/util/binary_buffer.cpp
C++
mit
4,531
<pre><code class="css">h1(class='s-simple-title u-fs-h5x') Thumbnail Object h2.s-simple-title--sub Default .s-simple-objects.thumbnail .o-thumb img(class="o-thumb__item" src= "http://placehold.it/200") .s-simple-code include ../code/highlight/highlight-code-javascript.html h2.s-simple-title--sub Thumbnail Rounded .s-simple-objects.thumbnail .o-thumb img(class="o-thumb__item u-r-all" src= "http://placehold.it/200") .s-simple-code include ../code/highlight/highlight-code-javascript.html h2.s-simple-title--sub Thumbnail Circle .s-simple-objects.thumbnail .o-thumb img(class="o-thumb__item u-r-circle" src= "http://placehold.it/200") .s-simple-code include ../code/highlight/highlight-code-javascript.html</code></pre>
simoneramo/simple
app/_partials/simple-partials/code/objects/thumbnail.html
HTML
mit
747
# Acknowledgements This application makes use of the following third party libraries: ## AFNetworking Copyright (c) 2011–2016 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. ## AFOAuth2Manager Copyright (c) 2011-2014 AFNetworking (http://afnetworking.com) 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. ## AHKActionSheet Copyright (c) 2014 Arkadiusz Holko <[email protected]> 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. ## APAddressBook Copyright (c) 2013 Alterplay 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. ## BBBadgeBarButtonItem The MIT License (MIT) Copyright (c) 2014 Tanguy Aladenise 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. ## CYRTextView The MIT License (MIT) Copyright (c) 2014 Cyrillian, 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. ## DAKeyboardControl # License ## MIT License Copyright (c) 2012 Daniel Amitay (http://danielamitay.com) 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. ## DHSmartScreenshot The MIT License (MIT) Copyright (c) 2013 David Hernandez 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. ## DTCoreText Copyright (c) 2011, Oliver Drobnik 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. 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 HOLDER 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. ## DTFoundation Copyright (c) 2011, Oliver Drobnik 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. 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 HOLDER 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. ## FDWaveformView Copyright (c) 2015 William Entriken <[email protected]> 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. ## FreeStreamer Copyright (c) 2011-2016 Matias Muhonen <[email protected]> 穆马帝 All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. 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. 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. The FreeStreamer framework bundles Reachability which is licensed under the following license: Copyright (c) 2011, Tony Million. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. 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. 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 HOLDER 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. ## HMSegmentedControl # License ## MIT License Copyright (c) 2012 Hesham Abd-Elmegid (http://www.hesh.am) 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. ## INTULocationManager The MIT License (MIT) Copyright (c) 2014-2015 Intuit 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. ## IQAudioRecorderController The MIT License (MIT) Copyright (c) 2015 Mohd Iftekhar Qurashi 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. ## JDStatusBarNotification Copyright © 2013 Markus Emrich 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. (MIT License) ## JSCoreBom The MIT License (MIT) 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 © 2009-2016 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. ## NSGIF The MIT License (MIT) Copyright (c) 2015 Sebastian Dobrincu 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. ## NSHash Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ## OMGHTTPURLRQ See README.markdown for full license text. ## PBJVision The MIT License (MIT) Copyright (c) 2013-present Patrick Piemonte 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. ## PHFComposeBarView Copyright (C) 2013 Philipe Fatio 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. ## PHFDelegateChain Copyright (C) 2012 Philipe Fatio 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. ## REMenu Copyright (c) 2013 Roman Efimov (https://github.com/romaonthego). 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. ## RMActionController The MIT License (MIT) Copyright (c) 2015 Roland Moers 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. ## RMDateSelectionViewController Copyright (c) 2013-2015 Roland Moers 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. ## Reachability Copyright (c) 2011, Tony Million. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. 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. 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 HOLDER 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. ## SBJson Copyright (C) 2007-2015 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. ## SCSiriWaveformView The MIT License (MIT) Copyright (c) [2013] [Stefan Ceriu] 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. ## SDWebImage Copyright (c) 2016 Olivier Poitrey [email protected] 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. ## 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. ## SWFrameButton The MIT License (MIT) Copyright (c) 2014 Sarun Wongpatcharapakorn 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. ## SWTableViewCell Copyright (c) 2013 Christopher Wendel 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. ## SZTextView Copyright (c) 2013 glaszig <[email protected]> MIT License 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. ## TDOAuth OHAI CocoaPods linter! ## TTTAttributedLabel Copyright (c) 2011 Mattt Thompson (http://mattt.me/) 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. ## TWMessageBarManager Copyright (C) 2013 Terry Worona 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. ## UICKeyChainStore The MIT License Copyright (c) 2011 kishikawa katsumi 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. ## libPhoneNumber-iOS Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS Generated by CocoaPods - https://cocoapods.org
wajahatch888/JASONETTE-iOS
app/Pods/Target Support Files/Pods-Jasonette/Pods-Jasonette-acknowledgements.markdown
Markdown
mit
64,190
# :floppy_disk: ghbackup [![GoDoc](https://godoc.org/qvl.io/ghbackup?status.svg)](https://godoc.org/qvl.io/ghbackup) [![Build Status](https://travis-ci.org/qvl/ghbackup.svg?branch=master)](https://travis-ci.org/qvl/ghbackup) [![Go Report Card](https://goreportcard.com/badge/qvl.io/ghbackup)](https://goreportcard.com/report/qvl.io/ghbackup) Backup your GitHub repositories with a simple command-line application written in Go. The simplest way to keep your repositories save: 1. [Install](#install) `ghbackup` 1. Get a token from https://github.com/settings/tokens 2. `ghbackup -secret token /path/to/backup/dir` This will backup all repositories you have access to. ----------------------------------- Embarrassing simple GitHub backup tool Usage: ghbackup [flags] directory directory path to save the repositories to At least one of -account or -secret must be specified. Flags: -account string GitHub user or organization name to get repositories from. If not specified, all repositories the authenticated user has access to will be loaded. -secret string Authentication secret for GitHub API. Can use the users password or a personal access token (https://github.c om/settings/tokens). Authentication increases rate limiting (https://developer.github.com/v3 /#rate-limiting) and enables backup of private repositories. -silent Suppress all output -version Print binary version For more visit https://qvl.io/ghbackup. ## Install - Note that `ghbackup` uses `git` under the hood. Please make sure it is installed on your system. - With [Go](https://golang.org/): ``` go get qvl.io/ghbackup ``` - With [Homebrew](http://brew.sh/): ``` brew install qvl/tap/ghbackup ``` - Download binary: https://github.com/qvl/ghbackup/releases ## Automation Mostly, we like to setup backups to run automatically in an interval. Let's setup `ghbackup` on a Linux server and make it run daily at 1am. This works similar on other platforms. There are different tools to do this: ### systemd and sleepto *Also see [this tutorial](https://jorin.me/automating-github-backup-with-ghbackup/).* [systemd](https://freedesktop.org/wiki/Software/systemd/) runs on most Linux systems and using [sleepto](https://qvl.io/sleepto) it's easy to create a service to schedule a backup. - Create a new unit file: ``` sh sudo touch /etc/systemd/system/ghbackup.service && sudo chmod 644 $_ ``` - Edit file: ``` [Unit] Description=GitHub backup After=network.target [Service] User=jorin ExecStart=/PATH/TO/sleepto -hour 1 /PATH/TO/ghbackup -account qvl /home/USER/github Restart=always [Install] WantedBy=multi-user.target ``` - Replace the paths with your options. - Start service and enable it on boot: ``` sh sudo systemctl daemon-reload sudo systemctl enable --now ghbackup ``` - Check if service is running: ``` sh systemctl status ghbackup ``` ### Cron Cron is a job scheduler that already runs on most Unix systems. - Run `crontab -e` - Add a new line and replace `NAME` and `DIR` with your options: ``` sh 0 1 * * * ghbackup -account NAME DIR ``` For example: ``` sh 0 1 * * * ghbackup -account qvl /home/qvl/backup-qvl ``` ### Sending statistics The last line of the output contains a summary. You can use this to collect statistics about your backups. An easy way would be to use a [Slack hook](https://api.slack.com/incoming-webhooks) and send it like this: ```sh ghbackup -secret $GITHUB_TOKEN $DIR \ | tail -n1 \ | xargs -I%% curl -s -X POST --data-urlencode 'payload={"text": "%%"}' $SLACK_HOOK ``` ## What happens? Get all repositories of a GitHub account. Save them to a folder. Update already cloned repositories. Best served as a scheduled job to keep your backups up to date! ## Limits `ghbackup` is about repositories. There are other solutions if you like to backup issues and wikis. ## Use as Go package From another Go program you can directly use the `ghbackup` sub-package. Have a look at the [GoDoc](https://godoc.org/qvl.io/ghbackup/ghbackup). ## Development Make sure to use `gofmt` and create a [Pull Request](https://github.com/qvl/ghbackup/pulls). ### Releasing Push a new Git tag and [GoReleaser](https://github.com/goreleaser/releaser) will automatically create a release. ## License [MIT](./license)
qvl/ghbackup
readme.md
Markdown
mit
4,415
version https://git-lfs.github.com/spec/v1 oid sha256:a2aca9cd81f31f3e9e83559fdcfa84d3ee900090ee4baeb2bae129e9d06473eb size 1264
yogeshsaroya/new-cdnjs
ajax/libs/foundation/5.4.1/js/foundation/foundation.equalizer.min.js
JavaScript
mit
129
const exec = require('child_process').exec const path = require('path') const fs = require('fs') const execPath = process.execPath const binPath = path.dirname(execPath) const dep = path.join(execPath, '../../lib/node_modules/dep') const repository = 'https://github.com/depjs/dep.git' const bin = path.join(dep, 'bin/dep.js') process.stdout.write( 'exec: git' + [' clone', repository, dep].join(' ') + '\n' ) exec('git clone ' + repository + ' ' + dep, (e) => { if (e) throw e process.stdout.write('link: ' + bin + '\n') process.stdout.write(' => ' + path.join(binPath, 'dep') + '\n') fs.symlink(bin, path.join(binPath, 'dep'), (e) => { if (e) throw e }) })
depjs/dep
scripts/install.js
JavaScript
mit
676
using MongoDB.Driver; namespace AspNet.Identity.MongoDB { public class IndexChecks { public static void EnsureUniqueIndexOnUserName<TUser>(IMongoCollection<TUser> users) where TUser : IdentityUser { var userName = Builders<TUser>.IndexKeys.Ascending(t => t.UserName); var unique = new CreateIndexOptions {Unique = true}; users.Indexes.CreateOneAsync(userName, unique); } public static void EnsureUniqueIndexOnRoleName<TRole>(IMongoCollection<TRole> roles) where TRole : IdentityRole { var roleName = Builders<TRole>.IndexKeys.Ascending(t => t.Name); var unique = new CreateIndexOptions {Unique = true}; roles.Indexes.CreateOneAsync(roleName, unique); } public static void EnsureUniqueIndexOnEmail<TUser>(IMongoCollection<TUser> users) where TUser : IdentityUser { var email = Builders<TUser>.IndexKeys.Ascending(t => t.Email); var unique = new CreateIndexOptions {Unique = true}; users.Indexes.CreateOneAsync(email, unique); } } }
winterdouglas/aspnet-identity-mongo
src/AspNet.Identity.MongoDB/IndexChecks.cs
C#
mit
993
class SystemModule < ActiveRecord::Base attr_accessible :name def self.CUSTOMER readonly.find_by_name("Customer") end def self.USER readonly.find_by_name("User") end def self.CONTACT readonly.find_by_name("Contact") end end
woese/guara-crm
app/models/system_module.rb
Ruby
mit
262
# github-language-rainbow Just look at the colors
cfreeley/github-language-rainbow
README.md
Markdown
mit
50
package org.aikodi.chameleon.support.statement; import org.aikodi.chameleon.core.declaration.Declaration; import org.aikodi.chameleon.core.element.ElementImpl; import org.aikodi.chameleon.core.lookup.DeclarationSelector; import org.aikodi.chameleon.core.lookup.LookupContext; import org.aikodi.chameleon.core.lookup.LookupException; import org.aikodi.chameleon.core.lookup.SelectionResult; import org.aikodi.chameleon.core.validation.Valid; import org.aikodi.chameleon.core.validation.Verification; import org.aikodi.chameleon.oo.statement.ExceptionSource; import org.aikodi.chameleon.oo.statement.Statement; import org.aikodi.chameleon.util.association.Multi; import java.util.Collections; import java.util.List; /** * A list of statement expressions as used in the initialization clause of a for * statement. It contains a list of statement expressions. * * @author Marko van Dooren */ public class StatementExprList extends ElementImpl implements ForInit, ExceptionSource { public StatementExprList() { } /** * STATEMENT EXPRESSIONS */ private Multi<StatementExpression> _statementExpressions = new Multi<StatementExpression>(this); public void addStatement(StatementExpression statement) { add(_statementExpressions, statement); } public void removeStatement(StatementExpression statement) { remove(_statementExpressions, statement); } public List<StatementExpression> statements() { return _statementExpressions.getOtherEnds(); } @Override public StatementExprList cloneSelf() { return new StatementExprList(); } public int getIndexOf(Statement statement) { return statements().indexOf(statement) + 1; } public int getNbStatements() { return statements().size(); } @Override public List<? extends Declaration> locallyDeclaredDeclarations() throws LookupException { return declarations(); } @Override public List<? extends Declaration> declarations() throws LookupException { return Collections.EMPTY_LIST; } @Override public LookupContext localContext() throws LookupException { return language().lookupFactory().createLocalLookupStrategy(this); } @Override public <D extends Declaration> List<? extends SelectionResult<D>> declarations(DeclarationSelector<D> selector) throws LookupException { return Collections.emptyList(); } @Override public Verification verifySelf() { return Valid.create(); } }
markovandooren/chameleon
src/org/aikodi/chameleon/support/statement/StatementExprList.java
Java
mit
2,449
"use strict"; ace.define("ace/snippets/matlab", ["require", "exports", "module"], function (e, t, n) { "use strict"; t.snippetText = undefined, t.scope = "matlab"; });
IonicaBizau/arc-assembler
clients/ace-builds/src-min-noconflict/snippets/matlab.js
JavaScript
mit
172
(function(){ /** * PubSub implementation (fast) */ var PubSub = function PubSub( defaultScope ){ if (!(this instanceof PubSub)){ return new PubSub( defaultScope ); } this._topics = {}; this.defaultScope = defaultScope || this; }; PubSub.prototype = { /** * Subscribe a callback (or callbacks) to a topic (topics). * * @param {String|Object} topic The topic name, or a config with key/value pairs of { topic: callbackFn, ... } * @param {Function} fn The callback function (if not using Object as previous argument) * @param {Object} scope (optional) The scope to bind callback to * @param {Number} priority (optional) The priority of the callback (higher = earlier) * @return {this} */ subscribe: function( topic, fn, scope, priority ){ var listeners = this._topics[ topic ] || (this._topics[ topic ] = []) ,orig = fn ,idx ; // check if we're subscribing to multiple topics // with an object if ( Physics.util.isObject( topic ) ){ for ( var t in topic ){ this.subscribe( t, topic[ t ], fn, scope ); } return this; } if ( Physics.util.isObject( scope ) ){ fn = Physics.util.bind( fn, scope ); fn._bindfn_ = orig; } else if (!priority) { priority = scope; } fn._priority_ = priority; idx = Physics.util.sortedIndex( listeners, fn, '_priority_' ); listeners.splice( idx, 0, fn ); return this; }, /** * Unsubscribe function from topic * @param {String} topic Topic name * @param {Function} fn The original callback function * @return {this} */ unsubscribe: function( topic, fn ){ var listeners = this._topics[ topic ] ,listn ; if (!listeners){ return this; } for ( var i = 0, l = listeners.length; i < l; i++ ){ listn = listeners[ i ]; if ( listn._bindfn_ === fn || listn === fn ){ listeners.splice(i, 1); break; } } return this; }, /** * Publish data to a topic * @param {Object|String} data * @param {Object} scope The scope to be included in the data argument passed to callbacks * @return {this} */ publish: function( data, scope ){ if (typeof data !== 'object'){ data = { topic: data }; } var topic = data.topic ,listeners = this._topics[ topic ] ,l = listeners && listeners.length ; if ( !topic ){ throw 'Error: No topic specified in call to world.publish()'; } if ( !l ){ return this; } data.scope = data.scope || this.defaultScope; while ( l-- ){ data.handler = listeners[ l ]; data.handler( data ); } return this; } }; Physics.util.pubsub = PubSub; })();
lejoying/ibrainstroms
web/PhysicsJS/src/util/pubsub.js
JavaScript
mit
3,581
function fixPosition() { console.log($(window).scrollTop()); // if its anywhee but at the very top of the screen, fix it if ($(window).scrollTop() >= headerHeight) { // magic number offset that just feels right to prevent the 'bounce' // if (headPosition.top > 0){ $('body').addClass('js-fix-positions'); } // otherwise, make sure its not fixed else { $('body').removeClass('js-fix-positions'); } }; //Generate the weight guide meter with JS as its pretty useless without it, without some server side intervention function createBasketWeightGuide(){ // create the element for the guide $('.af__basket__weight-guide--label').after('<div class="js-af__weight-guide__wrapper"></div>'); $('.js-af__weight-guide__wrapper').append('<div class="js-af__weight-guide__meter"></div>'); $('.af__product__add-to-basket').submit(function(e){ e.preventDefault(); //var $multiplier= weightGuideListener(); }) } function weightGuideListener(){ var $bar = $('.js-af__weight-guide__meter'); //Didnt work as expected, so used this for speed: http://stackoverflow.com/questions/12945352/change-width-on-click-using-jquery var $percentage = (100 * parseFloat($bar.css('width')) / parseFloat($bar.parent().css('width')) +10 + '%'); $bar.css("width", $percentage); var $message = $('.af__basket__weight-guide--cta'); currentWidth=parseInt($percentage); console.log(currentWidth); // cannot use switch for less than if (currentWidth <= 21 ){ $message.text('Plenty of room'); } else if (currentWidth <= 45){ $bar.css('background-color', '#ee0'); } else if (currentWidth <= 65){ $bar.css('background-color', '#c1ea39'); $message.text('Getting there...') } else if (currentWidth <= 80){ $message.text('Room for a little one?'); } else if (currentWidth <= 89){ $message.text('Almost full!'); } else if (currentWidth >= 95 && currentWidth <= 99){ $message.text('Lookin\' good!'); } else if (currentWidth <= 99.9){ $bar.css('background-color', '#3ece38'); } else { $bar.css('background-color', '#d00'); $bar.css("width", "100%"); $message.text('(Delivery band 2 logic)'); } } function selectOnFocus(){ $('.af__product__add-to-basket input').focus(function(){ this.select(); }) }; $(document).ready(function(){ headerHeight=$('.af__header').outerHeight(); // icnludes padding and margins scrollIntervalID = setInterval(fixPosition, 16); // = 60 FPS createBasketWeightGuide(); selectOnFocus(); });
brtdesign/brtdesign.github.io
work/af-december2016/assets/js/_default.js
JavaScript
mit
2,769
<?php return [ '@class' => 'Grav\\Common\\File\\CompiledYamlFile', 'filename' => '/Users/kenrickkelly/Sites/hokui/user/plugins/admin/languages/tlh.yaml', 'modified' => 1527231007, 'data' => [ 'PLUGIN_ADMIN' => [ 'LOGIN_BTN_FORGOT' => 'lIj', 'BACK' => 'chap', 'NORMAL' => 'motlh', 'YES' => 'HIja\'', 'NO' => 'Qo\'', 'DISABLED' => 'Qotlh' ] ] ];
h0kui/hokui
cache/compiled/files/02efd2c2255a28026bd81d6a8068c728.yaml.php
PHP
mit
452
#!/usr/bin/env bash # Run a raspberry pi as ulnoiot gateway (wifi router and mqtt_broker) # # To enable this, # make sure ulnoiot-run script is porperly setup (for example in /home/pi/bin) # add the following to the end of /etc/rc.local with adjusted location of the # run-script: # export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" # /home/pi/bin/ulnoiot exec /home/pi/ulnoiot/lib/system_boot/raspi-boot.sh" # # Also disable all network devices in /etc/network/interfaces apart lo and wlan1 # and make sure that wlan1 configuration looks like this (replace /home/pi/ulnoiot # with the respective ULNOIOT_ROOT): # allow-hotplug wlan1 # iface wlan1 inet manual # pre-up /home/pi/bin/ulnoiot exec /home/pi/ulnoiot/lib/system_boot/raspi-pre-up.sh # wpa-conf /run/uiot_wpa_supplicant.conf [ "$ULNOIOT_ACTIVE" = "yes" ] || { echo "ulnoiot not active, aborting." 1>&2;exit 1; } source "$ULNOIOT_ROOT/bin/read_boot_config" # Try to guess user if [[ $ULNOIOT_ROOT =~ '/home/([!/]+)/ulnoiot' ]]; then ULNOIOT_USER=${BASH_REMATCH[1]} else ULNOIOT_USER=ulnoiot fi if [[ "ULNOIOT_AP_PASSWORD" ]]; then # pw was given, so start an accesspoint # start accesspoint and mqtt_broker ( sleep 15 # let network devices start cd "$ULNOIOT_ROOT" tmux new-session -d -n AP -s UIoTSvrs \ "./run" exec accesspoint \; \ new-window -d -n MQTT \ "./run" exec mqtt_broker \; \ new-window -d -n nodered \ su - $ULNOIOT_USER -c 'ulnoiot exec nodered_starter' \; \ new-window -d -n cloudcmd \ su - $ULNOIOT_USER -c 'ulnoiot exec cloudcmd_starter' \; \ new-window -d -n dongle \ su - $ULNOIOT_USER -c 'ulnoiot exec dongle_starter' \; ) & fi # accesspoint check
ulno/ulnoiot
lib/system_boot/raspi-boot.sh
Shell
mit
1,840
import React from 'react'; import ReactDOM from 'react-dom'; import _ from 'underscore'; import babel from 'babel-core/browser'; import esprima from 'esprima'; import escodegen from 'escodegen'; import estraverse from 'estraverse'; import Codemirror from 'react-codemirror'; import classNames from 'classnames'; import { iff, default as globalUtils } from 'app/utils/globalUtils'; import './styles/app.less'; import 'react-codemirror/node_modules/codemirror/lib/codemirror.css'; import 'react-codemirror/node_modules/codemirror/theme/material.css'; import 'app/modules/JsxMode'; const localStorage = window.localStorage; const TAB_SOURCE = 'SOURCE'; const TAB_TRANSCODE = 'TRANSCODE'; const LiveDemoApp = React.createClass({ getInitialState() { return { sourceCode: '', transCode: '', transError: '', tab: TAB_SOURCE, func: function() { } }; }, componentWillMount() { this._setSource(localStorage.getItem('sourceCode') || ''); }, componentDidMount() { this._renderPreview(); }, componentDidUpdate() { this._renderPreview(); }, render() { const { sourceCode, transCode, tab, transError } = this.state; const showSource = (tab === TAB_SOURCE); const cmOptions = { lineNumbers: true, readOnly: !showSource, mode: 'jsx', theme: 'material', tabSize: 2, smartIndent: true, indentWithTabs: false }; const srcTabClassName = classNames({ 'otsLiveDemoApp-tab': true, 'otsLiveDemoApp-active': showSource }); const transTabClassName = classNames({ 'otsLiveDemoApp-tab': true, 'otsLiveDemoApp-active': !showSource }); console.log((transCode || transError)); return ( <div className='otsLiveDemoApp'> <div className='otsLiveDemoApp-tabs'> <button className={srcTabClassName} onClick={this._onSrcClick}>Source</button> <button className={transTabClassName} onClick={this._onTransClick}>Transcode</button> </div> <div className='otsLiveDemoApp-src'> <Codemirror value={showSource ? sourceCode : (transCode || transError)} onChange={this._onChangeEditor} options={cmOptions} /> </div> </div> ); }, _onChangeEditor(value) { const { tab } = this.state; if (tab === TAB_SOURCE) { this._setSource(value); } }, _onSrcClick() { this.setState({ tab: TAB_SOURCE }); }, _onTransClick() { this.setState({ tab: TAB_TRANSCODE }); }, _setSource(sourceCode) { localStorage.setItem('sourceCode', sourceCode); const dependencies = []; let transCode; let transError; try { const es5trans = babel.transform(sourceCode); let uniqueId = 0; estraverse.replace(es5trans.ast.program, { enter(node, parent) { if ( node.type === 'CallExpression' && node.callee.type === 'Identifier' && node.callee.name === 'require' && node.arguments.length === 1 && node.arguments[0].type === 'Literal' ) { const dep = { identifier: '__DEPENDENCY_'+ (uniqueId++) , depName: node.arguments[0].value }; dependencies.push(dep); return { name: dep.identifier, type: 'Identifier' }; } else if ( node.type === 'AssignmentExpression' && node.left.type === 'MemberExpression' && node.left.object.type === 'Identifier' && node.left.object.name === 'module' && node.left.property.type === 'Identifier' && node.left.property.name === 'exports' ) { return { type: 'ReturnStatement', argument: node.right } } } }); transCode = escodegen.generate(es5trans.ast.program); } catch (e) { const msg = 'Error transpiling source code: '; transError = msg + e.toString(); globalUtils.error(msg, e); } this.setState({ sourceCode, transCode, transError }); if (transCode) { try { const fnConstArgs = [{ what: 'aaa'}].concat(dependencies.map((dep) => { return dep.identifier; })); fnConstArgs.push('exports'); fnConstArgs.push(transCode); this.setState({ func: new (Function.prototype.bind.apply(Function, fnConstArgs)) }); } catch(e) { console.error('Runtime Error', e); } } }, _renderPreview() { const { func } = this.state; const { Component, error } = (() => { try { return { Component: func(React, {}) }; } catch(e) { return { error: e }; } })(); try { if (Component) { ReactDOM.render(<Component />, document.getElementById('preview')); } else if (error) { ReactDOM.render(<div className='otsLiveDemoApp-error'>{error.toString()}</div>, document.getElementById('preview')); } } catch (e) { globalUtils.error('Fatal error rendering preview: ', e); } } }); ReactDOM.render(<LiveDemoApp />, document.getElementById('editor')); // const newProgram = { // type: 'Program', // body: [ // { // type: 'CallExpression', // callee: { // type: 'FunctionExpression', // id: null, // params: dependencies.map((dep) => { // return { // type: 'Identifier', // name: dep.identifier // } // }), // body: { // type: 'BlockStatement', // body: es5trans.ast.program.body // } // }, // arguments: [] // } // ] // };
frank-weindel/react-live-demo
app/index.js
JavaScript
mit
5,927
/** @babel */ /* eslint-env jasmine, atomtest */ /* This file contains verifying specs for: https://github.com/sindresorhus/atom-editorconfig/issues/118 */ import fs from 'fs'; import path from 'path'; const testPrefix = path.basename(__filename).split('-').shift(); const projectRoot = path.join(__dirname, 'fixtures'); const filePath = path.join(projectRoot, `test.${testPrefix}`); describe('editorconfig', () => { let textEditor; const textWithoutTrailingWhitespaces = 'I\nam\nProvidence.'; const textWithManyTrailingWhitespaces = 'I \t \nam \t \nProvidence.'; beforeEach(() => { waitsForPromise(() => Promise.all([ atom.packages.activatePackage('editorconfig'), atom.workspace.open(filePath) ]).then(results => { textEditor = results[1]; }) ); }); afterEach(() => { // remove the created fixture, if it exists runs(() => { fs.stat(filePath, (err, stats) => { if (!err && stats.isFile()) { fs.unlink(filePath); } }); }); waitsFor(() => { try { return fs.statSync(filePath).isFile() === false; } catch (err) { return true; } }, 5000, `removed ${filePath}`); }); describe('Atom being set to remove trailing whitespaces', () => { beforeEach(() => { // eslint-disable-next-line camelcase textEditor.getBuffer().editorconfig.settings.trim_trailing_whitespace = true; // eslint-disable-next-line camelcase textEditor.getBuffer().editorconfig.settings.insert_final_newline = false; }); it('should strip trailing whitespaces on save.', () => { textEditor.setText(textWithManyTrailingWhitespaces); textEditor.save(); expect(textEditor.getText().length).toEqual(textWithoutTrailingWhitespaces.length); }); }); });
florianb/atom-editorconfig
spec/iss118-spec.js
JavaScript
mit
1,733
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import <HomeSharing/HSRequest.h> @interface HSItemDataRequest : HSRequest { } + (id)requestWithDatabaseID:(unsigned int)arg1 itemID:(unsigned long long)arg2 format:(id)arg3; - (id)initWithDatabaseID:(unsigned int)arg1 itemID:(unsigned long long)arg2 format:(id)arg3; @end
matthewsot/CocoaSharp
Headers/PrivateFrameworks/HomeSharing/HSItemDataRequest.h
C
mit
419
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import <Foundation/NSPredicateOperator.h> @interface NSCompoundPredicateOperator : NSPredicateOperator { } + (id)notPredicateOperator; + (id)orPredicateOperator; + (id)andPredicateOperator; - (_Bool)evaluatePredicates:(id)arg1 withObject:(id)arg2 substitutionVariables:(id)arg3; - (_Bool)evaluatePredicates:(id)arg1 withObject:(id)arg2; - (id)symbol; - (id)predicateFormat; - (id)copyWithZone:(struct _NSZone *)arg1; @end
matthewsot/CocoaSharp
Headers/Frameworks/Foundation/NSCompoundPredicateOperator.h
C
mit
569