Skip to content

Instantly share code, notes, and snippets.

View leeoniya's full-sized avatar
😕
shaving bytes and milliseconds. dependencies: {}

Leon Sorokin leeoniya

😕
shaving bytes and milliseconds. dependencies: {}
View GitHub Profile
@leeoniya
leeoniya / po_box_re.js
Created April 1, 2011 23:17
leon's p.o. box detection regex
// leon's p.o. box detection regex
// for better results, trim and compress whitespace first
var pobox_re = /^box[^a-z]|(p[-. ]?o.?[- ]?|post office )b(.|ox)/i,
arr = [
"po box",
"p.o.b.",
"p.o. box",
"po-box",
"p.o.-box",
@leeoniya
leeoniya / json_csv_ideas.js
Created June 17, 2011 19:32
better-than-json recordset passing
(function() {
// mimicing php's array_combine()
function combine(a, b) {
var i, o = {};
for (i in a)
o[a[i]] = b[i];
return o;
}
@leeoniya
leeoniya / README
Created August 12, 2011 18:13 — forked from joelambert/README
Drop in replacements for setTimeout()/setInterval() that makes use of requestAnimationFrame() where possible for better performance
Drop in replace functions for setTimeout() & setInterval() that
make use of requestAnimationFrame() for performance where available
http://www.joelambert.co.uk
Copyright 2011, Joe Lambert.
Free to use under the MIT license.
http://www.opensource.org/licenses/mit-license.php
@leeoniya
leeoniya / gist:1379476
Created November 19, 2011 22:42
testing markdown
#markdown!
@leeoniya
leeoniya / gist:1379478
Created November 19, 2011 22:42
testing markdown

GitHub Flavored Markdown

View the source of this content.

Let's get the whole "linebreak" thing out of the way. The next paragraph contains two phrases separated by a single newline character:

Roses are red Violets are blue

@leeoniya
leeoniya / hackernews.css
Created November 9, 2012 23:36
hackernews w/max-width
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document domain("news.ycombinator.com"){
body > center > table {
max-width: 1000px;
}
.default {
padding-right: 30px;
text-align: justify;
}

The following options are also supported:

  • -c, --stdout......... Write output to standard output
  • -d, --debug........... Write only the debug output
  • -h, --help............. Display help information
  • -m, --minify......... Write only the minified output
  • -o, --output......... Write output to a given path/filename
  • -p, --source-map.. Generate a source map for the minified output
  • -s, --silent......... Skip status updates normally logged to the console
  • -V, --version....... Output current version of Lo-Dash
@leeoniya
leeoniya / stable-sort-test.js
Created June 19, 2013 18:09
test if js engine's Array#sort implementation is stable
// test if js engine's Array#sort implementation is stable
var str = "abcdefghijklmnopqrstuvwxyz";
str.split("").sort(function(a,b) {
return ~~(str.indexOf(b)/2.3) - ~~(str.indexOf(a)/2.3);
}).join("") == "xyzvwtursopqmnklhijfgdeabc";