I hereby claim:
- I am aks on github.
- I am aks (https://keybase.io/aks) on keybase.
- I have a public key ASCXHS3cbDV5-Um2mX-N5C1IeAz7NCPBbyW4JhcqcXXhrwo
To claim this, I am signing this object:
| #!/usr/bin/env ruby | |
| # mv-zeroes | |
| # | |
| # Beware! Today's exercise, which derives from an interview question asked at | |
| # Facebook, is trickier than it looks: | |
| # | |
| # You are given an array of integers. Write a program that moves all non-zero | |
| # integers to the left end of the array, and all zeroes to the right end of the | |
| # array. Your program should operate in place. The order of the non-zero | |
| # integers doesn't matter. As an example, given the input array |
| # lib/tasks/db.rake | |
| namespace :db do | |
| desc "Dumps the database to backups" | |
| task :dump => :environment do | |
| dump_fmt = 'c' # or 'p', 't', 'd' | |
| dump_sfx = suffix_for_format dump_fmt | |
| backup_dir = backup_directory true | |
| cmd = nil |
I hereby claim:
To claim this, I am signing this object:
| -- Read more about this program in the official Elm guide: | |
| -- https://guide.elm-lang.org/architecture/effects/time.html | |
| module Main exposing (..) | |
| import Html exposing (Html, div, br) | |
| import String exposing (padLeft, join) | |
| import Date | |
| import Color exposing (Color) |
| #!/usr/bin/env bash | |
| # install-pre-push-hook | |
| # this script installs the pre-push hook into the current .git repo. | |
| # by default, the pre-push hook protects the "master" branch. | |
| set_git_hooks_dir_path() { | |
| set_git_dir_path | |
| git_hooks_dir_path="$git_dir_path/hooks" | |
| if [[ ! -d "$git_hooks_dir_path" ]] ; then | |
| echo 1>&2 "$git_hooks_dir_path does not exist!" | |
| exit |
| #!/usr/bin/env ruby | |
| # | |
| def show_env(msg=nil) | |
| puts msg if msg | |
| puts "Rails.env = #{Rails.env}" | |
| puts "RAILS_ENV = #{ENV['RAILS_ENV']}" | |
| puts '' | |
| end |
| $ ruby threaded-class-variable-usage-test.rb | |
| #<Thread:0x007f8a329d6ea8>: New state = #<Thread:0x007f8a329d6ea8> | |
| #<Thread:0x007f8a329d6fe8>: New state = #<Thread:0x007f8a329d6fe8> | |
| #<Thread:0x007f8a329d7240>: New state = #<Thread:0x007f8a329d7240> | |
| #<Thread:0x007f8a329d7128>: New state = #<Thread:0x007f8a329d7128> | |
| #<Thread:0x007f8a329d5eb8>: New state = #<Thread:0x007f8a329d5eb8> | |
| #<Thread:0x007f8a329d6fe8>: State changed! my_name = #<Thread:0x007f8a329d6fe8>; Foo.state = #<Thread:0x007f8a329d5eb8> ; checks = 1 | |
| #<Thread:0x007f8a329d7240>: State changed! my_name = #<Thread:0x007f8a329d7240>; Foo.state = #<Thread:0x007f8a329d5eb8> ; checks = 1 | |
| #<Thread:0x007f8a329d7128>: State changed! my_name = #<Thread:0x007f8a329d7128>; Foo.state = #<Thread:0x007f8a329d5eb8> ; checks = 1 | |
| #<Thread:0x007f8a329d6ea8>: State changed! my_name = #<Thread:0x007f8a329d6ea8>; Foo.state = #<Thread:0x007f8a329d5eb8> ; checks = 2 |
| require 'rails_helper' | |
| require 'benchmark' | |
| RSpec.describe 'testing match vs includes' do | |
| let(:subject) { "This is the time for all good men to come to the aid of their country" } | |
| HOW_MANY_TIMES = 100_000 | |
| Benchmark.bm(10) do |bm| | |
| bm.report("match:") do |
| require 'rails_helper' | |
| require 'benchmark' | |
| RSpec.describe 'testing match vs includes' do | |
| let(:subject) { "This is the time for all good men to come to the aid of their country" } | |
| HOW_MANY_TIMES = 100_000 | |
| Benchmark.bm(10) do |bm| | |
| bm.report("match:") do |
| class CaptureOutput | |
| # Use in test examples to run a command *once*, and then | |
| # have the stdout and/or stderr available for testing | |
| # | |
| # out = CaptureOutput.run do | |
| # run_some_command | |
| # end | |
| # | |
| # expect(out.stdout).to match(/some output/) |