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 ply = function (raw) { | |
this.raw = raw; | |
this.parse(); | |
}; | |
ply.prototype.regex = { | |
newline: /\n/, | |
space: /\s+/, | |
leadspace: /^\s+/, | |
trailspace: /\s+$/, |
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
//TODO: add object checks | |
searchTree function (node, getChildren, test) { | |
function find (node, parent) { | |
var kids = getChildren(node), i, ret = null; | |
if (test(node)) { return { parent: parent, match: node }; } | |
if (kids.length < 1) { return null; } | |
for (i=0; i<kids.length; i++) { | |
ret = find(kids[i], node); | |
if (ret) { return ret; } |
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
(function () { | |
var w = window | |
, d = document | |
, b = d.body | |
, h = d.getElementsByTagName('head')[0] | |
, s = d.getElementsByTagName('script') | |
, c = {} // cache | |
, m // main | |
, i // iter | |
, x = /\.js$/ |
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 D = document | |
, body = D.body | |
, canvas = D.body.appendChild(D.createElement('canvas')) | |
, ctx = canvas.getContext('2d') | |
, width = 480 | |
, height = 272 | |
; | |
function vendorStyle (ele, prop, val) { | |
var caps = prop.charAt(0).toUpperCase() + prop.slice(1) |
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 d=document,b=d.body,e=d.querySelectorAll('*');s=d.createElement('style');j=d.createElement('script');j.src='http://is.gd/rbowjs';s.type='text/css';j.onload=function(){s.appendChild(d.createTextNode(rainb))};b.appendChild(s);b.appendChild(j);for(i in e){e[i].className+=' catchadream'}; |
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
(function(){var t=function(r){var n,a=[],w=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,false);while(n=w.nextNode()) a.push(n);return a;},i,n=t(document.body); for(i=0;i<n.length;i++) n[i].nodeValue=n[i].nodeValue.replace(/fuck/ig,'Praise');})() |
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
-- convert file to base64 | |
openssl base64 -in square.png | tr -d '\n' | pbcopy |
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
function flatter (obj, match, replaceWhat, replaceWith) { | |
var replace = (replaceWhat && replaceWhat instanceof RegExp && typeof replaceWith === 'string') | |
, tmp = null // description - a tmp variable | |
; | |
function getJuicyObject (obj) { | |
var children = {} | |
, juicyChildren = {} | |
; |
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
doSomethingGood() | |
.then(function (tree) { | |
// filter and print members with indentation, par example | |
return execObj(tree, { | |
exec: function (obj, opts) { | |
var attrs = obj.someAttrArray; | |
if (attrs) { | |
attrs = attrs.filter(function (item) { | |
return attr.type.match(/wicked|bitchin/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
curl http://freegeoip.net/json/ | node -e "d='';s=process.stdin;o=process.stdout;j=JSON;s.on('data',function(c){d+=c;});s.on('end',function(){d=j.parse(d); console.log(j.stringify(d,null,30))});" |