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 'graph' # gem 'graph' | |
require 'openregister-ruby' # gem 'openregister-ruby', git: 'https://github.com/robmckinnon/openregister-ruby.git', branch: 'record-versions' | |
r = OpenRegister.register 'school-eng', :alpha | |
digraph do | |
rotate | |
node_attribs << rectangle | |
r._fields.each do |f| | |
if f.register.present? |
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
mix run -e 'stream = "x\ny" |> String.split() |> Stream.map(& &1); | |
IO.puts inspect stream |> Enum.at(0); | |
IO.puts inspect stream |> Enum.at(0);' | |
"x" | |
"x" | |
(echo x && echo y) | mix run -e 'stream = IO.stream(:stdio, :line); | |
IO.puts inspect stream |> Enum.at(0); | |
IO.puts inspect stream |> Enum.at(0);' | |
"x\n" |
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
gem install base32-crockford | |
irb | |
require 'base32/crockford' | |
Base32::Crockford.encode(10033530330) | |
=> "9B0Q1ET" | |
exit | |
cd address-data/data/address | |
grep 9B0Q1ET *.tsv | |
TQ258.tsv:2003-04-27T00:00:00Z 9B0Q1ET 8400765 GROUND FLOOR AND FIRST FLOOR [-0.1364013,51.5173220] 2015-04-20 |
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
`mkdir data` | |
%w[uk | |
street | |
school | |
school-type | |
school-tag | |
school-phase | |
school-gender | |
school-federation | |
school-admissions-policy |
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 'open-uri' | |
require 'nokogiri' | |
require 'json' | |
require 'pry' | |
require 'date' | |
require 'mechanize' | |
module UtiacScraper | |
extend self | |
def scrape_and_publish |
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
quote do: String.downcase("THIS") | |
# {{:., [], [{:__aliases__, [alias: false], [:String]}, :downcase]}, [], ["THIS"]} | |
quote do: String.downcase("THIS") |> inspect | |
# {:|>, [context: Elixir, import: Kernel], | |
# [{{:., [], [{:__aliases__, [alias: false], [:String]}, :downcase]}, [], | |
# ["THIS"]}, {:inspect, [], Elixir}]} | |
(quote do: String.downcase("THIS")) |> inspect | |
# "{{:., [], [{:__aliases__, [alias: false], [:String]}, :downcase]}, [], [\"THIS\"]}" |
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
{"orientation":"horizontal","item":[{"label":"7% logged in at least once","sublabel":"users created from 2015-10-01","axis":{"point":[0,20,40,60,80,100]},"range":{"red":{"start":0,"end":20},"amber":{"start":21,"end":80},"green":{"start":81,"end":100}},"measure":{"current":{"start":0,"end":7},"projected":{"start":0,"end":0}},"comparative":{"point":0}},{"label":"0% of acquired users completed \u003e 80%","sublabel":"users created from 2015-10-01","axis":{"point":[0,20,40,60,80,100]},"range":{"red":{"start":0,"end":20},"amber":{"start":21,"end":80},"green":{"start":81,"end":100}},"measure":{"current":{"start":0,"end":0},"projected":{"start":0,"end":0}},"comparative":{"point":0}}]} |
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
#!/bin/sh | |
# | |
# In your git repo: | |
# 1. save this file as: .git/hooks/pre-commit | |
# 2. chmod 755 .git/hooks/pre-commit | |
# | |
# An hook script to normalize what is about to be committed. | |
# Called by "git commit" with no arguments. | |
# Removes trailing whitespace if it exists from files. | |
# Replaces multiple blank lines with single blank line in files. |
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
<?xml version='1.0' encoding='UTF-8'?> <kml xmlns='http://www.opengis.net/kml/2.2'> <Document><Placemark><name>Albstadt</name> <Point> <coordinates>9.02131,48.2131</coordinates> </Point> </Placemark><Placemark><name>Ansbach</name> <Point> <coordinates>10.55753,49.31221</coordinates> </Point> </Placemark><Placemark><name>Aschaffenburg</name> <Point> <coordinates>9.11325,49.97952</coordinates> </Point> </Placemark><Placemark><name>Augsburg</name> <Point> <coordinates>10.88681,48.35421</coordinates> </Point> </Placemark><Placemark><name>Aken</name> <Point> <coordinates>12.03793,51.85043</coordinates> </Point> </Placemark><Placemark><name>Bayreuth</name> <Point> <coordinates>11.569,49.95091</coordinates> </Point> </Placemark><Placemark><name>Berlin-Biesdorf</name> <Point> <coordinates>13.54106,52.51607</coordinates> </Point> </Placemark><Placemark><name>Bielefeld</name> <Point> <coordinates>8.55198,52.0509</coordinates> </Point> </Placemark><Placemark><name>Bochum</name> <Point> <coordinates>7.28218,51.49559</coo |
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
module Wikipedia | |
class Client | |
# see http://en.wikipedia.org/w/api.php | |
BASE_URL = "http://:domain/:path?action=:action&format=json" | |
attr_accessor :follow_redirects | |
def initialize | |
self.follow_redirects = true | |
end |