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
p = Project.find 1 | |
p.shared_at = nil | |
p.create_mode! | |
p.end_sharing = false | |
p.save |
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
[["Cseva", ["csevapcsicse"]], ["Cseva", ["masik", "cseva"]], ["Masik", ["harmadik"]], ["Egyik", ["masik"]]] | |
SearchIndex.delete! | |
SearchIndex.reset! | |
SearchIndex.purge! | |
res = SearchIndex.filter(term: {account_id: 1}).query( multi_match: { query: 'masik', fields: ['name', 'descriptions']}) | |
res.to_a | |
a = Subscribem::Account.find 1 | |
r = Recipe.scoped_to(a).first | |
t = r.tasks.first |
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 haml | |
gem install hpricot | |
gem install ruby_parser | |
gem install haml2slim | |
gem install html2slim | |
erb2slim -h |
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
be_odd | |
be_an | |
be_done | |
be_an_ufo calls ufo? | |
an_object_eq_to | |
an_object_having_attributes | |
a_string_starting_with | |
a_string_ending_with | |
a_string_matching | |
a_value |
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
#--- | |
# Excerpted from "Rails 4 Test Prescriptions", | |
# published by The Pragmatic Bookshelf. | |
# Copyrights apply to this code. It may not be used to create training material, | |
# courses, books, articles, and the like. Contact us if you are in doubt. | |
# We make no guarantees that this code is fit for any purpose. | |
# Visit http://www.pragmaticprogrammer.com/titles/nrtest2 for more book information. | |
#--- | |
require 'rails_helper' |
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' | |
response = Net::HTTP.get(URI('https://leanpub.com/book_search.json?search=ruby')) | |
ruby_books = JSON.parse(response) | |
ruby_books.each do |book| | |
url = book['url'] | |
doc = Nokogiri::Slop open(url.gsub('http', 'https')) | |
doc.remove_namespaces! |
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
<snippet> | |
<content><![CDATA[logger.${1:debug} "${2:your debug info}"]]></content> | |
<!-- Optional: Set a tabTrigger to define how to trigger the snippet --> | |
<tabTrigger>log</tabTrigger> | |
<!-- Optional: Set a scope to limit where the snippet will trigger --> | |
<scope>source.ruby</scope> | |
</snippet> | |
<snippet> | |
<content><![CDATA[Rails.logger.${1:debug} "${2:your debug info}"]]></content> |
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
Retrieve token from refresh Google: | |
curl -v -F refresh_token=1/947yjadmRUOuFcg9EKsIPt_A1z3hklTR1F_wnP7NIbw -F client_id=633713095109-t1d7unbqb8rjc9e88rtngi4fkpietaot.apps.googleusercontent.com -F client_secret=Be9G1-cA7-kCOm8nRAsCCPAB -F grant_type=refresh_token https://accounts.google.com/o/oauth2/token |
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
Ok: | |
curl --include \ | |
--request POST \ | |
--header "Content-Type: application/json" \ | |
--header "Authorization: 2c84ba63636d9555ee4dba8a610e704b5d1f8a1133179dec6ba9450f6ee4457ee0ae450672d3c7e6fcdce00a84ba73f4d5a403adb7677e9750ba68e5f00450d9" \ | |
--data-binary "{ \"token\": \"522aa06304052ff5a98cb482fb3a089a97c217fc3298d43146ebe65c2f8b65ac\", \"location\": \"New York\", \"participants\": [ {\"id\": 4} ], \"guests\": [ {\"email\": \"[email protected]\", \"first_name\": \"Johny\", \"last_name\": \"Cage\" } ]}" \ | |
'http://localhost:3000/api/v1/meetings/xx' | |
Ok: | |
curl -v \ |
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
describe 'ruby' do | |
context 'spiritual' do | |
specify do | |
expect(:ruby).to provide_happyness(:huge) | |
end | |
end | |
context 'material' do | |
specify do | |
expect(:good_salary).to be_present(:always) | |
end |