Skip to content

Instantly share code, notes, and snippets.

View atkinson's full-sized avatar

Rich Atkinson atkinson

View GitHub Profile
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta name="viewport" content="width=default-width; user-scalable=no" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
<title>Load WebSQL Database from text file of SQL statements;</title>
<style type="text/css">
body, html { background-color: #444444; }
@atkinson
atkinson / nginx.conf.txt
Created October 25, 2011 06:16
nginx wordpress
root /path/to/wordpress;
index index.php index.html;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
location / {
fastcgi_index index.php;
# if your fast-cgi is somewhere else, change this
fastcgi_pass 127.0.0.1:9000;
@atkinson
atkinson / views.py
Created October 25, 2011 11:09
Keep top level facet counts when drilling down in haystack
from haystack.views import FacetedSearchView
class StickyFacetedSearchView (FacetedSearchView):
def top_level_facets(self):
"""
When selecting a facet to drill down the results,
we need to keep the top level facet counts
"""
stored_query = self.request.session.get('query', None)
{
"amount": "81.52",
"beneficiary_address": "F1 Soft\nNepal",
"beneficiary_agent_code": "745",
"beneficiary_id": "0425261410",
"beneficiary_name": "Sumit Baskota",
"beneficiary_phone": "5551234",
"commission": "0",
"exchange_rate": "81.52",
"id_type": "O",
@atkinson
atkinson / gist:1435489
Created December 5, 2011 21:37
tropo test
#!/usr/bin/env python
try:
import cjson as jsonlib
jsonlib.dumps = jsonlib.encode
jsonlib.loads = jsonlib.decode
except ImportError:
try:
from django.utils import simplejson as jsonlib
class LoginForm(forms.Form):
password = PasswordField(
label = _("Password"))
remember = forms.BooleanField(
label = _("Remember Me"),
# help_text = _("If checked you will stay logged in for 3 weeks"),
required = False
)
@atkinson
atkinson / gist:3830875
Created October 4, 2012 00:55
public key
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA7KjcZd8MHJ8aoAdnmKR1zBISmru2VVFl6AVHQPH7s754qKTf43kp4OCjTuefje1NhpBL69MaoK6Y+Fc7gTZOx4Ofny1Ju2L8wViw6bIKdSoTOlD3NRqp28sf3doqOf1LxSXjhFrU50FEP3WhrXypCy70HbjmzN/ZSy8trAY8zsUUpi8gxRmR6KA8wThB2KgR0522X1a3mZANOjWMOhTfcedJwxcPj1ELlB7jycTEZrRuiJL3cltWy26iv4XdwdGa2gKi1HwRROYFW/fu2R6cNz2v34pI+1g2OeXRwJIe9CMQWxyha0YdSVtXVdCjCOU+21ld9baWm7UzU+8aoucUPQ== atkinsonr@gmail.com
@atkinson
atkinson / gist:3943350
Created October 24, 2012 02:22
tengine compile options
./configure --prefix=/usr/local \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx-error.log \
--http-log-path=/var/log/nginx-access.log \
--pid-path=/var/run/nginx.pid
<script type="text/javascript">
(function() {
var config = {
kitId: 'fwo5iqk',
scriptTimeout: 3000
};
var h=document.getElementsByTagName("html")[0];h.className+=" wf-loading";var t=setTimeout(function(){h.className=h.className.replace(/(\s|^)wf-loading(\s|$)/g," ");h.className+=" wf-inactive"},config.scriptTimeout);var tk=document.createElement("script"),d=false;tk.src='//use.typekit.net/'+config.kitId+'.js';tk.type="text/javascript";tk.async="true";tk.onload=tk.onreadystatechange=function(){var a=this.readyState;if(d||a&&a!="complete"&&a!="loaded")return;d=true;clearTimeout(t);try{Typekit.load(config)}catch(b){}};var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(tk,s)
})();
</script>
@atkinson
atkinson / gist:7999356
Created December 17, 2013 03:07
Easy jQuery templating
/*
Author: Rich Atkinson hello@piran.com.au
*/
// Provides a String.render() method. Similar to String.format() (in c),
// except it takes a literal object of name / value pairs, like context in Django.
// eg: "Hello {name} welcome to {list}".format({name: 'Joe', list: 'Spam'})
if (!String.prototype.render) {