Skip to content

Instantly share code, notes, and snippets.


Barrabin Futebol Clube ⚑ barrabinfc

View GitHub Profile
barrabinfc / jinja2_simple_render
Created Feb 14, 2014
Jinja2 Simple Render Example
View jinja2_simple_render
import os
from jinja2 import FileSystemLoader, Environment
template_path = os.getcwd()
# Load jinja
jinja_loader = FileSystemLoader( template_path )
jinja_env = Environment( loader=jinja_loader )
# Get the template and render it using `myvars`
View locaweb publicador JSON encoder
def locawebJSON(data):
_pdata = []
for k,v in data.iteritems():
if type(v) in [str, unicode]:
v = ('"%s"' % (v))
elif isinstance(v, bool):
v = (v and 'true' or 'false')
_pdata.append('%s=%s' % (k,v))
barrabinfc / paywall_remove.js
Last active Apr 11, 2016 paywall remover.
View paywall_remove.js
$('body').css({'overflow': 'scroll'});
window.scroll = undefined;
window.resize = undefined;
barrabinfc / gist:4274168
Created Dec 13, 2012 — forked from hashmal/gist:874792
Fixed tprint to allow printing of every kind of object in lua.
View gist:4274168
-- Print contents of `tbl`, with indentation.
-- `indent` sets the initial level of indentation.
function tprint (tbl, indent)
if not indent then indent = 0 end
for k, v in pairs(tbl) do
formatting = string.rep(" ", indent) .. k .. ": "
if type(v) == "table" then
tprint(v, indent+1)
View gist:538190
package wu {
internal class COCO {
public var obj:Object;
public function COCO(o:Object) {
this.obj = o;
View gist:538153
package wu {
public function fn( obj:Object ) : Object {
return {
event_list: [],
def: function( properties:Object ) : Object {
View gist:526491
#include <stdio.h>
#include <stdlib.h>
char* cycle(int start, int next, int repeatafter, int windowsize){
int j;
char *str = malloc( sizeof(char) * windowsize + 1);
for(j=0;j < windowsize; ++j)
str[j] = 0x30 + ((start + next*j) % (repeatafter+1));
str[j] = '\0';
View gist:526449
#!/usr/bin/env python
def crange(tup, i=0, windowsize=3):
l = len(tup)
return "".join([ str(tup[(i+p)%l]) for p in range(0,windowsize)])
r = range(0,6)
for i in range(0,10):
print crange( r, i , 3 )
View gist:514976
(define 2ndorder-markov
(lambda (:phrase)
(if (= (length :phrase) 1) (list (first :phrase))
(list (second :phrase)))))
(define 3ndorder-markov
(lambda (:phrase)
((= (length :phrase) 1) (list (first :phrase)))
((= (length :phrase) 2) (list (second :phrase)))
barrabinfc /
Created Jun 5, 2010
Middlware to allow's your django server to respond appropriately to cross domain XHR (postMessage html5 API).
import re
from django.utils.text import compress_string
from django.utils.cache import patch_vary_headers
from django import http
import settings
You can’t perform that action at this time.