- get the Repo's hash from the Gist URL
- the writable URL is:
git@gist.github.com:<hash>
git@gist.github.com:<hash>
bars = | |
FooIndex::Bar.all. | |
query(range: {start_date: {lt: "2018-03-31"}}). | |
query(range: {end_date: {gt: "2018-03-31"}}). | |
load.to_a |
#!/usr/bin/env ruby | |
require "fileutils" | |
require "rake" | |
ROOT = File.expand_path(ARGV[0] || ".", Dir.pwd) | |
ANDROID_MATCH = / | |
\/ # The whole file name | |
(IMG|VID) # starts with an image or film indicator. | |
_ # An underscore is followed by |
#!/usr/bin/env bash | |
hostname=$1 | |
online-certificate $hostname | \ | |
openssl x509 -inform pem -noout -enddate |
# Upload an item with an image field | |
export DATO_CMS_API=https://site-api.datocms.com | |
export DATO_CMS_API_TOKEN={{your read-write API token}} | |
# Get info about your Models (item-types): | |
curl \ | |
-H "Authorization: Api-Key $DATO_CMS_API_TOKEN" \ | |
-H "Accept: application/json" \ |
defp combine(list1, list2) do | |
Keyword.merge(keyword_list(list1), keyword_list(list2), fn _k, _v1, v2 -> | |
v2 | |
end) | |
end | |
def keyword_pair({key, value}) when is_atom(key) do | |
{key, value} | |
end | |
def keyword_pair({key, value}) do |
defimpl JSX.Encoder, for: Tuple do | |
def json({__t1, __t2}) when is_list(i1) do | |
[:start_object, "__t1", __t1, "__t2", JSX.encode!(__t2), :end_object] | |
end | |
def json({__t1, __t2}) do | |
[:start_object, "__t1", __t2, "tuple_list", __t2, :end_object] | |
end | |
end |
require: rubocop-rspec | |
AllCops: | |
Exclude: | |
- "bin/**/*" | |
- ".bundle/**/*" | |
- "bundle/**/*" | |
- "db/schema.rb" | |
- "node_modules/**/*" |
class MyHistory { | |
constructor(...args) { | |
this.callback = null; | |
} | |
listen(callback) { | |
console.log("listen"); | |
this.callback = callback; | |
return () => { this.unlisten() }; | |
} |
def dump_table(sums) | |
sums.each.with_index { |row, sum| puts "#{sum}: #{row.inspect}" } | |
end | |
def solvable?(set, size, sum) | |
sums = (0 .. sum).map do |i| | |
(0 .. size).map do |j| | |
nil | |
end | |
end |