Skip to content

Instantly share code, notes, and snippets.

request = (body,callback) ->
alert( body.toSource() )
class Robot
http: (url) ->
httpClient = {}
methods = [ 'get', 'post', 'put', 'del', 'head' ]
methods.forEach (method) ->
httpClient[ method ] = (body,callback) ->
request( {
@stubbetje
stubbetje / gist:b45b173ec10a5bc26d4a
Last active August 29, 2015 14:01
Calling COBOL from C with variable arguments
#include <stdio.h>
#include <stdarg.h>
/*
COBOL will be calling the function like this:
CALL "calling_c" USING BY REFERENCE
"d" & x"00"
"FOO" & x"00" WS-DEPTH-1 *> ws-depth-1 and ws-depth-2 are PIC 9(4) COMP-5
"BAR" & x"00" WS-DEPTH-2

Keybase proof

I hereby claim:

  • I am stubbetje on github.
  • I am stubbetje (https://keybase.io/stubbetje) on keybase.
  • I have a public key whose fingerprint is B20F 9E66 AD99 6AE0 27F3 5343 1D40 0EBE 161B A202

To claim this, I am signing this object:

@stubbetje
stubbetje / README.md
Last active August 29, 2015 14:13
script_path -- portable `readlink -f`

(source: ValveSoftware/steam-for-linux#3671 (comment))

@TcM1911 Determining the path of the script being invoked, in a fully portable (w.r.t. platforms) and completely reliable manner, even in the face of symlinks, is a tricky problem and all too easy to get wrong. The only bullet proof way of doing it, of which I'm aware, is provided below (assumes bash); could be prepended to any script needing this functionality.

tree file 4: 17679000 records
btree file 4: 17680000 records
btree file 4: 17681000 records
btree file 4: 17682000 records
btree file 4: 17683000 records
btree file 4: 17684000 records
btree file 4: 17685000 records
btree file 4: 17686000 records
btree file 4: 17687000 records
btree file 4: 17688000 records
@stubbetje
stubbetje / pretty_shell.sh
Created April 23, 2009 08:20
show git branch and dirty state in bash prompt
#!/bin/bash
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/';
}
parse_git_dirty() {
[[ ! $(git status) =~ "nothing to commit (working directory clean" ]] && echo " ⚡ "
}
export PS1='\[\033[01;30m\] [$(parse_git_branch)\[\033[01;33m\]$(parse_git_dirty)\[\033[01;30m] \[\033[00m\]'$PS1
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
BLUE="\[\033[0;34m\]"
LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
WHITE="\[\033[1;37m\]"
LIGHT_GRAY="\[\033[0;37m\]"
COLOR_NONE="\[\e[0m\]"
<?php
/**
* simpele gradient image adhv GET parameters
*
* @author Stefan Stubbe
*/
// default settings definiëren
$defaults = array(
@stubbetje
stubbetje / autorun.php
Created September 4, 2009 21:56
autorun.php: run a command on file modifications
#!/usr/bin/env php
<?php
/* original version can be found at https://gist.github.com/181172 */
if( ! function_exists( 'inotify_init' ) ) {
die_with_error( 'This script needs the inotify module' );
}
$excludePatterns = array(
@stubbetje
stubbetje / SplClassLoader.php
Created November 11, 2009 09:12 — forked from jwage/SplClassLoader.php
SplClassLoader
<?php
/**
* SplClassLoader implementation that implements the technical interoperability
* standards for PHP 5.3 namespaces and class names.
*
* http://groups.google.com/group/php-standards/web/final-proposal
*
* // Example which loads classes for the Doctrine Common package in the
* // Doctrine\Common namespace.