Skip to content

Instantly share code, notes, and snippets.

View fsvehla's full-sized avatar

Ferdinand Svehla fsvehla

View GitHub Profile
def call(source, request)
if request.ssl?
case
when javascript_file?(source)
ssl_asset_host(source)
when safari?(request)
asset_host(source)
when firefox?(request) && image_file?(source)
asset_host(source)
else
Disk Test 142.12
Sequential 101.67
Uncached Write 41.85 25.69 MB/sec [4K blocks]
Uncached Write 194.92 110.29 MB/sec [256K blocks]
Uncached Read 128.17 37.51 MB/sec [4K blocks]
Uncached Read 397.72 199.89 MB/sec [256K blocks]
Random 236.04
Uncached Write 126.44 13.38 MB/sec [4K blocks]
Uncached Write 143.38 45.90 MB/sec [256K blocks]
Uncached Read 2413.15 17.10 MB/sec [4K blocks]
1 def nodeunit(*files)
2 system "bin/nodeunit #{ files.join(' ') }"
3 end
4
5 watch("test/unit/.*") do |match|
6 nodeunit match[0]
7 end
8
9 # Run unit tests by default
10
switch(request.responseStatusCode) {
case 200:
SBJsonParser *jsonParser = [[[SBJsonParser alloc] init] autorelease];
NSDictionary *dictionary = [jsonParser objectWithString: [request responseString]];
#!/bin/bash
# Cronic v2 - cron job report wrapper
# Copyright 2007 Chuck Houpt. No rights reserved, whatsoever.
# Public Domain CC0: http://creativecommons.org/publicdomain/zero/1.0/
set -eu
OUT=/tmp/cronic.out.$$
ERR=/tmp/cronic.err.$$
for(idx = 0; idx < 8; idx++) {
var callback = function () {
var index = idx;
return function() {
console.log(index);
}
}();
setTimeout(callback, 5);
for(idx = 0; idx < 8; idx++) {
with({index: idx}) {
setTimeout(function() { console.log([idx, index]) }, 5);
}
}
@fsvehla
fsvehla / faxonline-send.php
Created August 12, 2011 11:42
Faxonline API PHP Sample: Sending
<?php
$login = 'xxxxxxxx'; /* Username */
$password = 'xxxxxxxx'; /* Password */
$path = 'Test.pdf'; /* Path to file */
$recipient = '+43125330331115'; /* Recipient */
$handle = curl_init();
$url = 'https://' . $login . ':' . $password . '@faxonline.at/api-v1/faxes.json';
spinOptions =
lines: 12
length: 4
width: 2
radius: 4
color: '#333'
fadeInTime = 400
minTime = 400
fadeOutTime = 600
var parseResponseCookies = function (response) {
var Cookie = function (cookieString) {
var fields = cookieString.split(/; ?/).map(function (item) {
return item.split('=');
});
var metadata = fields.reduce(function (prev, curr) {
prev[curr[0]] = curr[1];
return prev;
}, {});