This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>Sup</title> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<script type="text/javascript"> | |
window.onload = function(){ | |
var schema = { | |
fields: [ | |
{name: 'first_name', type: 'text', display: 'First Name'}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>Reddit JSON</title> | |
<style> | |
body{ background-color: #C6C6C6; } | |
#content div { | |
border: 1px solid #000000; | |
margin: 5px; | |
padding: 5px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function love.load() | |
reset() | |
topscore = 0 | |
local font = love.graphics.newFont(24) | |
love.graphics.setFont(font) | |
end | |
function reset() | |
x = 60 | |
y = love.window.getHeight()/2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Chat!</title> | |
<style> | |
</style> | |
</head> | |
<body> | |
<ul id="messages"></ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import ast | |
is_if = lambda s: isinstance(s, ast.If) | |
is_for = lambda s: isinstance(s, ast.For) | |
is_call = lambda s: isinstance(s, ast.Call) | |
call_name_is = lambda s, n: is_call(s) and hasattr(s.func, 'attr') and s.func.attr == n | |
has_else = lambda s: is_if(s) and len(s.orelse) > 0 | |
is_return = lambda s: isinstance(s, ast.Return) | |
is_name = lambda s: isinstance(s, ast.Name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from wsgiref import simple_server | |
def format_html(entries): | |
html = """<html><body><ul>%s</ul></body></html""" | |
return html % entries | |
def format_entries(requested_dir, children): | |
result = [] | |
a = '<li><a href="%s">%s</a></li>' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" class Foo(Bar): │ | |
" └── [ 13 ] ────• | |
set fillchars="fold: " | |
setlocal foldtext=ManualFillCharText() | |
function! ManualFillCharText() | |
" TODO: make it support the tabs/spaces/different width | |
let total = (v:foldend - v:foldstart) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bind "^R" em-inc-search-prev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Entity(object): | |
def __init__(self, name): | |
self.name = name | |
class Powered(object): | |
def is_on(self): | |
return self.state == 'on' | |
class Machine(Entity, Powered): | |
def __init__(self, name, state): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# in processor.py | |
def site_processor(request): | |
return {'Foo': 'Bar'} | |
# in settings.py | |
from django.conf import global_settings as DEFAULT_SETTINGS | |
TEMPLATE_CONTEXT_PROCESSORS = DEFAULT_SETTINGS.TEMPLATE_CONTEXT_PROCESSORS + ( | |
'myapp.processor.site_processor', | |
) |
OlderNewer