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 / 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;
}
@leeoniya
leeoniya / gist:e0403dd6c82ae0d2fe17
Last active October 24, 2015 06:08
domChanger wrapped components
```html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>DomChanger External Data</title>
</head>
<body>
<script src="../domchanger.js"></script>
<script>

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 / gist:6022090
Created July 17, 2013 16:18
jquery, promise-based multi-image loader
$.getImgs = function(srcs, fn) {
var jqry = this,
dfds = [],
prms = [];
jqry.each(srcs, function(i, src) {
var img = new Image(),
dfd = jqry.Deferred();
dfds.push(dfd);
@leeoniya
leeoniya / tcp-pool-proxy.js
Created October 14, 2013 16:28
TCP pooling proxy for Node.js
var net = require('net');
function TcpPool() {
this.socks = {};
}
TcpPool.prototype.send = function(host, port, endpt, data, respFn) {
var pool = this,
str = "tcp://" + host + ":" + port + endpt;
@leeoniya
leeoniya / gist:7258777
Created October 31, 2013 23:17
prevent portable Firefox installs from scanning the local system's plugins and extensions
// with Firefox closed, add these to your prefs.js file, restart Firefox
user_pref("extensions.enabledScopes", 5);
user_pref("plugin.scan.4xPluginFolder", false);
user_pref("plugin.scan.Acrobat", "100");
user_pref("plugin.scan.Quicktime", "100");
user_pref("plugin.scan.WindowsMediaPlayer", "100");
user_pref("plugin.scan.plid.all", false);
@leeoniya
leeoniya / domvm_techcrunch_test.html
Last active January 25, 2016 04:21
domvm render benchmark
<html>
<head>
<title>domvm real-world render bench</title>
<script>
/*
How to use
----------
0. Use a browser that doesnt truncate huge strings in the console. (recent Chrome doesnt)
1. Paste and execute the script in this comment into the console of any web page.
2. Copy/Paste the resulting template into the `tpl` variable of the body script below
/*
https://github.com/leeoniya/domvm (1.x-dev)
*/
("undefined"!==typeof global?global:this).domvm={};(function(v){var y=("undefined"==typeof window?{}:window).requestAnimationFrame,z={animationIterationCount:!0,boxFlex:!0,boxFlexGroup:!0,columnCount:!0,counterIncrement:!0,fillOpacity:!0,flex:!0,flexGrow:!0,flexOrder:!0,flexPositive:!0,flexShrink:!0,"float":!0,fontWeight:!0,gridColumn:!0,lineHeight:!0,lineClamp:!0,opacity:!0,order:!0,orphans:!0,stopOpacity:!0,strokeDashoffset:!0,strokeOpacity:!0,strokeWidth:!0,tabSize:!0,transform:!0,transformOrigin:!0,widows:!0,zIndex:!0,zoom:!0},u={TYPE_ELEM:1,
TYPE_TEXT:2,isArr:function(c){return c instanceof Array},isVal:function(c){c=typeof c;return"string"===c||"number"===c},isObj:function(c){return"object"===typeof c&&null!==c&&!u.isArr(c)},isFunc:function(c){return"function"===typeof c},isProm:function(c){return"object"===typeof c&&u.isFunc(c.then)},isElem:function(c){return c instanceof HTMLElement},execAll:function(c,g,q,r,t,x){var w;c&&(u.isArr(c)?c:[c]).forEach(fu
function Dashboard (vm) {
return function () {
return ['#dash',
[Chart, { interval: 2500, line_width: 3 }, 0],
[Chart, { interval: 5000, line_width: 8 }, 1],
[Chart, { interval: 60000, line_width: 2 }, 2],
[Chart, { interval: 20000, line_width: 1 }, 3],
]
}
}
var domvm = require('./domvm.full.min.js');
var el = domvm.defineElement,
vw = domvm.defineView;
function mkArr(count, fn, frag) {
let i = 0, arr = [];
while (i < count)
frag ? arr.push.apply(arr, fn(i++)) : arr.push(fn(i++));