Skip to content

Instantly share code, notes, and snippets.

View wess's full-sized avatar
💭
When am I not writing code?

Wess Cope wess

💭
When am I not writing code?
View GitHub Profile
<form method="post">
<dl>
{% for field in form %}
<dt>{{field.label_tag}}</dt>
<dd>{{field}}</dd>
{% if field.errors %}<dd class="field-errors">{{field.errors.as_text}}</dd>{% endif %}
{% endfor %}
<dt>&nbsp;</dt>
<dd><button type="submit">Submit</button></dd>
</dl>
#include <dirent.h>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <iostream>
#include <fstream>
(function(){
var conf = new Configure();
conf.verbose(true);
conf.compiler('gcc');
conf.includes(['src/headers', 'deps/v8/include']);
conf.libs(['deps/v8/libv8.a']);
conf.flags(['lpthread', 'g']);
conf.src(['src/bob.cc', 'src/configure.cc', 'src/environment.cc', 'src/filesys.cc', 'system.cc', 'utils.cc']);
conf.target('build/bob');
C++:
void Blah(int &someint)
{
someint++;
}
void playWithBlah()
{
int x = 0;
Blah(x);
<script type="text/javascript" charset="utf-8">
;(function($){
var views = {};
views.FULL_WIDTH = "100%";
views.__builder = Class.extend({
init: function(options)
{
this.styles = options.styles || false;
this.classes = options.classes || false;
(function() {
var http = require('http'),
fs = require('fs'),
url = require('url'),
conf = require('./conf').FosterConfig;
var server = http.createServer();
server.addListener('request', function(data, response){
if(data.url !== '/favicon.ico')
- (void) awakeFromNib
{
[super awakeFromNib];
CDTest_AppDelegate *appDelegate = (CDTest_AppDelegate *)[[NSApplication sharedApplication] delegate];
NSManagedObjectContext *context = [appDelegate managedObjectContext];
Account *account = (Account *)[NSEntityDescription insertNewObjectForEntityForName:@"Account" inManagedObjectContext:context];
account.username = @"wess";
@wess
wess / AppView.php
Created February 2, 2011 02:54
template engine for php
<?php
class AppView
{
private $settings;
private $templateDirectory;
private $template;
private $ext;
private $layout;
private $pageVars = array();
private $post = array();
@wess
wess / example_decorator.py
Created August 3, 2011 17:11
example python decorator
def decorator_here(func):
def wrapper(func):
x = func()
return "%s , goodbye world"
return wrapper
@decorator_here
def testing():
return "hello world"
class User(BaseModel):
username = models.CharField(max_length=20)
password = models.CharField(max_length=20)
groups = models.ManyToManyField('Group', related_name='groups', db_table='USERS_TO_GROUPS')
class Group(BaseModel):
name = models.CharField(max_length=20)
users = ManyToManyField(User, related_name='users', db_table=u'USERS_TO_GROUPS')