Skip to content

Instantly share code, notes, and snippets.

View taylor-smith's full-sized avatar

Taylor Smith taylor-smith

View GitHub Profile
rails new Hello_World
$ rails new Hello_World
@taylor-smith
taylor-smith / gist:6244537
Created August 15, 2013 20:30
Initializing needed variables
var text = "Taylor Smith Taylor Smith Taylor Smith Taylor Smith"
var myName = "Taylor Smith"
var hits = []
def initialize (args={:event_time, :deadline, :event_name, :event_location, :minimum_attendees, :maximum_attendees, :creator_name, :phone, :email, :invitees})
@required = args.fetch(:event_time, :deadline, :minimum_attendees) # .fetch will throw an error if key doesn't exist in Hash
@optional = args[:creator, :event_name, :event_location, :attendees, :maximum_attendees] # simple access returns nil if key isn't set--no exception raised
end
{
'id': 'happy2014',
'name': 'Happy Tour 2014',
'startDate': 'Feb 3 00:00:00 UTC 2014',
'endDate': 'Feb 5 00:00:00 UTC 2014',
'description': 'This is a tour of all the artwork that you would want to see to make you smile',
'picture': 'http://happytour.org/happy2014.png'
}
@taylor-smith
taylor-smith / gist:9026156
Created February 15, 2014 22:37
write to disk in sails.js
'default': 'disk',
// Persistent adapter for DEVELOPMENT ONLY
// (data is preserved when the server shuts down)
disk: {
module: 'sails-disk'
},
@taylor-smith
taylor-smith / gist:9353769
Created March 4, 2014 19:27
sublime text 2 preferences
{
"color_scheme": "Packages/flatland-mks/Flatland-MKS.tmTheme",
"ensure_newline_at_eof_on_save": true,
"file_exclude_patterns":
[
".DS_Store"
],
"folder_exclude_patterns":
[
".bundle",
@taylor-smith
taylor-smith / gist:9602794
Created March 17, 2014 16:30
Ruby regex to match hashtags in a string
from http://www.rubular.com/r/PySQB8NvUY
(?:\s|^)(?:#(?!(?:\d+|\w+?_|_\w+?)(?:\s|$)))(\w+)(?=\s|$)
Test String:
#blah Pack my #box with #5 dozen #good2 #3good liquor.#jugs link.com/liquor#jugs #mkvef214asdwq sd #3e4 flsd #2good #_hello and #hello_ , how to just allow #hello2_world or #hello_23 #first#second #3
Match 1
1. blah
@taylor-smith
taylor-smith / Pairing and you
Created March 27, 2014 14:52
Pairing and You
* Pair programming vs pair learning
* pair learning: use two computers, get a chance to get some muscle memory going, but also interact with each other to reinforce the concepts. **Even if you find a concept easy to accomplish, there is undoubtedly reinforcing you can do.**
* pair programming: use **one** computer, you should have one keyboard between two people, and one monitor/laptop. Decide who will be "driving" and who will be "navigating"
* driver: your goal is to write code. You should be spending most of your time doing one of two things, writing code based on your discussions with the navigator, or discussing/researching what to write along with the navigator
* navigator: your goal is to keep the driver writing good code, or discussing what could be done to enable writing good code. You might think of the steps necessary to complete the task at hand, and what files/external resources might be the next thing to do. On top of this, you should be looking out for syntax and logic errors to help miti
require 'sqlite3'
namespace :type_of_task do
task :name_of_task => [:task_dependency] do
puts "I Work!"
end
end
namespace :db do