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
var _ = require('lodash'); | |
var $ = require('jquery'); | |
var apis = { | |
main: '/api/v1/', | |
tracker: '/tracking/v1/', | |
}; | |
/** | |
* Default data sent with every request; |
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
// dependencies: underscore beceause of "_.each, _.keys" could be Array.forEach etc. | |
/** | |
* Wrap function inside try catch; unified try/catch | |
* @param f {function} function to wrap | |
* @param info {object} information to be passed in case of failure | |
* @return {function} new function which contains old one engulfed inside try/catch | |
*/ | |
function tryCatchWrap (f, info) { | |
var args = arguments; |
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
* { | |
font-size: 12pt; | |
font-family: monospace; | |
font-weight: normal; | |
font-style: normal; | |
text-decoration: none; | |
color: black; | |
cursor: default; | |
} |
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
// Set max string length and charset for generating combinations | |
$maxLength = 3; | |
$charSet = 'abcdph'; | |
$size = strlen($charSet); | |
function initBase ($init, $set) { | |
$initBase = str_split(strrev($init)); | |
$positions = array(); | |
foreach ($initBase as $letter) { | |
if ( strpos($set, $letter ) === false) { |
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
// As heard on "Chroma Zone" talk by Lea Verou | |
// Explanation @ http://www.w3.org/TR/2014/NOTE-WCAG20-TECHS-20140311/G18 | |
// @color - [r,g,b] | |
function luminance (color) { | |
var rgb = color.map(function(c){ | |
c /= 255; // to 0-1 range | |
return c < .03928 ? | |
c / 12.92 : | |
Math.pow((c+.055)/1.055, 2.4); |
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
<?php | |
/** | |
This is a simple proof of concept of a brute force algorithm for string matching with | |
given set of characters. | |
The way this works is that the algorithm counts from first to last possible combination of | |
given characters. Instead of counting(incrementing) in number base 10 we use | |
a new base which is derived from your set of possible characters (we count in symbols). | |
So if your characters list contains 27 characters the program actually counts in a 27 base | |
number system. |
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
/** | |
This is a simple proof of concept of a brute force algorithm for string matching with | |
given set of characters. | |
The way this works is that the algorithm counts from first to last possible combination of | |
given characters. Instead of counting(incrementing) in number base 10 we use | |
a new base which is derived from your set of possible characters (we count in symbols). | |
So if your characters list contains 27 characters the program actually counts in a 27 base | |
number system. | |
Author: Luka Vidaković |
NewerOlder