Skip to content

Instantly share code, notes, and snippets.

The idea is to have nginx installed and node installed. I will extend this gist to include how to install those as well, but at the moment, the following assumes you have nginx 0.7.62 and node 0.2.3 installed on a Linux distro (I used Ubuntu).

In a nutshell,

  1. nginx is used to serve static files (css, js, images, etc.)
  2. node serves all the "dynamic" stuff.

So for example, www.foo.com request comes and your css, js, and images get served thru nginx while everything else (the request for say index.html or "/") gets served through node.

  1. nginx listens on port 80.
<?php
// Example of how to log into Google API with ClientLogin, good to use when you're not making a webapp.
// code taken and minimally updated from http://kovshenin.com/2009/10/google-docs-api-client-login-with-php-and-curl-1494/
// Construct an HTTP POST request
$clientlogin_url = "https://www.google.com/accounts/ClientLogin";
$clientlogin_post = array(
"accountType" => "HOSTED_OR_GOOGLE",
"Email" => "[email protected]",
<!DOCTYPE HTML>
<!--
/*
* Remote File Copy Demo 1.0
*
* Copyright 2012, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
#!/bin/bash
#
# template script for generating CentOS container for LXC
#
#
# lxc: linux Container library
# Authors:
@drucko
drucko / gist:4945238
Last active December 13, 2015 17:08 — forked from chrismatthieu/gist:964754
Sip registrarserver with node.js
// Run Redis - cd redis-2.2.4 and run src/redis-server
var sip = require('sip');
var sys = require('sys');
var redis = require('redis');
var tropoapi = require('tropo-webapi');
//Trim leading and trailing whitespace from string values.
function trim(str) {
return str.replace(/^\s+|\s+$/g, '');
############################## django-auth-ldap ##############################
import ldap
from django_auth_ldap.config import LDAPSearch, PosixGroupType
# django-auth-ldap configuration starts here
AUTH_LDAP_SERVER_URI = "ldap://ldap.els03.loc ldap://ldap.zbw03.loc ldap://ldap.cvg03.loc"
#AUTH_LDAP_USER_DN_TEMPLATE = "uid=%(user)s,ou=People,o=loc"
# JW is in ou=Admin,o=loc so we search over o=loc to find him
AUTH_LDAP_USER_SEARCH = LDAPSearch("o=loc",
@drucko
drucko / gist:4421243
Created December 31, 2012 16:56 — forked from pindia/gist:3166678

Step by step from jQuery to Agility.js

There's probably hundreds of Javascript MVC frameworks out there. But my favorite, Agility.js, seems to be barely ever mentioned. Agility has served me well in several projects both big and small, so I'm writing a tutorial in the spirit of Step by step from jQuery to Backbone for Agility.

What makes Agility different from other MVC frameworks? In short, the lack of boilerplate and the completeness. Other frameworks involve many, many lines of boilerplate that provide a significant barrier to entry and detract from the readability of the final product. Agility minimizes this, lets you get started fast, and stays out of your way. But it doesn't sacrifice either completeness or maintainability. Agility is feature-rich, including two-way model-view bindings, declarative controller-events, prototypical inheritance, server persistance, and everything else

@drucko
drucko / fabfile.py
Created November 26, 2012 19:29 — forked from onyxfish/fabfile.py
Fabric configuration for advanced mapping w/ TileMill and invar
import os
import re
from fabric.api import *
import yaml
"""
Base configuration
"""
# Ubuntu
@drucko
drucko / gist:4117581
Created November 20, 2012 12:11 — forked from drewtang/gist:1477180
Yammer Connect Example
yam.connect.loginButton('#yammer-login', function (resp) {
if (resp.authResponse) {
yam.request({
url: '/api/v1/users/current',
type: 'GET',
success: function (msg) {
document.write('<IMG SRC="' + msg.mugshot_url + '">' + '<h3>Welcome Back ' + msg.full_name + '!</h3>');
},
error: function (msg) { alert('Data Not Saved: ' + msg); }
});
@drucko
drucko / index.html
Created November 20, 2012 12:10 — forked from adgedenkers/index.html
Yammer Authentication
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<ul id="site_menu" class="nav nav-list"></ul>
<script type="text/javascript" data-app-id="ABCDEFGHIJKlmnopqrstuv" src="https://assets.yammer.com/platform/yam.js"></script>
<script src="/tanzanite/js/jquery.min.js" type="text/javascript" charset="utf-8"></script>