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
##################### | |
# CONDITIONALS | |
##################### | |
def variables_in_passing_conditionals | |
special_string = "Awesome!" | |
if true | |
result = "You win!" | |
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
"When then do a group critique, three minutes per idea." # => "We then do a group critique, three minutes per idea." | |
"HTML and CSS wireframes are built using Bourbon and Neat in the browser so the team can get understand the core experience as fast as possible." # => "HTML and CSS wireframes are built using Bourbon and Neat in the browser so the team can begin to understand the core experience as fast as possible." | |
"Out blog is called GIANT ROBOTS SMASHING INTO OTHER GIANT ROBOTS." => "Our blog is called GIANT ROBOTS SMASHING INTO OTHER GIANT ROBOTS." |
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 deaf_grandma | |
conversation = [] | |
puts "Say something to Grandma, dear." | |
until end?(conversation) do | |
conversation << gets.chomp | |
puts response(conversation.last) | |
end | |
end | |
GOODBYE = ->(m) { m == "I love ya, Grandma, but I've got to go." } |
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 artii | |
# gem install term-ansicolor | |
require 'artii' | |
require 'term/ansicolor' | |
class String | |
include Term::ANSIColor | |
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
[2] pry(main)> puts "ha" 3 | |
SyntaxError: unexpected tINTEGER, expecting $end | |
[2] pry(main)> puts "ha" * 3 | |
hahaha | |
=> nil | |
[3] pry(main)> "string 5 " | |
=> "string 5 " | |
[4] pry(main)> 5 | |
=> 5 | |
[5] pry(main)> "cat" + "food" |
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
export default function(username, password) { | |
visit('/login'); | |
fillIn('input.identification', username); | |
fillIn('input.password', password); | |
click('button.submit'); | |
} |
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
export default Ember.Controller.extend({ | |
setup: function() { | |
var template = Handlebars.compile("<p>Name: {{userName}}</p>"); | |
var content = template({ userName: this.get('username') }); | |
this.set('model', this.store.createRecord('post', { content: content })); | |
false; | |
} | |
}); |
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
var template = get('template:example').compiledTemplateString; // how to actually do this? | |
var templateWithFilledInValues = template({ username: 'Mr. Whiskers', email: 'meow@example.com' }); |
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/serializers/feed.js | |
import DS from 'ember-data'; | |
export default DS.RESTSerializer.extend({ | |
typeForRoot: function() { | |
return this._super("micropost"); | |
} | |
}); |
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/sessions/custom.js | |
import Session from 'simple-auth/session'; | |
import Ember from 'ember'; | |
import ENV from 'hivebench-web/config/environment'; | |
export default Session.extend({ | |
currentUser: null, | |
setCurrentUser: function() { | |
// http://emberjs.com/guides/models/finding-records/ |
OlderNewer