TL;DR: If you want to see me perform a spoken word poem about JavaScript in front of 1000 people (and on video), please ⭐ star this gist. If you're on mobile, you'll need to request desktop site.
| // http://en.wikipedia.org/wiki/Approximate_string_matching | |
| function fuzzySearch(t, p) { // returns minimum edit distance between substring of t and p | |
| var a = [], // current row | |
| b = [], // previous row | |
| pa = [], // from | |
| pb = [], | |
| s, i, j; | |
| for (i = 0; i <= p.length; i++) { | |
| s = b; | |
| b = a; |
| # pretty straightforward, very similar to the Session object, except uses getters and setters | |
| # to allow reactivity to happen 'magically' | |
| class ReactiveObject | |
| constructor: (attributes) -> | |
| @attributes = attributes | |
| @contexts = {} | |
| _.each attributes, (v, key) => | |
| @contexts[key] = {} | |
| Object.defineProperty(this, key, |
| /*globals $ */ | |
| /* | |
| * Patches the jQuery-animate method to use CSS-transitions when possible. | |
| * | |
| * - Depends on $.transit: http://ricostacruz.com/jquery.transit/ | |
| * - Degrades gracefully to the original method when transitions aren't supported. | |
| * - Provides fallbacks for translateX/Y's, so { x:10, y:10 } (very smooth) will become { top:10, left:10 } (less smooth) for less capable browsers. | |
| * - 3d-transforms could be enabled with enable3d:true. Example: { x:100, enable3d:true } | |
| * - Transitions could be disabled with enableTransitions:false. Example: { x:100, enableTransitions:false } |
| # Licensed under MIT. | |
| # Copyright (2016) by Kevin van Zonneveld https://twitter.com/kvz | |
| # | |
| # This Makefile offers convience shortcuts into any Node.js project that utilizes npm scripts. | |
| # It functions as a wrapper around the actual listed in `package.json` | |
| # So instead of typing: | |
| # | |
| # $ npm script build:assets | |
| # | |
| # you could just as well type: |
| package net.tixxit.levenshtein | |
| import scala.math.min | |
| object EditDistance { | |
| def editDist[A](a: Iterable[A], b: Iterable[A]) = | |
| ((0 to b.size).toList /: a)((prev, x) => | |
| (prev zip prev.tail zip b).scanLeft(prev.head + 1) { | |
| case (h, ((d, v), y)) => min(min(h + 1, v + 1), d + (if (x == y) 0 else 1)) | |
| }) last |
| function getTrilateration(position1, position2, position3) { | |
| var xa = position1.x; | |
| var ya = position1.y; | |
| var xb = position2.x; | |
| var yb = position2.y; | |
| var xc = position3.x; | |
| var yc = position3.y; | |
| var ra = position1.distance; | |
| var rb = position2.distance; | |
| var rc = position3.distance; |
| BIN = ./node_modules/.bin | |
| SRC = $(wildcard src/*.coffee) | |
| LIB = $(SRC:src/%.coffee=lib/%.js) | |
| build: $(LIB) | |
| lib/%.js: src/%.coffee | |
| @mkdir -p $(@D) | |
| @$(BIN)/coffee -bcp $< > $@ |
| /** | |
| * Author: Michael Weibel <michael.weibel@gmail.com> | |
| * License: MIT | |
| */ | |
| var passport = require('passport') | |
| , StrategyMock = require('./strategy-mock'); | |
| module.exports = function(app, options) { | |
| // create your verify function on your own -- should do similar things as |
#Mac OS X