rails new app-name --skip-test-unit
- Better get the Gemfile looking spiffy/installed
- Don't forget to get all set up for PostgreSQL
- Use RSpec:
rails generate rspec:install
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (BOOL)textFieldShouldReturn:(UITextField *)theTextField { | |
if (theTextField == self.lastField) { | |
[theTextField resignFirstResponder]; | |
// scroll back to normal | |
} else if (theTextField == self.firstField) { | |
[self.secondField becomeFirstResponder]; | |
// Scroll to second text field | |
} else if (theTextField == self.secondField) { | |
[self.lastField becomeFirstResponder]; | |
// Scroll to last text field |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I just want it to spit out SSPADD for my current use case. There is only one "formula", but I'll make it extensible. | |
def get_bits(number_of_bits_you_have, fosc, target_speed, formula) # returns SSPADD | |
case formula | |
when :master | |
result = (fosc / (4 * target_speed)) - 1 | |
else | |
# bad news bears | |
end | |
if result >= 2 ** number_of_bits_you_have |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
import sys | |
# print_compact_dir recursively prints the contents of the directory with indentation and without stuttering. | |
# If the only contents of a given directory are another single directory, that single directory is concatenated instead of indented on the next line. | |
def print_compact_dir(root, route, level): | |
dir_path = os.path.join(root, route) | |
contents = os.listdir(dir_path) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
names = %w[Samantha Jill Trinoids Alex Tom Sangeeta] | |
phrases = [ "Access Denied.", | |
"The door is not responding. Please try using the manual lock.", | |
"The band saw has been activated. Please be safe!", | |
"Playing songs by Thin Lizzy.", | |
"Access granted." ] | |
all_phrases = phrases.join " " |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'csv' | |
class User | |
attr_accessor :email, :first_name, :last_name | |
def initialize(email = nil, first_name = nil, last_name = nil) | |
@email = email | |
@first_name = first_name | |
@last_name = last_name | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
repos = File::open( "/Users/Trimble/Desktop/r", "r" ).read | |
output_file = File::open( "/Users/Trimble/Desktop/er.txt", "w" ) | |
repos.each_line do |line| | |
output_file.puts line.gsub(' ', '\ ') | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Makefile | |
# project | |
# | |
# Created by Taylor Trimble on 12/12/12. | |
# Copyright (c) 2013 Taylor Trimble. | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (int j = 0; j < node->numberOfDependants; ++j) { | |
++((&((*newNodes)[node->dependants[j]]))->numberOfPrerequisites); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)drawRect:(CGRect)rect | |
{ | |
CGContextRef context = UIGraphicsGetCurrentContext(); | |
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); | |
const CGFloat components[8] = {0.0, 0.4, 0.0, 1.0, | |
0.0, 0.4, 0.0, 1.0}; | |
const CGFloat locations[2] = {0.0, 1.0}; | |
CGGradientRef gradient = CGGradientCreateWithColorComponents(colorSpace, components, locations, 2); | |