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 / 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 JooseX.Attribute.Dirty
*
* Add _isDirty_ property if an attribute has been changed with setter method.
*
**/
Role('JooseX.Attribute.Dirty', {
override : {
@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;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DVTConsoleDebuggerInputTextColor</key>
<string>0.811765 0.796078 0.564706 1</string>
<key>DVTConsoleDebuggerInputTextFont</key>
<string>Inconsolata - 16.0</string>
<key>DVTConsoleDebuggerOutputTextColor</key>
<string>1 1 1 1</string>
@walm
walm / gist:881857
Created March 22, 2011 19:23
Gzip ASP.NET response
HttpContext context = HttpContext.Current;
context.Response.Filter = new GZipStream(context.Response.Filter, CompressionMode.Compress);
HttpContext.Current.Response.AppendHeader("Content-encoding", "gzip");
HttpContext.Current.Response.Cache.VaryByHeaders["Accept-encoding"] = true;
@walm
walm / js-line-count.sh
Created February 28, 2011 08:23
Count lines of code in js files
find . -name '*.js' | xargs wc -l
@walm
walm / gist:825639
Created February 14, 2011 09:04
C# to json
Dictionary<string, string> jsonObj = new Dictionary<string, string>();
jsonObj.Add("id", "32");
jsonObj.Add("end_date", "2011-01-01");
jsonObj.Add("title", "A titel");
jsonObj.Add("message", "A message");
string json = new JavaScriptSerializer().Serialize(json);
@walm
walm / gist:824556
Created February 13, 2011 09:12
jQuery on anypage
var j=document.createElement("SCRIPT");
j.src="http://code.jquery.com/jquery-latest.pack.js";
document.getElementsByTagName("HEAD")[0].appendChild(j);
@walm
walm / scriptpath.jquary.js
Created January 26, 2011 08:30
Get path from a js script based on name
function getScriptPath ( scriptName ) {
$('script').each(function () {
var src = $(this).attr('src');
if (typeof src == 'string' &&
src.indexOf(scriptName) != -1)
return src;
});
return null;
@walm
walm / html5.vim
Created January 16, 2011 09:34 — forked from rcmachado/html5.vim
" Vim syntax file
" Language: HTML (version 5)
" Maintainer: Rodrigo Machado <[email protected]>
" URL: http://gist.github.com/256840
" Last Change: 2010 Aug 26
" License: Public domain
" (but let me know if you liked it :) )
"
" Note: This file just adds the new tags from HTML 5
" and don't replace default html.vim syntax file