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
- (UIColor *)colorByChangingAlphaTo:(CGFloat)alpha
{
CGFloat *oldComponents = (CGFloat *)CGColorGetComponents([self CGColor]);
size_t numComponents = CGColorGetNumberOfComponents([self CGColor]);
CGFloat newComponents[4];
switch (numComponents)
{
case 2:
#!/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"
# 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()
- (void)saveModel:(MTLModel *)model forKey:(NSString *)key error:(NSError *__autoreleasing *)error
{
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *path = [self pathForModel:model];
path = [path stringByAppendingPathComponent:key];
}
- (MTLModel *)objectForKey:(NSString *)key
import sys
import os
import time
import atexit
from signal import SIGTERM
class Daemon:
def __init__(self, pidfile, stdin='/dev/null', stdout='/dev/null', stderr='/dev/null'):
self.pidfile = pidfile
#!/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"
;(function(exports){
var Namespace = exports.Namespace || {};
exports.Namespace = Namespace;
})(window);
@wess
wess / designer.html
Created August 29, 2014 13:46
designer
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<polymer-element name="my-element">
[self.view animate:^(Animator *animator) {
animator.x.from = 10;
animator.x.to = 20;
animator.gravity = 5;
animator.elastic = 2;
}];
@implentation UserForm
- (SurveyTextField *)username
{
return SurveyDefineTextField(^(SurveyTextField *field) {
field.placeholder = @"username";
});
}
// OR