This file contains 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
# a good gist is a very few, small pieces of easily digestible code | |
# please break long, heavily commented files into smaller chunks, with clearly defined questions | |
# and all the context required to communicate to a user what is happening | |
def longest_string(list) | |
longest_so_far = list.first | |
for item in list | |
if item > longest_so_far | |
longest_so_far = item | |
end |
This file contains 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
startup, version: 2221 osx x64 channel: stable | |
executable: /Applications/Sublime Text 2.app/Contents/MacOS/Sublime Text 2 | |
working dir: / | |
packages path: /Users/jd/Library/Application Support/Sublime Text 2/Packages | |
settings path: /Users/jd/Library/Application Support/Sublime Text 2/Settings | |
PackageSetup not required | |
catalogue loaded | |
found 9 files for base name Default.sublime-keymap | |
found 1 files for base name Default.sublime-mousemap | |
found 6 files for base name Main.sublime-menu |
This file contains 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
{ | |
"color_scheme": "Packages/Color Scheme - Default/Monokai Bright.tmTheme", | |
"font_size": 21.0, | |
"hot_exit": false, | |
"ignored_packages": | |
[ | |
"Vintage", | |
"Jade", | |
"Haml" | |
], |
This file contains 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
# the controller | |
angular.module('Lunch.controllers', []) | |
.controller('LunchCtrl', ($scope, LunchMates) -> | |
# angular no longer 'unwraps' promises | |
LunchMates.getLunchMates().then (data) -> | |
$scope.lunchers = data | |
) | |
This file contains 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
angular.module('CrowdSound').directive 'csChart', () -> | |
restrict: "E" | |
scope: | |
question: "=" | |
index: "=" | |
link: (scope, element, attrs) -> | |
scope.data = [] | |
class PieChart | |
constructor: (element) -> |
This file contains 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
angular.module('CrowdSound').directive 'csPie', () -> | |
restrict: "E" | |
scope: | |
question: "=" | |
index: "=" | |
link: (scope, element, attrs) -> | |
scope.data = [] | |
class PieChart | |
constructor: (element, data) -> |
This file contains 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
.factory("Session", () -> | |
Session = | |
user: "john" | |
show_user: () -> | |
console.log @new_auth.user | |
connection: new Firebase("https://pitchclub.firebaseIO.com/rooms") | |
new_auth: {} | |
login: () -> | |
firebase = new Firebase("https://pitchclub.firebaseIO.com/rooms") | |
return_user = {} |
This file contains 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
if [ -d /Applications/MacVim.app/ ]; then | |
# use MacVim over built-in Mac OS version | |
export PATH="/Applications/MacVim.app/Contents/MacOS:$PATH" | |
alias mvim='MacVim' | |
alias vim='Vim' | |
alias vi='Vim' | |
export EDITOR='/Applications/MacVim.app/Contents/MacOS/Vim' | |
alias vimdiff="Vim -d" | |
fi |
This file contains 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
//layouts/application.html.erb | |
<!DOCTYPE html> | |
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ --> | |
<!--[if lt IE 7 ]> <html class="ie6" lang="en"> <![endif]--> | |
<!--[if IE 7 ]> <html class="ie7" lang="en"> <![endif]--> | |
<!--[if IE 8 ]> <html class="ie8" lang="en"> <![endif]--> | |
<!--[if (gte IE 9)|!(IE)]><!--> <html lang="en"> <!--<![endif]--> | |
<head> | |
<meta charset="utf-8" /> |
This file contains 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
class Company < ActiveRecord::Base | |
attr_accessible :cb_url, :name, :url | |
validates_presence_of :name, :cb_url | |
validates_uniqueness_of :name | |
has_many :events, :uniq => true | |
end | |
@records = Company.joins(:events).where(:events => { :date => ("2013-1-22")..("2013-3-22") } ).count | |
1.9.3p374 :002 > @records = Company.joins(:events).where(:events => { :date => ("2013-1-22")..("2013-3-22") } ).count |
NewerOlder