Skip to content

Instantly share code, notes, and snippets.

"processors": {
"coffee": {"cmd": "coffee -c {input}", "nextExt": "js"},
"js": {"cmd": "cat", "nextExt": "js1"},
"js1": {"cmd": "cat", "nextExt": "js2"},
"js2": {"cmd": "cat", "nextExt": "js3"},
"js3": {"cmd": "cat", "nextExt": "js4"},
"js4": {"cmd": "cat", "nextExt": "js5"},
"js5": {"cmd": "java -Xmx200m -Xms50m -Xincgc -jar testdir/yuicompressor-2.4.7.jar {input} -o {output}", "outputType": "js"}
}
var exec = require('child_process').exec
, fs = require('fs');
var escapeShell = function(cmd) {
return '"'+cmd.replace(/(["\s'$`\\])/g,'\\$1')+'"';
};
@axiak
axiak / x.js
Created April 20, 2012 21:02
x.js
var _ = require('underscore');
config = {
'compiled_cache_dir': '../css/tmp',
'processors': {
'js': 'java -jar YUICompressor.jar {input}',
'coffee': ['coffee -c {input} {output}', 'js'],
'less': ['lessc', 'css']
},
inverse = function (f, lower = -100, upper = 100) {
function (y) uniroot((function (x) f(x) - y), lower = lower, upper = upper)[1]
}
cdf = function (f) {
function (upper) integrate(f, 0.01, upper).value
}
f = 0.453 * exp(-1.036x) * sinh(sqrt(2.29x))
#!/usr/bin/env python2.7
import remote_webkit_debug
chrome = remote_webkit_debug.ChromeShell()
tab = chrome.pick_tab([
tab for tab in chrome.get_tabs()
if 'webSocketDebuggerUrl' in tab][0])
tab.send_command('Runtime.evaluate',
expression='window.location = window.location;',
@axiak
axiak / http-newline-arc.diff
Created March 18, 2012 15:18
Fixes invalid newline usage for HTTP responses in arc
--- /a/srv.arc 2009-06-29 12:54:11.000000000 -0400
+++ /b/srv.arc 2012-03-18 10:50:17.903238925 -0400
@@ -134,11 +134,11 @@
(if srv-noisy* (pr c))
(-- n)
(push c line))
- (if srv-noisy* (pr "\n\n"))
+ (if srv-noisy* (pr "\r\n\r\n"))
(respond o op (+ (parseargs (string (rev line))) args) cooks ip))))
@axiak
axiak / pybrainmilk.py
Created March 17, 2012 19:24
pybrain milk
# Michael Axiak <[email protected]>
import numpy as np
from milk.supervised.base import supervised_model
def _label_to_map(label, labelMap):
val = np.ndarray(len(labelMap))
val[labelMap[label]] = 1
return val
def _label_from_map(i, labelMap):
asdf
select distinct
<include refid="t_fact_columns_fragment" />
from
t_fact fct,
t_location_fact locf,
t_user_location uloc,
t_location loc
where
fct.fact_pk = locf.fact_pk and
loc.location_id = locf.location_id and
def decode_google_polyline(encoded):
"""
Decode a google polyline string into a list of coordinates.
See http://code.google.com/apis/maps/documentation/utilities/polylinealgorithm.html
"""
raw_numbers = [ord(c) - 63 for c in encoded[::-1]]
current_number = 0
sequence = []