This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
public class var sharedConfiguration: AppConfiguration { | |
struct Singleton { | |
static let sharedAppConfiguration = AppConfiguration() | |
} | |
return Singleton.sharedAppConfiguration | |
} | |
// Checkout Lister: A Productivity App Built in Swift by Apple |
// https://twitter.com/dwineman/status/601853359839006721 | |
// Default arguments are expressions, not constants, evaluated only when necessary. | |
extension UIImage { | |
static func emptyImage(size: CGSize, scale: CGFloat = UIScreen.mainScreen().scale) -> UIImage { | |
UIGraphicsBeginImageContextWithOptions(size, false, scale) | |
let image = UIGraphicsGetImageFromCurrentImageContext() | |
UIGraphicsEndImageContext() | |
return image | |
} |
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
#!C:\\Python25 | |
# -*- coding: GBK -*- | |
from Tkinter import * | |
import os | |
import tkFileDialog | |
import sys | |
import re | |
from tkMessageBox import * | |
import win32clipboard |
#import <mach/mach.h> | |
#import <mach/mach_host.h> | |
void print_free_memory () | |
{ | |
mach_port_t host_port; | |
mach_msg_type_number_t host_size; | |
vm_size_t pagesize; | |
host_port = mach_host_self(); |
#!/usr/bin/env node | |
var checkprime = function(smallerPrimes, number) { | |
isprime = 1; | |
for (var i = 0; i < smallerPrimes.length; i++) { | |
if (number % smallerPrimes[i] == 0) { | |
isprime = 0; | |
break; | |
} | |
} |
⌃ + a
Move to the beginning of the line.
⌃ + e
Move to the end of the line.
⌃ + u
Clear the entire line.
⌃ + w
Delete the word in front of the cursor.
⌃ + r
Search history.
#!/usr/bin/env ruby | |
unless ARGV[0] | |
puts 'Usage: newpost "the post title"' | |
exit(-1) | |
end | |
date_prefix = Time.now.strftime("%Y-%m-%d") | |
postname = ARGV[0].strip.downcase.gsub(/ /, '-') | |
post = "./_posts/#{date_prefix}-#{postname}.md" |
⌥ + ⌘ + ]
Align Assignments