I hereby claim:
- I am dimitarvp on github.
- I am dimitarvp (https://keybase.io/dimitarvp) on keybase.
- I have a public key ASBdSxUelhzLTU9bJNlyRvrsYOjAyBMIkE5Fgc_sDAU-ego
To claim this, I am signing this object:
| defmodule Lists | |
| @doc """ | |
| Works similarly to `Enum.zip/2` but it also wraps around the second list parameter, | |
| for example `zip_cycle([1, 2, 3, 4], [:x, :y, :z])` yields `[{1, :x}, {2, :y}, {3, :z}, {4, :x}]`. | |
| It never produces more items than the length of the first list. | |
| """ | |
| def zip_cycle([h0 | t0] = _l0, [h1 | t1] = l1), | |
| do: zip_cycle(t0, t1, l1, [{h0, h1}]) | |
| def zip_cycle(_l0, _l1), do: [] |
I hereby claim:
To claim this, I am signing this object:
| defmodule Play do | |
| def test1 do | |
| src = %{createdAt: "2017-01-19T08:32:26+02:00"} | |
| dest = %{} | |
| dest = | |
| case Map.has_key?(src, :createdAt) do | |
| true -> | |
| {:ok, date, _} = DateTime.from_iso8601(src[:createdAt]) | |
| Map.put(dest, :createdAt, date) | |
| false -> |
| package main | |
| import ( | |
| "github.com/mitchellh/goamz/aws" | |
| "github.com/mitchellh/goamz/s3" | |
| "log" | |
| "net/http" | |
| "io" | |
| ) |
| # Given this auth helper in spec/support/ directory... | |
| module AuthHelpers | |
| def add_token_to_params(token) | |
| request.params.merge!({sessionToken: token}) # also tried 'request.params[:sessionToken] = token' | |
| end | |
| end | |
| # Given this test... | |
| class ThingController | |
| describe Thing do |
| require 'awesome_print' | |
| input = <<TEXT | |
| 2 1 app/assets/javascripts/bar.js | |
| 16 25 app/assets/javascripts/baz.js.coffee | |
| 1 1 app/assets/javascripts/foo.js.coffee | |
| 4 9 app/controllers/bar_controller.rb | |
| 3 2 app/controllers/baz_controller.rb | |
| 11 0 app/controllers/foo_controller.rb | |
| 3 2 db/schema.rb |
| # Alternative way of getting all Gem details using the official Rubygems REST API (thanks @qrush) | |
| require 'open-uri' | |
| require 'active_support/json' | |
| require 'awesome_print' | |
| ap ActiveSupport::JSON.decode(open("http://rubygems.org/api/v1/gems/#{ARGV[0]}.json")) |