This file contains hidden or 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
randomID = function(a,b) { | |
b=b||16; | |
return Array(a||32).join(0).replace(/0/g,function(){return(0|Math.random()*b).toString(b)}); | |
} |
This file contains hidden or 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
#!/usr/bin/env node | |
/** | |
npm install cheerio request step | |
chmod +x urlparser.js | |
./urlparser.js | |
*/ | |
var cheerio = require('cheerio') | |
, request = require('request') |
This file contains hidden or 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 request = require('request'); | |
var cheerio = require('cheerio'); | |
var fs = require('fs'); | |
var step =require('step'); | |
step( | |
function readUrl(){ | |
console.log("readUrl") |
This file contains hidden or 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 html = (function () {/* | |
<!DOCTYPE html> | |
<html> | |
<body> | |
<h1>Hello, world!</h1> | |
</body> | |
</html> | |
*/}).toString().match(/[^]*\/\*([^]*)\*\/\}$/)[1]; |
This file contains hidden or 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 log = function(){ | |
if(location.href.indexOf("debug_messi=1") > -1 ){ | |
var arg = $.makeArray(arguments); | |
arg.unshift("["+MODULE_NAME+"]"); | |
console.log.apply(console, arg); | |
} | |
}; |
This file contains hidden or 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 CssFilterSupport = { | |
checkSupport : function(testCase){ | |
return window.CSS && _.isFunction(CSS.supports) && (CSS.supports("-webkit-filter", testCase) || CSS.supports("filter", testCase)); | |
}, | |
blur : function(){ | |
return this.checkSupport("blur(10px)"); | |
}, |
This file contains hidden or 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://jsperf.com/new-vs-object-create-including-polyfill | |
if (typeof Object.create !== 'function') { | |
Object.create = function(o, props) { | |
function F() {} | |
F.prototype = o; | |
if (typeof(props) === "object") { | |
for (prop in props) { | |
if (props.hasOwnProperty((prop))) { | |
F[prop] = props[prop]; |
This file contains hidden or 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 myModule = angular.module(...); | |
myModule.directive('directiveName', function (injectables) { | |
return { | |
restrict: 'A', | |
template: '<div></div>', | |
templateUrl: 'directive.html', | |
replace: false, | |
priority: 0, | |
transclude: false, |
This file contains hidden or 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
function toast (msg) { | |
$('.toast').remove(); | |
$("<div class='toast'><h3>" + msg + "</h3></div>") | |
.css({ | |
display: "block", | |
opacity: 0.8, | |
position: "fixed", | |
padding: "7px", | |
"text-align": "center", | |
width: "270px", |