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
'use strict'; | |
var express = require('express'), | |
app = express(), | |
http = require('http'), | |
server = http.createServer(app), | |
path = require('path'), | |
io = require('socket.io').listen(server), | |
fs = require('fs'), | |
zmq = require('zmq'), |
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
<html> | |
<head> | |
<title>Post form in a new window without losing handle to the window</title> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> | |
<script> | |
$(function() { | |
$('form').on('submit', function(ev) { | |
var form = $(this); | |
form.attr('target', 'new-window'); |
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
#!/bin/bash | |
if [ -f /usr/local/bin/virtualenv ]; | |
then | |
virtualenv --no-site-packages --distribute -- $1 | |
elif [ -f /usr/bin/virtualenv ]; | |
then | |
virtualenv --no-site-packages --distribute -- $1 | |
else | |
echo "No virtualenv found. Please install setuptools & virtualenv. :(" |
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
# This is a modification of the blogpost on how to use Mongoid and Sinatra. | |
# Here is the original blogpost http://www.garrensmith.com/2010/09/11/Mongoid-sinatra.html | |
# The modification lets you use Mongoid 3.0 with the new Moped driver | |
# The new Moped driver uses the Sessions component to define the MongoDB connection rather | |
# than the Mongo::Connection.new that is used in the case of the default Ruby driver. | |
# Moped::Session.new vs Mongo::Connection.new | |
# Mongoid.load!(yaml_config.yml) is used to build the config hash. Alternatively, the hash can | |
# be built manually by using Mongoid.config {|config| ...} syntax. The config.sessions hash |
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
require 'point' | |
function love.load() | |
math.randomseed(os.time()) | |
love.physics.setMeter(32) | |
love.graphics.setBackgroundColor(64, 120, 64) | |
world = love.physics.newWorld(0, 0) | |
crates = { makeCrate(world, 5, 5), | |
makeCrate(world, 5, 6) } |
NewerOlder