Skip to content

Instantly share code, notes, and snippets.

View kirkegaard's full-sized avatar

Christian Kirkegaard kirkegaard

View GitHub Profile
var currentPath;
walker.on('directories', function(root, dsa, next) {
currentPath = root;
next();
});
walker.on('file', function(root, fss, next) {
if(fss.name.charAt(0) == '.') {
return next();
@kirkegaard
kirkegaard / spark.php
Created November 15, 2011 19:17
holmans spark in php
#!/usr/bin/env php
<?php
$ticks = array('▁','▂','▃','▄','▅','▆','▇');
$args = explode(',', (($argv[1] == '--stdin') ? fgets(fopen('php://stdin', 'r'), 1024) : $argv[1]));
$range = (max($args) - min($args)) + 1;
array_map(function($val) use ($ticks, $args, $range) {
print $ticks[round((($val - min($args)) / $range) * (count($ticks) - 1))];
}, $args);
print "\n";
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import os
search = ['æ', 'ø', 'å', 'Æ', 'Ø', 'Å', ' ', '/']
replace = ['ae', 'oe', 'aa', 'Ae', 'Oe', 'Aa', '_', '_']
for f in os.listdir('.'):
of = f
<?php
class upload
public function save()
{
$input = fopen("php://input", "r");
$tmp = tmpfile();
$rs = stream_copy_to_stream($input, $tmp);
fclose($input);
return true;
<?php
class myclass {
protected function foo() {
return function() {
$result = $this->bar();
return $result;
}
}
~/Development/renderrender > node fsevent.js
1466297099 | 0 : /Users/christian/Desktop/RENDER/BILKA_Progressiv/
1466297196 | 0 : /Users/christian/Desktop/RENDER/BILKA_Progressiv/
1466297208 | 0 : /Users/christian/Desktop/RENDER/BILKA_Progressiv/
@kirkegaard
kirkegaard / reddit.com.js
Created August 1, 2011 07:53
.js addition to open all links on a page. Great for surfing /r/pics
$('<a>').attr('href', '#')
.html('Open all links')
.bind('click', function() {
var links = $('a.title');
links.each(function() {
window.open($(this).attr('href'));
});
})
.appendTo('ul.tabmenu')
.wrap('<li>');
@kirkegaard
kirkegaard / sync.rb
Created July 19, 2011 00:18
quick and dirty rsync backup script in ruby
#!/usr/bin/env ruby
require 'colored'
dest = '/Volumes/Drobo/BACKUP/'
logfile = '.sync/log'
folders = [
'~/Development',
'~/Documents',
'~/Pictures',
'~/Music',