var filter = function(array, fn) {
var result = [];
arr.forEach(function(){
if(fn(element)){
result.push(element);
}| #javascript | |
| var count = function(string){ | |
| var newString = string.split(" "); | |
| myObject = {}; | |
| for(var i = 0; i < newString.length; i++){ | |
| myObject[newString[i]] = newString[i].length | |
| } | |
| } |
| #TDD | |
| association :user, Factorygirl: :user | |
| bin/rails g migration add_user_references_to_campaigns user:references | |
| RAILS_ENV=test | |
| let(:pledge) {FactoryGirl.create(:pledge, {campaign: campaign, user: user})} | |
| call pledge |
| # | |
| gem rails-erd | |
| brew install graphviz | |
| bin/rake erd | |
| -------------------------------- |
| Rspec.feature "Campaigns", type: :feature do | |
| describe "Campaigns Listing" do | |
| it "displays a text 'Recent Campaigns'" do | |
| #this simulates users typing the 'campaign_path' in the address bar | |
| #to actually visit the page | |
| visit campaigns_path | |
| # we have acess to an object 'page' that contains the rendered HTML page | |
| # we can use it with RSpec Matchers to perform tests | |
| expect(page).to have text "Recent Campaigns" | |
| end |
gem 'simple_form'
-to work with bootstrap
rails generate simple_form:install --bootstrap
app/assets/stylesheets/bootstrap_and_overrides.scss @import "bootstrap-sprockets"; @import "bootstrap"
how to see branches git branch -v
how to build a brench git checkout -b intergration
git status on branch integration
git checkout -b
Big O notation
Binary Search is often offered as divide and conquer as the approach is often to take the middle and compare the values at that point. If the desired value does is greater than what is being compared you would ignore the first half of the values and take the last half and divide tht by half.
Recursion
#Api vesion control
-bin/rails g controller api/v1/questions
will generate api folder and v1
faraday gem can mimic http request
Omniauth GEM
apps.twitter.com
in the twitter create an app
in the required url http://127.0.0.1:3000/ or lvh.me:3000