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 process_datum | |
self.raw_data.each do |datum| | |
company = Company.where(name: datum[1]).first_or_create(url: datum[2], cb_url: datum[3]) | |
a = datum[0].split("/").each_with_index {|e,i| e.insert(0,"20") if i == 1}.reverse.map {|e| e.to_i} | |
date = Date.new(a[0], a[1]) | |
event = Event.where(funding_type: datum[4], date: date, value: datum[5]).first_or_create | |
end | |
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
%nav.top-bar | |
%ul.title-area | |
%li.name | |
%h1 | |
= link_to "RubyWhiteBelts", root_path | |
%li.toggle-topbar.menu-icon | |
%a{:href=>"#"} | |
%span Menu | |
%section.top-bar-section | |
%ul.right |
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 'rspec' | |
class TicTacToe | |
attr_accessor :board, :turns | |
def initialize | |
@turns = 0 | |
@board = [] | |
9.times do |
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.rb calls | |
use OmniAuth::Builder do | |
provider :twitter, ENV['TWITTER_CONSUMER_KEY'], ENV['TWITTER_CONSUMER_SECRET'] | |
end | |
and cat ~/.bashrc | |
is |
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
Following steps at https://developers.google.com/accounts/docs/OAuth2WebServer | |
Step 1. submit a get request to the google api endpoint, below is example of my (seemingly) correctly formed get request | |
https://accounts.google.com/o/oauth2/auth?response_type=code&scope=https://mail.google.com/+https://www.googleapis.com/auth/userinfo.email+https://www.googleapis.com/auth/userinfo.profile&client_id=XXXXXXXXXXXX.apps.googleusercontent.com&redirect_uri=http://localhost:4567/oauth2callback&access_type=online | |
Step 2. receive a callback that contains an authorization code, below is the url I'm receiving back. | |
http://localhost:9393/oauth2callback?code=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY |
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
development: | |
adapter: postgresql | |
encoding: unicode | |
database: url_development | |
pool: 5 | |
username: jd | |
password: | |
host: localhost | |
port: 5432 | |
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
<html> | |
<head> | |
<script type="text/javascript"> | |
if (typeof Object.create !== 'function') { | |
Object.create = function (o) { | |
var F = function () {}; | |
F.prototype = o; | |
return new F(); | |
}; |
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
#HOW A LAMBDA WORKS | |
var1 = lambda {|x,y| puts x + y} | |
var1.call(1,0) | |
#running the above will result in 1 | |
#HOW YIELD WORKS | |
def method1 | |
yield | |
end | |
method1{ puts "this is a yield block"} |
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
#TO CREATE A NEW CLASS | |
module EvolutionarySkills | |
def breed_rapidly(howrapid) | |
puts newspecies.*(howrapid) | |
end | |
end | |
class SomeNewAnimal | |
include EvolutionarySkills |
NewerOlder