This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
io = require('socket.io').listen(4000) | |
io.sockets.on 'connection', (socket) -> | |
console.log('Connected!') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# setup our application with its own namespace | |
App = {} | |
### | |
Init | |
### | |
App.init = -> | |
App.canvas = document.createElement 'canvas' #create the canvas element | |
App.canvas.height = 400 | |
App.canvas.width = 800 #size it up |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> | |
<script type="text/javascript" src="js/jquery.event.drag-2.0.js"></script> | |
<script src="http://localhost:4000/socket.io/socket.io.js"></script> | |
<script type="text/javascript" src="scripts.js"></script> | |
<link rel="stylesheet" href="style.css" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on http://paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/ | |
# Converter to coffeescript by Wes Bos - http://wesbos.com | |
window.log = -> | |
log.history = log.history or [] | |
log.history.push arguments | |
console.log Array::slice.call arguments if @console | |
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function is_blog () { | |
global $post; | |
$posttype = get_post_type($post ); | |
return ( ((is_archive()) || (is_author()) || (is_category()) || (is_home()) || (is_single()) || (is_tag())) && ( $posttype == 'post') ) ? true : false ; | |
} | |
Usage: | |
<?php if (is_blog()) { echo 'You are on a blog page'; } ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var page = new WebPage(), | |
address, output, size; | |
address = "http://www.metachunk.com/"; | |
width = 1024; height = 600; | |
output = "./screenshots/wat-"+width+"X"+height+".png"; | |
page.viewportSize = { width: width, height: height }; | |
if (phantom.args.length === 3 && phantom.args[1].substr(-4) === ".pdf") { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get a Pork Shoulder (called Pork but or picknick but/shoulder sometimes at the grocery store) | |
1. Cut the skin off the pork but and then trim most of the fat. Leaving some marbled fat is good b.c it melts away and adds to the favour | |
2. cover the pork but in normal yellow mustard. If you have dry mustard, that is fine too. I've used both. | |
3. prepare a "dry rub" which is just a bowl full of tons of spices. I include the following | |
-garlic salt | |
-normal salt | |
-paprika |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If you were lucky enough to get a ticket to JSConf this year, you're probably in hotel mode. | |
The kimpton is quite fancy, but at $200/night, its a little expensive for my tastes. | |
So, after a little detective work, I've found a hotel a 5 min walk down the road from the conference for $55/night (give or take a few bucks) for three adults. The hotel is the scottsdale days inn (http://www.daysinnscottsdale.com/) | |
Here are the steps. | |
1. Go to http://hotwire.com and search 'scottsdale, AZ' and fill out the rest of the info. W | |
2. Find the "2-star Hotel in Scottsdale Old Town" it looks like this: http://wes.io/DfS0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var page = new WebPage(), | |
address, output, size; | |
address = "http://www.wesbos.com/"; | |
width = 1024; height = 600; | |
output = "./screenshots/screenshot-"+width+"X"+height+".png"; | |
page.viewportSize = { width: width, height: height }; | |
if (phantom.args.length === 3 && phantom.args[1].substr(-4) === ".pdf") { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Simple little snippet that I always forget. I use this to quickly find/replace all references to any paths within a wordpress DB when migrating. Much faster than using a GUI | |
You must have gsed installed, used macports to do this. Native osx sed sucks. | |
usage: gsed -i 's/[old-url]/[new-url]/gi' database-name.sql | |
Example: | |
gsed -i 's/localhost\/wordpress-local\/subfolder/production.com/gi' livedb.sql |
OlderNewer