Skip to content

Instantly share code, notes, and snippets.

@smith
smith / js_dom.html
Created June 24, 2011 01:43
Hacking on a plugin from Marino
<!doctype html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
@smith
smith / install-node-mac.sh
Created June 15, 2011 15:08
Install Node.js
#!/bin/sh
# Install Node.js on a Mac
# Requires xCode tools to be installed
# Install Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
# Install node
brew install node
@smith
smith / npm-schema.json
Created May 13, 2011 15:33
NPM JSON Schema
{
"name": "NPM JSON Schema",
"description": "Describes a package.json for an NPM (http://npmjs.org) package. type `npm help json` for more.",
"type": "object",
"properties": {
"name": {
"type": "string",
"required": true
},
"version": {
info it worked if it ends with ok
verbose cli [ 'node', '/home/smith/.nvm/v0.4.7/bin/npm', 'link' ]
info using npm@1.0.6
info using node@v0.4.7
verbose /home/smith/.nvm/v0.4.7/bin/node node symlink
verbose config file /home/smith/.npmrc
verbose config file /home/smith/.nvm/v0.4.7/etc/npmrc
silly testEngine { name: 'gearman',
silly testEngine version: '0.3.0',
silly testEngine description: 'Client library for Gearman',
@smith
smith / gist:959081
Created May 6, 2011 14:54 — forked from jtimberman/gist:881058
i can has ruby-1.9.2 package with fpm
# Commands to build a .deb with ruby 1.9.2
apt-get install libssl-dev
gem install fpm
cd /usr/src
wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p180.tar.gz
tar -zxvf ruby-1.9.2-p180.tar.gz
cd ruby-1.9.2-p180
./configure --prefix=/usr && make && make install DESTDIR=/tmp/installdir
cd ..
# This builds the package. Replace x86_64 with i386 or the arch you're building
<!doctype html>
<!-- Big textarea with a reset button for toddlers. Best run with iexplore -k
or something like that -->
<style>textarea { font-size: 72pt; }</style>
<form>
<textarea cols=21 rows=9></textarea>
<button type="reset">Start Over</button>
</form>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script>
var socket = require("net").createConnection(4730, "localhost"),
packet = require("../lib/packet.js");
socket.on("connect", function () {
console.log("connect");
socket.write(req, function () {
console.log("write");
});
});
var socket = require("net").createConnection(4730, "localhost");
socket.on("connect", function () {
console.log("connect");
});
socket.on("data", function (data) {
console.log("data: " + data);
});
@smith
smith / wildcard_admin_redirect.php
Created February 10, 2011 23:04
Redirects the login page for a mapped domain to the non-mapped domain.
function wildcard_admin_redirect($location, $status = 302) {
$url = parse_url($location);
if ($url['scheme'] === 'https' &&
(preg_match("/\/wp-[login|admin|register]/", $url['path']) > 0)) {
$orig = preg_replace("/^https?:\/\//", "", get_original_url($url['host']));
if ($orig && $orig !== $url['host']) {
$location = 'https://'.$orig.$url[path];
}
}
return $location;
@smith
smith / cramerdev-placeholder.html
Created February 9, 2011 22:35
A single file providing a placeholder page for Cramer Development sites
<!DOCTYPE html>
<html>
<head>
<title>Cramer Development, Inc. - Web Development</title>
<meta charset="UTF-8" />
<style>
body { width: 80%; margin: 0 auto; text-align: center; background-color: #1A1A1A; }
div#main { margin-top: 300px; }
img { border: none; }
</style>