Skip to content

Instantly share code, notes, and snippets.

CSV_DATA = <<~TEXT
invoice_id,invoice_number
48010,10172
48086,10262
48106,10320
48107,10275
48165,10438
48193,10393
48194,10447
48218,10477
module Avia::Kiwi
class CallbacksProcessService
UndefinedStatusError = Class.new(StandardError)
attr_reader :params, :order
def initialize(params)
@params = params
@order = Avia::Kiwi::Order.find_by!(kiwi_bid: params[:bid])
Scripting Guake
Another great thing about Guake is that it is scriptable. I work on projects where I need 10 or more tabs to start everything up. That is just a click / command away with a simple Guake script. Here's an example that I'm using for a project:
#!/bin/sh
# open project notes
guake -e "cd ~/Dropbox/projects/project1" -r notes;
guake -e "vim"
Here is another possible solution, using the resolve attribute of the $stateProvider or the $routeProvider. Example with $stateProvider:
.config(["$stateProvider", function ($stateProvider) {
$stateProvider
.state("forbidden", {
/* ... */
})
All:
git filter-branch -f --env-filter "GIT_AUTHOR_NAME='Newname'; GIT_AUTHOR_EMAIL='new@email'; GIT_COMMITTER_NAME='Newname'; GIT_COMMITTER_EMAIL='new@email';" HEAD
Last:
git commit --amend --author "New Author Name <email@address.com>"
module ClearbitManager
PROSPECTOR_COUNT = 20
COLLEGE_RECRUITER_TITLES = [
'university recruiter',
'university relations',
'campus recruiter',
'college recruiter',
'head of graduate recruitment',
We couldn’t find that file to show.
path = ARGV[0]
ext = ["mp3"].join(",")
Dir.chdir(path) do
files = Dir.glob("*.{#{ext}}").shuffle!
files.each_with_index do |name, i|
i += 1
>> require "benchmark"
>> require "set"
>> array = ["a", -3.14, 0, []]
>> set = array.to_set
>> Benchmark.bm do |bench|
>> bench.report("array:") do
>> 1000.times { array.include? -3.14 }
>> end
it "responds with JSON" do
my_model = stub_model(MyModel,:save=>true)
MyModel.stub(:new).with({'these' => 'params'}) { my_model }
post :create, :my_model => {'these' => 'params'}, :format => :json
response.body.should == my_model.to_json
end