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 / 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 / gist:11271144
Created April 24, 2014 22:07
address2 stripper
(?:(SPC|SUITE|STE|APT|UNIT|BLDG|FLOOR|FL|ROOM|RM|DEPT)\b\.?\s*#? ?[0-9A-Z]+|\s+# ?[0-9A-Z-]+)$

Use Linode's DNS Manager API for one-line dynamic DNS

This can be useful for cron, for instance.

Prereqs

  • You are using Linode's DNS Manager to manage a zone for your domain
  • You have already created an A record for the name you want to make dynamic
  • You have an API key for Linode's API
  • curl and jsonpp (jsonpp is not necessary but makes the manual steps easier)
@leeoniya
leeoniya / snowden-ietf93.md
Last active September 8, 2015 04:26 — forked from mnot/snowden-ietf93.md
Transcript of Edward Snowden's comments at IETF93.
@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>
@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],
]
}
}