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
# company/models.py
from django.conf import settings
from django.db import models
from diagnose.models import IdentityModel
from users.models import User
class Company(IdentityModel):
name = models.CharField(max_length=200)
website = models.URLField()
logo = models.FileField()
#!/usr/bin/env ruby
require 'thor'
require 'open-uri'
require 'fileutils'
require 'etc'
require 'zip'
require 'erb'
URL = "https://github.com/wess/center-stage/archive/master.zip"
- (UIColor *)colorByChangingAlphaTo:(CGFloat)alpha
{
CGFloat *oldComponents = (CGFloat *)CGColorGetComponents([self CGColor]);
size_t numComponents = CGColorGetNumberOfComponents([self CGColor]);
CGFloat newComponents[4];
switch (numComponents)
{
case 2:
extension CGImage {
func blurEffect(boxSize: Float) -> CGImageRef! {
let boxSize = boxSize - (boxSize % 2) + 1
let inProvider = CGImageGetDataProvider(self)
let height = vImagePixelCount(CGImageGetHeight(self))
let width = vImagePixelCount(CGImageGetWidth(self))
let rowBytes = CGImageGetBytesPerRow(self)
@wess
wess / Alter.swift
Created July 17, 2015 18:49
Alter - JSON Decoding/Modeling lib for Swift 2.0
//
// Alter.swift
// Alter
//
// Created by Wesley Cope on 7/16/15.
// Copyright © 2015 Wess Cope. All rights reserved.
//
/* USAGE:
@wess
wess / Byway.swift
Created July 22, 2015 19:57
Byway
//
// Byway.swift
// Byway
//
// Created by Wesley Cope on 7/16/15.
// Copyright © 2015 Wess Cope. All rights reserved.
//
/* USAGE:
- (float) productOfA: (const float) a b: (const char) b {
if (b > 0)
return a;
if (b < 0)
return -a;
return 0;
}
<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');