- Refactor Tractor
- Programming is fun with Nate
//------------------------------------------------------------- Split the string on new lines | |
var text = "What are you talking about?" | |
split(text); | |
// #=> ["What", "are", "you", "talking", "about?"] | |
//------------------------------------------------------------- Reverse the order of the words | |
var text = "What are you talking about?" | |
reverseOrder(text); |
require "net/http" | |
require "json" | |
require "pry" | |
class PokemonService | |
def pokemon_information(info) | |
path = "pokemon/#{info}" | |
send_request(path: path) | |
end |
- Code: https://github.com/applegrain/oauth-example
- OAuth Protocol: http://tools.ietf.org/html/rfc6749#section-1.2
- Omniauth: https://github.com/intridea/omniauth
-
Create an app on github (make sure the callback url is http://localhost:3000/auth/github/callback)
-
Add an initializer, config/initializers/omniauth.rb
// aka root component | |
var Dashboard = React.createClass({ | |
getInitialState: function() { | |
return { headerIsActive: false } | |
}, | |
onButtonClick: function() { | |
console.log('in DASHBOARD!!'); | |
}, |
An enumerable is an object that may be enumerated. "Enumerated" means to count off the members of a set/collection/category one by one (usually in order, usually by name).
"Enumerable" is Ruby's way of saying that we can access each element in a collection, one at a time. Enumerable is a mixin in the Array class and it provides several enumerators such as each, map, select and many more. Find all enumerables and enumerators in the Ruby docs.
Ruby has a tons of enumerables which means that if we pick the right enumerable for the job, our implementation will be very clean and easy to read.
This week we are going to be writing enumerables from scratch. The groups are only allowed to use each, until loops, while loops and for loops.
$(document).ready(function() { | |
renderAllItems(); | |
fetchToken(); | |
}); | |
function fetchToken() { | |
$.ajax({ | |
url: '/api/v1/env_variables.json', | |
type: 'GET', | |
success: function(response) { |
Minitest provides some handy methods which allows us to check for falsey/truthy values and actually compare values.
assert
- The first argument passed to this method is whatever we are going to assert is truthy. For example,
assert "Hello"
returns true since"Hello"
is a truthy value. - The second argument passed to this method is an optional error message. If no argument is given, it will default to
Failed Assertion, no message given
. For example,assert nil, "Nil is falsey"
will fail, and the error message printed in the terminal will be"Nil is falsey"
.
- The first argument passed to this method is whatever we are going to assert is truthy. For example,
assert_equal
- This method takes two arguments. As the name of the method indicates, we are asserting an equality of the two given values.
refute
{ | |
"always_show_minimap_viewport": true, | |
"bold_folder_labels": true, | |
"color_scheme": "Packages/Material Theme/schemes/Material-Theme.tmTheme", | |
"font_face": "Inconsolata", | |
"font_options": | |
[ | |
"gray_antialias" | |
], | |
"font_size": 18, |