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 HumansController < ApplicationController | |
def create | |
human = Human.new(human_params) | |
if human.save | |
render json: human, status: 201, location: human | |
end | |
end | |
private |
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
app.controller('PanelController', function() { | |
this.items = badges; | |
this.tab = 1; | |
this.selectTab = function(setTab) { | |
this.tab = setTab; | |
}; | |
this.isSelected = function(checkTab) { | |
return this.tab === checkTab; |
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
app.controller('PanelController', function() { | |
this.items = badges; | |
this.tab = 1; | |
this.selectTab = function(setTab) { | |
this.tab = setTab; | |
}; | |
this.isSelected = function(checkTab) { | |
return this.tab === checkTab; |
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
<section ng-controller="PanelController as panel"> | |
<ul class="nav nav-pills"> | |
<li ng-class="{ active: panel.isSelected(1) }"> | |
<a href="" ng-click="panel.selectTab(1)">Angular</a> | |
</li> | |
<li ng-class="{ active: panel.isSelected(2) }"> | |
<a href="" ng-click="panel.selectTab(2)">Rails 3.2-4.0</a> | |
</li> | |
<li ng-class="{ active: panel.isSelected(3) }"> | |
<a href="" ng-click="panel.selectTab(3)">RSpec for Rails</a> |
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
which gem | |
gem () { | |
typeset result | |
( | |
typeset rvmrc | |
rvm_rvmrc_files=("/etc/rvmrc" "$HOME/.rvmrc") | |
if [[ -n "${rvm_prefix:-}" ]] && ! [[ "$HOME/.rvmrc" -ef "${rvm_ | |
prefix}/.rvmrc" ]] | |
then | |
rvm_rvmrc_files+=("${rvm_prefix}/.rvmrc") |
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
gem install slim | |
Fetching: slim-2.0.2.gem (100%) | |
ERROR: While executing gem ... (Gem::FilePermissionError) | |
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory. |
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
require 'rubygems' | |
require 'mechanize' | |
require 'pry' | |
agent = Mechanize.new | |
page = agent.get('http://www.facebook.com/ed.drain') | |
page = agent.page.link_with(:href => 'https://www.facebook.com/bookmarks/groups#').click | |
agent.page.link_with(:href => 'https://www.facebook.com/bookmarks/groups') | |
page.links.each do |link| | |
puts link.text |
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
def create_a_line(n) | |
b = f = "" | |
print_number = true | |
fizz_or_buzz = lambda {|n, mod_by| (n%mod_by==0) ? true : false } | |
if fizz_or_buzz.call n, 5 | |
b="Buzz" | |
print_number = false | |
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
# spec/models/user_spec.rb | |
require 'spec_helper' | |
# I already KNOW I have user with id of 2 and uid of '26954221' and screen_name of 'SoldierCoder' | |
# these tests all fail. Why? | |
describe User do | |
it 'should get the UID' do | |
@ed = User.find(2) | |
@ed.uid.should == '26954221' |
NewerOlder