Skip to content

Instantly share code, notes, and snippets.

View thegoleffect's full-sized avatar

Van Nguyen thegoleffect

View GitHub Profile
@thegoleffect
thegoleffect / snippet.js
Created January 13, 2012 11:05 — forked from christopherdebeer/snippet.js
Node.js Express - Mobile detection
app.get('/', function(req, res){
var ua = req.header('user-agent');
if(/mobile/i.test(ua)) {
res.render('mobile.html');
} else {
res.render('desktop.html');
}
});
@thegoleffect
thegoleffect / redis.markdown
Created September 3, 2011 00:33 — forked from bdotdub/redis.markdown
Running redis using upstart on Ubuntu

Running redis using upstart on Ubuntu

I've been trying to understand how to setup systems from the ground up on Ubuntu. I just installed redis onto the box and here's how I did it and some things to look out for.

To install:

@thegoleffect
thegoleffect / index.html
Created August 31, 2011 20:39
dnode auth working example
<html>
<head>
<script src="/dnode.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
DNode({
session : function (session) {
$('#auth :visible').slideUp();
$('#user').text(session.user);
@thegoleffect
thegoleffect / rvm-version.rb
Created April 20, 2011 19:40 — forked from thbar/rvm-version.rb
install rvm specific version
curl -s https://rvm.beginrescueend.com/install/rvm -o rvm-installer
chmod +x rvm-installer
./rvm-installer 1.6.3
#!/usr/bin/python
import sys
code = """#!/usr/bin/python
import sys
code = {0}{1}{0}
def initial_solution():
#!/usr/bin/env node
var sys = require("sys"),
fs = require("fs");
var indented = "";
(function (json) {
indented = /(^[\t ]*)/.exec(json)[0] || "";
try {
#!/usr/bin/env python
"""
A script to query the Amazon Web Services usage reports programmatically.
Ideally this wouldn't exist, and Amazon would provide an API we can use
instead, but hey - that's life.
Basically takes your AWS account username and password, logs into the
website as you, and grabs the data out. Always gets the 'All Usage Types'
#!/usr/bin/env python
"""
A script to query the Amazon Web Services usage reports programmatically.
Ideally this wouldn't exist, and Amazon would provide an API we can use
instead, but hey - that's life.
Basically takes your AWS account username and password, logs into the
website as you, and grabs the data out. Always gets the 'All Usage Types'