Skip to content

Instantly share code, notes, and snippets.

View taylor-smith's full-sized avatar

Taylor Smith taylor-smith

View GitHub Profile
{
"key": "cmd+1",
"command": "workbench.action.openEditorAtIndex1"
},
{
"key": "cmd+2",
"command": "workbench.action.openEditorAtIndex2"
},
{
"key": "cmd+3",
var myLib = (function() {
// Using IIFE + Closure
var $cachedLookup = $('.element');
function hideCachedElement() {
$cachedLookup.hide();
}
return {
hide: hideCachedElement
validate: function(attrs, options){
if (attrs.data[0].value === null ||
attrs.data[1].value === null ||
attrs.data[2].value === null ||
attrs.data[3].value === null ||
attrs.data[4].value === null ||
attrs.data[5].value === null ||
attrs.data[6].value === null ||
attrs.data[7].value === null ||
attrs.data[8].value === null ||
var TodoItem = Backbone.Model.extend({});
var TodoView = Backbone.View.extend({
render: function(){
var html = '<h3>' + this.model.get('description') + '</h3>'
this.$el.html(html);
return this;
}
});
@taylor-smith
taylor-smith / Rakefile
Created May 29, 2014 18:44
(Poor) Examples of sample db:load, db:create, db:drop rake tasks
namespace :type_of_task do
task :name_of_task => [:task_dependency] do
puts "I Work!"
end
task :task_dependency do
puts "I am working as well!"
end
end
require 'sqlite3'
namespace :type_of_task do
task :name_of_task => [:task_dependency] do
puts "I Work!"
end
end
namespace :db do
@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
@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 / 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: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'
},