Skip to content

Instantly share code, notes, and snippets.

View walm's full-sized avatar

Andreas Wålm walm

  • Sweden
View GitHub Profile
@walm
walm / gist:917334
Created April 13, 2011 10:36
JooseX triggers on attributes in before/after for class in initialize
initialize : function ( props ) {
var self = this;
var triggerCallback = function ( newValue, oldValue ) {
var attribute = this;
if ( !attribute.isChanged ) {
attribute.isChanged = newValue != oldValue;
}
}
/**
* class JooseX.Attribute.Dirty
*
* Add _isDirty_ property if an attribute has been changed with setter method.
*
**/
Role('JooseX.Attribute.Dirty', {
override : {
@walm
walm / couchdb-ec2-install.sh
Created August 25, 2011 19:15 — forked from msmith/couchdb-ec2-install.sh
Set up CouchDB on EC2
#!/bin/bash
#
# This script installs and configures couchdb on a fresh Amazon Linux AMI instance.
#
# Must be run with root privileges
# Tested with Amazon Linux AMI release 2011.02.1.1 (ami-8c1fece5)
#
export BUILD_DIR="$PWD"
class Beans
from : [ 'Central America', 'South America', 'East Africa' ]
brand : 'Gevalia'
name : 'Ebony'
class Coffee extends Beans
sugar : no
milk : no
people = [ 'Andreas', 'Sofia' ]
@walm
walm / AppDelegate.h
Created September 16, 2011 22:15
Forward scrollToTop event to webview in PhoneGap iOS
// add UIScrollViewDelegate
@interface AppDelegate : PhoneGapDelegate <UIScrollViewDelegate>
@walm
walm / gist:1267322
Created October 6, 2011 12:54
Replace *.jpg.jpg to *.jpg in zsh
for file in `ls *.jpg.jpg`; do mv $file $file:gs/.jpg.jpg/.jpg/; done
@walm
walm / Cakefile
Created November 30, 2011 15:16
Restart Coffee server on file change
fs = require 'fs'
log = console.log
spawn = require('child_process').spawn
task 'server', 'Start server.coffee and restart on file change', ->
log "Starting server, kill with Ctrl-c"
server = spawn "coffee", ["server.coffee"]
server.stdout.on "data", (data) ->
log "#{data}"
@walm
walm / install-update.sh
Created December 1, 2011 10:10
Install and update nginx with tcp_proxy on EC2 fedora amzn-ami
sudo yum install git nginx pcre-devel libxml2-devel libxslt-devel gd-devel geoip-devel
curl -O http://nginx.org/download/nginx-1.0.4.tar.gz
git clone git://github.com/yaoweibin/nginx_tcp_proxy_module
tar zxf nginx-1.0.4.tar.gz
cd nginx-1.0.4/
patch -p1 < ../nginx_tcp_proxy_module/tcp.patch
./configure --add-module=../nginx_tcp_proxy_module/ --user=nginx --group=nginx --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/var/run/nginx.pid --lock-path=/var/lock/subsys/nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_image_filter_module --with-http_geoip_module --wi
nameserver 127.0.0.1
port 20560
@walm
walm / gist:2251168
Created March 30, 2012 12:29
Simple git.io tool (GitHub URL shortener)
#!/bin/sh
URL=`curl -i http://git.io -F "url=$1" | grep Location | sed -e 's/Location: //g'`
echo "$URL" | pbcopy
echo "$URL"