Skip to content

Instantly share code, notes, and snippets.

@MChorfa
MChorfa / utmstrip.user.js
Created May 20, 2011 22:28 — forked from paulirish/utmstrip.user.js
userscript: Drop the UTM params from a URL when the page loads
// ==UserScript==
// @name UTM param stripper
// @author Paul Irish
// @namespace http://github.com/paulirish
// @version 1.1
// @description Drop the UTM params from a URL when the page loads.
// @extra Cuz you know they're all ugly n shit.
// @include http://*
// ==/UserScript==
@MChorfa
MChorfa / basics.rb
Created July 25, 2011 03:28 — forked from banker/basics.rb
Files used in a presentation on MongoDB and Ruby
require 'rubygems'
require 'mongo'
@con = Mongo::Connection.new
# Instance of Mongo::DB
@db = @con['webinar']
# Instance of Mongo::Collection
@col = @db['users']
@MChorfa
MChorfa / makeUri.js
Created August 3, 2011 01:36 — forked from niallsmart/makeUri.js
makeUri.js - create a URI from an object specification
// makeURI 1.2.2 - create a URI from an object specification; compatible with
// parseURI (http://blog.stevenlevithan.com/archives/parseuri)
// (c) Niall Smart <niallsmart.com>
// MIT License
function makeUri(u) {
var uri = "";
if (u.protocol) {
uri += u.protocol + "://";
/*jslint regexp: true, sloppy: true, maxerr: 50, indent: 2 */
function parseURI(url) {
var m = String(url).match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);
// authority = '//' + user + ':' + pass '@' + hostname + ':' port
return (m ? {
href : m[0] || '',
protocol : m[1] || '',
authority: m[2] || '',
host : m[3] || '',
@MChorfa
MChorfa / A very short test
Created August 9, 2011 22:52 — forked from weejayuk/A very short test
NSDate Extension to create .net JSON date strings and convert back. Testing for this was very limited, so use with caution. Some of the code was taken from here. http://www.pittle.org/weblog/how-to-convert-datetime-net-object-serialized-as-json-by-wcf-to-
NSDate *timenow=[NSDate date];
NSLog(@"Date before date2dot net=%@",[timenow description]);
NSString *date2DotNet=[timenow dateToDotNet];
NSLog(@"Dot net version of now = %@",date2DotNet);
timenow=[NSDate dateFromDotNet:date2DotNet];
NSLog(@"Date back from date2dot net=%@",[timenow description]);
@MChorfa
MChorfa / github_post_commit.js
Created August 28, 2011 14:15 — forked from blindsey/github_post_commit.js
node.js auto deploy scripts
Steps:
0. Checkout your git repo from the server (I use /var/www/carbonite)
1. Upload both of these files to the same directory on your server
2. chmod +x restart_node.sh
3. nohup node github_post_commit.js 2>&1 >> github_post_commit.log &
4. In the github admin for your repo, set a post commit hook to the url http://<your host>:8080/
5. Make a commit to your repo
6. Point a browser at http://<your host>:8080/ and you should see the commit
@MChorfa
MChorfa / Custom.css
Created October 2, 2011 22:13 — forked from lensco/Custom.css
User stylesheet to customize the WebKit Inspector (cleaning up and improving the styles panel). See http://bricss.net/post/9076968710/customize-the-webkit-inspector-chrome-dev-tools
.monospace {
font: 11px/1.3 Monaco !important;
}
/* slightly larger indentation of source code */
.outline-disclosure ol {
-webkit-padding-start: 18px !important;
}
/* margin underneath styles panel heading */
@MChorfa
MChorfa / jsconf-eu-2011.md
Created October 6, 2011 22:51 — forked from mattpodwysocki/jsconf-eu-2011.md
JSConf.EU Slides
@MChorfa
MChorfa / gist:2058603
Created March 17, 2012 12:55 — forked from luetkemj/wp-query-ref.php
WP: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php
*/
$args = array(
@MChorfa
MChorfa / nginx.conf
Created April 11, 2012 02:22 — forked from evansolomon/nginx.conf
nginx config file
user www-data;
worker_processes 4;
worker_cpu_affinity 0001 0010 0100 1000;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 2048;
}