This file contains hidden or 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
show dbs | |
use my_db | |
show collections | |
db.printCollectionStats() | |
db.things.find( {}, { _id:1 } ) # All documents ids | |
db.things.find ( { _id: ObjectId("daf3424234dsf12334f") } ).count() |
This file contains hidden or 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
:%s/\s\+$// |
This file contains hidden or 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
find spec/ -type file | xargs grep "p " | cut -d " " -f 1 | sort | uniq |
This file contains hidden or 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
JSON.parse(open("https://www.scripted.com/formats/").read).take(1) |
This file contains hidden or 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
for run in {1..10} | |
do | |
command | |
done |
This file contains hidden or 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
# print the numbers 1 to 5 | |
(1..5).each do |page| | |
puts page | |
end | |
# print a url string with a page number inside | |
(1..5).each do |page| | |
puts "http://blog/scripted.com/page/#{page}" | |
end |
This file contains hidden or 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 'rack/test' | |
browser = Rack::Test::Session.new(Rack::MockSession.new(Fooproject::Application)) | |
browser.get("/posts.json") | |
browser.post("/posts.json", {:id => 1}) |
This file contains hidden or 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 'rack' | |
params = "car[][color]=blue&car[][doors]=2&car[][model][name]=acme&car[][model][country]=usa" | |
Rack::Utils.parse_nested_query(params) |
This file contains hidden or 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
puts "\033[32m-\033[0m" * 79 |