Skip to content

Instantly share code, notes, and snippets.

View rustyrazorblade's full-sized avatar

Jon Haddad rustyrazorblade

View GitHub Profile
@rustyrazorblade
rustyrazorblade / gist:1306478
Created October 22, 2011 20:49
circular reference
class User(Document):
name = StringField()
friends = ListField( ReferenceField(User) )
[program:web-prod]
command="bin/run %(process_num)s"
autostart=false
numprocs=4
numprocs_start=8000
process_name=%(program_name)s-%(process_num)s
------------------------------------------------------------
supervisor> status
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:fb="https://www.facebook.com/2008/fbml">
<head>
<title>Broken invites</title>
</head>
<!-- url on my dev server: http://localhost:8888/static/fb_test.html -->
<body>
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<p>
function submit_new_bill()
{
// check amount
error = false
amount = $('#amount').val()
errors = []
people = $('#bill_to').val()
if( amount <= 0 )
{
if self.get_cookie( 'use_mobile', "0" ):
self.redirect('/mobile/')
else:
self.redirect('/')
### coffeescript
$('#nav_news_feed').click () ->
$.get '/api/history', (result) ->
alert result
## js
return $('#nav_news_feed').click(function() {
return $.get('/api/history', function(result) {
return alert(result);
});
@rustyrazorblade
rustyrazorblade / echoserver.py
Created February 7, 2012 22:22
tornado 2.1 echo server
#!/usr/bin/env python
#coding:utf-8
import sys, os, re
import logging
from tornado.ioloop import IOLoop
from tornado.iostream import IOStream
from tornado.netutil import TCPServer
.hero-unit {
padding: 60px;
margin-bottom: 30px;
background-color: #f5f5f5;
.border-radius(6px);
text-align: center;
h1 {
margin-bottom: 0;
font-size: 60px;
line-height: 1;
@rustyrazorblade
rustyrazorblade / gist:2129520
Created March 20, 2012 01:20
list item dropdown with image
<li>
<a href='#' data-entryid='{{entryid}}''>
<img class='pull-left fbicon'
src = 'http://graph.facebook.com/{{from.facebookid}}/picture?type=square'
title='{{name}}'>
<div>
<div>{{msg}}</div>
<div class='help-block'>{{timestamp_pretty}}</div>
</div>
</a>
who_owes_me = '''
<table class='table table-condensed table-striped ' >
<tr class="titles">
<th class="name">Who Owes Me</th>
<th class="amount">Amount</th>
<th class="status">&nbsp;</th>
</tr>
{{#users}}
<tr>
<td class="name"><a href="#">{{name}}</a></td>