Skip to content

Instantly share code, notes, and snippets.

#when used in decorator args array is: ['Root', 'Request'] other times it's ['Request']
@decorator
def require_https(target, *args, **kwargs):
"""Force path to be in SSL
Uses X_FRONT_END_HTTPS header key to determine if in the correct mode.
"""
request = args[0]
env = request.environ
if not ('HTTP_FRONT_END_HTTPS' in env \
and env.get('HTTP_FRONT_END_HTTPS') == 'on'):
YUI().use('*', function(Y){
var tbl,
totalRow = Y.one('#total-row').getHTML(),
ds = new Y.DataSource.IO({
source: '/billing/autobiller/get'
});
//setup datasource
ds.plug(Y.Plugin.DataSourceJSONSchema, {
schema: {
table.after('*:load', function(e){
console.log('memememe');
});
Y.publish('TABLELOAD', {broadcast: 2});
myTable.on('TABLELOAD', function(e){
doSomething();
});
Y.fire('TABLELOAD');
@chrisgeo
chrisgeo / data.js
Created October 5, 2012 03:58
cg's data
{
"foo" : {
"bar": [1, 2, 3, 5]
}
}
@chrisgeo
chrisgeo / HTML (Jinja2).tmLanguage
Created September 13, 2012 22:29
jinja2 textmate
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>htm.j2</string>
<string>html.j2</string>
<string>xhtml.j2</string>
<string>xml.j2</string>
@chrisgeo
chrisgeo / localhost.com
Created August 16, 2012 16:56
nginx config
server {
listen 80 default;
server_name www.localhost.com localhost.com *.localhost.com;
server_name_in_redirect off;
port_in_redirect off;
access_log /var/log/nginx/nginx.access.log;
location ~* ^/$ {
proxy_set_header CIP-NETSCALER $remote_addr;
proxy_set_header X-True-Origin $remote_addr;
location ~* ^/$ {
proxy_set_header Front-End-HTTPS on;
proxy_set_header CIP-NETSCALER $remote_addr;
proxy_set_header X-True-Origin $remote_addr;
proxy_set_header Host $host;
proxy_pass http://anon;
}
location ~* ^/.*$ {
proxy_set_header Front-End-HTTPS on;
proxy_set_header CIP-NETSCALER $remote_addr;
@chrisgeo
chrisgeo / fullfile
Created August 13, 2012 18:04
textmate pattern for jinja2
{ scopeName = 'text.html.jinja';
firstLineMatch = '^{% extends ["''][^"'']+["''] %}';
fileTypes = ( );
foldingStartMarker = '(<(?i:(head|table|tr|div|style|script|ul|ol|form|dl))\b.*?>|{%\s*(block|filter|for|if|macro|raw))';
foldingStopMarker = '(</(?i:(head|table|tr|div|style|script|ul|ol|form|dl))\b.*?>|{%\s*(endblock|endfilter|endfor|endif|endmacro|endraw)\s*%})';
patterns = (
{ name = 'meta.scope.jinja.variable.nested.html';
begin = '".*({{(.*)}}).*';
end = '"';
captures = { 2 = { name = 'meta.scope.jinja.variable.html.nested'; }; };
@chrisgeo
chrisgeo / weatherparser.rb
Created July 26, 2012 04:19
ruby weather script
#!/usr/bin/env ruby
require 'rexml/document'
require 'net/http'
require 'cgi'
require 'ftools'
require 'optparse'
### CONFIG
# "City, State" or "City, Country" or ZIP Code