This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::io::net; | |
use std::io::net::ip::{Port, SocketAddr}; | |
use std::io::TcpStream; | |
use std::kinds::marker::NoCopy; | |
enum Client { | |
Connected(ConnectedClient), | |
Disconnected(DisconnectedClient) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let fieldAliases: [String: String] = | |
[ | |
"SCMActionConfirmed" : "confirmed", | |
"SCMAmount" : "amount", | |
"SCMBrand" : "brand", | |
"SCMCategory" : "category", | |
"SCMCurrency" : "currency", | |
"SCMDescription" : "description", | |
"SCMProductID" : "identifier", | |
"SCMProductImageURL" : "photo", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- problem 31 | |
primes :: [Int] | |
primes = nextPrime [2..] | |
where nextPrime (p:xs) = p:nextPrime [x | x <- xs, x `mod` p > 0] | |
-- problem 35 | |
primeFactors :: Int -> [Int] | |
primeFactors n = [ x | x <- (takeWhile (< n) primes), n `mod` x == 0 ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { levenshtein, fuzzyMatch } from './utils.js'; | |
import Words from './database-all-words'; | |
const search = function( event ) | |
{ | |
const query = event.target.value.toLowerCase().trim(); | |
const words = Words.getAll(); | |
if ( query ) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default class Collection | |
{ | |
constructor( { collection=[], shouldUpdateBeforeRender=false, shouldUpdateAfterRender=false } ) | |
{ | |
this._collection = collection; | |
this._shouldUpdateBeforeRender = shouldUpdateBeforeRender; | |
this._shouldUpdateAfterRender = shouldUpdateAfterRender; | |
} | |
// blah blah custom methods | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- zcat 2015/07/0723*trace* | | |
-- grep -o "__id.*duration_..__" | | |
-- sed 's/__*\|id\|duration/ /g' | | |
-- sed 's/^ *\| *$//g' | | |
-- sed 's/ */ /' | | |
-- nawk '{ | |
-- max[$1] = !($1 in max) ? $2 : ($2 > max[$1]) ? $2 : max[$1] | |
-- } END { | |
-- for (i in max) | |
-- print i, max[i] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// go to the proper iframe in the console, should be something like: | |
// 'collection-app-spotify'... | |
// run that | |
[].map.call(document.querySelectorAll( 'div.list-group>.list-group-item-media.playable'), function(list){ | |
return list.getAttribute('data-uri') | |
} ); | |
// copy all these links in http://resp.in/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://blog.nishtahir.com/2015/09/19/fuzzy-string-matching-using-cosine-similarity/ | |
'use strict'; | |
Set.intersection = function*( set1, set2 ) | |
{ | |
for ( let value of set1.values() ) | |
{ | |
if ( set2.has( value ) ) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getNumberFromCss = ( rules, cssName ) => parseInt( rules[cssName], 10 ); | |
export const makeDraggable = ( element ) => | |
{ | |
const initial = | |
{ | |
x : null, | |
y : null, | |
top : null, | |
right : null |
OlderNewer