Skip to content

Instantly share code, notes, and snippets.

View dfadler's full-sized avatar

Dustin Fadler dfadler

View GitHub Profile
#!/usr/bin/env ruby
# Modified from http://yehudakatz.com/2007/08/06/webrick-anywhere/
require 'webrick'
include WEBrick
s = HTTPServer.new(
:Port => ARGV[0] || 2000,
:DocumentRoot => Dir::pwd
)
@stephanschubert
stephanschubert / cross-browser-background-rgba.scss
Created April 18, 2011 05:44
SCSS mixin for cross-browser background-color: rgba(...). You'll need the Ruby extension for convenient color conversion rgba->hex (IE uses ARGB)
@mixin background-rgba($r,$g,$b,$a) {
// To mimic this in Internet Explorer, you can use the proprietary filter
// property to create a gradient with the same start and end color, along
// with an alpha transparency value.
@if experimental-support-for-microsoft {
$color: ie_hex($r,$g,$b,$a);
$value: unquote("progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=##{$color},endColorstr=##{$color})");
background-color: transparent\9;
@markjaquith
markjaquith / disable-plugins-when-doing-local-dev.php
Created June 24, 2011 10:24
Disables specified WordPress plugins when doing local development
<?php
/*
Plugin Name: Disable plugins when doing local dev
Description: If the WP_LOCAL_DEV constant is true, disables plugins that you specify
Version: 0.1
License: GPL version 2 or any later version
Author: Mark Jaquith
Author URI: http://coveredwebservices.com/
*/
@tj
tj / equivalent.js
Created August 24, 2011 00:21
example of backbone-style routing with Express
app.get('/help', function(req, res){
res.send('some help');
});
app.get('/search/:query/p:page', function(req, res){
var query = req.params.query
, page = req.params.page;
res.send('search "' + query + '", page ' + (page || 1));
});
@scottjehl
scottjehl / hideaddrbar.js
Created August 31, 2011 11:42
Normalized hide address bar for iOS & Android
/*
* Normalized hide address bar for iOS & Android
* (c) Scott Jehl, scottjehl.com
* MIT License
*/
(function( win ){
var doc = win.document;
// If there's a hash, or addEventListener is undefined, stop here
if( !location.hash && win.addEventListener ){
@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@JeffreyWay
JeffreyWay / gist:1525217
Created December 27, 2011 21:29
Instant Server for Current Directory
alias server='open http://localhost:8000 && python -m SimpleHTTPServer'
@simenbrekken
simenbrekken / README.md
Created March 8, 2012 06:39
Super simple Backbone + Express + MongoDB REST backend application

Requirements:

If you're on OSX you're probably best off using Homebrew to install this stuff:

$ brew install node mongodb

Usage:

@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@ekka21
ekka21 / gist:2597615
Created May 4, 2012 20:45 — forked from luetkemj/wp-query-ref.php
Wordpress: wp_query
<?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(