Skip to content

Instantly share code, notes, and snippets.

View jsjohnst's full-sized avatar

Jeremy Johnstone jsjohnst

View GitHub Profile
@jsjohnst
jsjohnst / gist:68444
Created February 22, 2009 11:50
Bringing all the awesomeness of VI to the bash command prompt
set -o vi
# Goto begin of line
bind -m vi-command C-a:vi-insert-beg
bind -m vi-insert C-a:vi-insert-beg
# Goto end of line
bind -m vi-command C-e:vi-append-eol
bind -m vi-insert C-e:vi-append-eol
@jsjohnst
jsjohnst / gist:68455
Created February 22, 2009 12:47
Bash profile options for color and vi mode
# useful general .bash_profile tweaks for color loving VI fans
export TERM=xterm-color
export GREP_OPTIONS='--color=auto' GREP_COLOR='1;36'
export CLICOLOR=1
alias ls='ls -G'
export LS_COLORS='di=1:fi=0:ln=31:pi=5:so=5:bd=5:cd=5:or=31:mi=0:ex=35:*.rb=90'
export COLOR_NC='\e[0m' # No Color
export COLOR_WHITE='\e[1;37m'
export COLOR_BLACK='\e[0;30m'
#!/bin/bash
while true; do
result=`curl -Is http://developer.apple.com/iphone/ | grep Location | grep comebacksoon`;
if [ x = "x$result" ]; then
echo "Yeah!";
exit;
fi;
sleep 30;
done;
<?php
class base58
{
static public $alphabet = "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ";
public static function encode($int) {
$base58_string = "";
$base = strlen(self::$alphabet);
while($int >= $base) {
http://msdn.microsoft.com/en-us/library/dd633667.aspx
http://msdn.microsoft.com/en-us/library/exchangewebservices.calendaritemupdateoperationtype.aspx
<?php
abstract class write_once_class
{
function __get($key) {
if(property_exists(get_class($this), $key)) {
return $this->$key;
} else {
throw new Exception("Can't get a variable which isn't declared.");
}
/***
* @class KONtx.FOO
* @description
This is a description of class FOO.
Isn't it such a grand description.
FML!
* @end
* @example
var foo = new KONtx.FOO();
foo.bar();
def collatz(order)
loops = 0
i = rand(10**order)
while i > 1
if i % 2 == 0
i = i / 2
else
i = i * 3 + 1
end
loops+=1
var D=new function(){var t=this,f='ShockwaveFlash',s=f+'.'+f,w=function(o){try{t.v=o.GetVariable("$version")}catch(e){}},r=[[s+'.7',w],[s+'.6',function(o){t.v='6,0,21'
try{o.AllowScriptAccess='always';w(o)}catch(e){}}],[s,w]],n=navigator,p=n.plugins,e='enabledPlugin',d='description',i=0
t.i=0;t.v=-1
t.D=function(){if(p&&p.length>0){var a='application/x-shockwave-flash',m=n.mimeTypes
if(m&&m[a]&&m[a][e]&&m[a][e][d]){t.v=m[a][e][d];t.i=1}}else
if(n.appVersion.indexOf('Mac')==-1&&window.execScript){for(;i<r.length&&t.v==-1;i++){try{r[i][1](new ActiveXObject(r[i][0]));t.i=1}catch(e){}}}}()};
var SnippetView = new KONtx.Class({
ClassName: 'SnippetView',
Extends: KONtx.system.AnchorSnippetView,
createView: function() {
this.controls.text = new KONtx.element.Text({
label: $_('Snippet.Text'),
styles: {