Skip to content

Instantly share code, notes, and snippets.

@ejhayes
ejhayes / modifyByReference.pl
Created November 17, 2011 18:26
Perl modify arguments by reference
#!/usr/bin/perl -w
use strict;
use Data::Dumper;
sub t1 {
my ($v) = @_;
$$v = {hey => "you", there => 'me'};
}
@ejhayes
ejhayes / app.js
Created September 26, 2011 05:02
app.use(function(req, res, next){
// verify that user is a valid authenticated one
if( req.facebook.getSession() ){
// get user info then
req.facebook.api('/me', function(me){
console.log(me);
});
};
next();
@ejhayes
ejhayes / setup.sh
Created July 13, 2011 05:10
Sets up apache config for local development
#!/bin/sh
echo setting up directories and other stuff
sudo mkdir -p /var/www && sudo mkdir -p /etc/apache2/sites-available && sudo mkdir -p /etc/apache2/sites-enabled && echo Include /etc/apache2/sites-enabled | sudo tee -a /etc/apache2/httpd.conf
echo 127.0.0.1 web0.local.fbprotege.sears.fluid.com | sudo tee -a /etc/hosts
echo 127.0.0.1 local.fbprotege.sears.fluid.com | sudo tee -a /etc/hosts
echo done!
@ejhayes
ejhayes / setup.sh
Created July 13, 2011 05:08
Sets up apache config for local development
#!/bin/sh
echo test
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
width="600"
height="300"
creationComplete="initApp()">
<s:states>
<s:State name="loggedout"/>
<s:State name="loggedin"/>
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
@ejhayes
ejhayes / spiral.py
Created March 4, 2011 21:11
Generates the coordinates for a spiral!
"""
Displays the coordinates used to draw a circle.
Assumes top of the circle is (0,0)
- positive X = right
- positive y = down
To run on a spiral of width 3:
spiral.py -s 3
"""
@ejhayes
ejhayes / Application.cfc
Created February 22, 2011 21:10
Create a CFC from a binary object (and even without the cfc extension).
component {
this.name = "";
// you may or may not be able to do this part, but
// the ram needs to be mapped accordingly or this
// will not work with createObject since it expects
// dot notation!
this.mappings[ "/ram" ] = "ram://";
}
@ejhayes
ejhayes / gist:829979
Created February 16, 2011 19:29
Application.cfc
We couldn’t find that file to show.
@ejhayes
ejhayes / bucket.cfc
Created January 28, 2011 00:24
For tracking file metadata
component {
function init(required string dsn, required string bucketName){
// set the default bucket and datasource
variables.dsn = arguments.dsn;
variables.q = new Query(datasource=variables.dsn);
variables.storage = ExpandPath("./storage");
// set the default bucket
setBucket(arguments.bucketName);
}