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
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')
@wess
wess / gmail_to_post.py
Created December 8, 2011 20:45
Use python to read Gmail and post to a web service
#
# gmail_to_post.py
# FrenzyLabs, llc (@frenzylabs)
#
# Created by Wess Cope (@wesscope) on 2011-12-08.
# Copyright 2011 FrenzyLabs, llc. All rights reserved.
#
# Using:
# Python 2.7
# Requests: http://python-requests.org
@wess
wess / stackfile
Created January 6, 2012 15:32
Example of a Stackfile that has less, jquery and the less skeleton files
/***
* This is an example Stackfile
*/
/* PATHS */
var jsPath = "js",
cssPath = "css",
lessPath = "less";
/* PATHS */
@wess
wess / UIButton+Addition.h
Created January 21, 2012 16:00
added setBackground for event to UIButton
#import <UIKit/UIKit.h>
@interface UIButton(WCButton)
@property (nonatomic, retain) NSMutableDictionary *backgrounds;
- (void) setBackgroundColor:(UIColor *)bgColor forState:(UIControlState)state;
@end