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 / AppDelegate.m
Created May 1, 2012 06:55
PERSISTENT LOCALSTORAGE NATIVE SOLUTION for phonegap (fork of http://pastebin.com/5881768B)
/*
*
* PERSISTENT LOCALSTORAGE NATIVE SOLUTION for phonegap (tested on 1.3)
* iOS 5.1 puts LocalStorage in a vulnerable location (Libary/Caches). This will copy it to
* the documents folder as "appdata.db" so that it will be appropriately backed-up and not
* overwritten. If "appdata.db" doesn't exist, localStorage will not be overwritten.
* Also, upon application suspend (resignActive) or termination, localStorage is saved, so
* there should not be any chance that changes to localStorage won't be persisted. [[ short of a power-cycle ]]
*
* The following should be placed in AppDelegate.m. Note that it //partially// replaces
@walm
walm / Monaco_Linux-Powerline.ttf
Created April 19, 2012 13:23 — forked from dsc8x/Monaco_Linux-Powerline.ttf
Monaco for vim-powerline
@walm
walm / AppDelgate.m
Created April 3, 2012 12:01
UIWebView remote debugging
- (BOOL) application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
[NSClassFromString(@"WebView") _enableRemoteInspector];
/** .. do your AppDelgate thing.. **/
return YES;
}
@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"
nameserver 127.0.0.1
port 20560
@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
@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 / 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 / AppDelegate.h
Created September 16, 2011 22:15
Forward scrollToTop event to webview in PhoneGap iOS
// add UIScrollViewDelegate
@interface AppDelegate : PhoneGapDelegate <UIScrollViewDelegate>
class Beans
from : [ 'Central America', 'South America', 'East Africa' ]
brand : 'Gevalia'
name : 'Ebony'
class Coffee extends Beans
sugar : no
milk : no
people = [ 'Andreas', 'Sofia' ]