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
<div class="clearfix top-space small"></div> | |
<div class="row"> | |
<%= render :partial => 'shared/left_nav' %> | |
<div class="panel panel-default col-md-8 text-left"> | |
<div class="pull-left"> | |
<h4>Twets</h4> | |
</div> | |
<div class="clearfix"></div> |
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 'nokogiri' | |
require 'open-uri' | |
puts "Enter a word" | |
@word = gets.chomp! | |
@key = 'api-key-goes-here' | |
@type = 'learner' | |
page = Nokogiri::XML(open("http://www.dictionaryapi.com/api/v1/references/#{@type}/xml/#{@word}?key=#{@key}")) |
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
#!/usr/bin/env ruby | |
require 'koala' # gem install koala --no-ri --no-rdoc | |
# create a facebook app and get access token from here | |
# https://developers.facebook.com/tools/explorer | |
# select "groups", "photos" when authenticating | |
oauth_access_token = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' | |
group_filtering_words = ['ruby'] | |
image_path = 'image.png' #change to your image path | |
message = 'My Cool image.' # your message |
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
source 'https://rubygems.org' | |
gem 'rails', "3.2.10" | |
# omitted | |
group :stage, :production do | |
gem 'pg' | |
gem 'unicorn' | |
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
page 34: | |
refactoring into a partial isn't explicitly mentioned. Maybe mention that if you just drop the block on page 34 into the existing ```dashboard.html```, then the submit button needs to have params passed into it: | |
<input type="submit" class="btn btn-sm btn-primary" ng-click="showShareBox=!showShareBox;share(recipient, article)" | |
ng-disabled="shareForm.$invalid" value="Share"> | |
Page 36 | |
Earlier in the book, the routes namespace resources :shares under :api. The controller needs to be created in app/controllers/api/shares_controller.rb, right? Otherwise throws uninitialized constant API error. FYI, sample app does not namespace this controller/route, contrary to the book. |
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
//code school approach | |
app.controller('LibraryController', function(){ | |
this.books = getBooks //some function that gets an array | |
}); | |
//in the view | |
<div ng-controller="LibraryController as libraryCtrl"> | |
<ul> |
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
Angular form post | |
Started PUT "/api/v1/articles/3" for 127.0.0.1 at 2014-06-02 07:18:52 +0900 | |
Processing by Api::V1::ArticlesController#update as HTML | |
Parameters: {"title"=>"puy98y89y", "body"=>"asdfasdfsdfds\nkjlj", "id"=>"3", "categories"=>[{"name"=>"OOP", "id"=>6}], "category_ids"=>[2, 3, 4], "article"=>{"id"=>"3", "title"=>"puy98y89y", "body"=>"asdfasdfsdfds\nkjlj"}} | |
form: | |
<form name="newArticleForm" ng-submit="newArticleForm.$valid && postArticle(activeArticle)" novalidate> | |
<label>Article Title</label> |
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
lrwxr-xr-x 1 evan admin 36 Jun 14 18:09 gulp -> ../lib/node_modules/gulp/bin/gulp.js | |
$ which gulp | |
/usr/local/bin/gulp | |
$ gulp | |
[18:22:17] Local gulp not found in ~/thinkful_projects/angular/unit2/angular-weather-app | |
[18:22:17] Try running: npm install gulp | |
$ npm install gulp |
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
.factory('owmNearby', ['owmRequest', '$interpolate', 'OWM_LAT_LNG_PATH', | |
function(owmRequest, $interpolate, OWM_LAT_LNG_PATH) { | |
return function(lat, lng) { | |
var path = $interpolate(OWM_LAT_LNG_PATH)({ | |
lat : lat, | |
lng : lng | |
}); | |
return owmRequest(path); | |
} | |
}]) |
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
//factory returns entire API response, controller is responsible for parsing the return value | |
.factory('CapitalData', function(API_AUTH, $http, $q, SEARCH_PATH){ | |
return function(countryId, capital){ | |
var defer = $q.defer(); | |
$http.get(SEARCH_PATH+'&name_equals='+capital+'&country='+countryId+API_AUTH) | |
.success(function(data){ | |
defer.resolve(data); | |
}); | |
return defer.promise; |
OlderNewer