require 'benchmark'
def random_arr(n)
sports = ['soccer', 'hockey', 'basketball']
type = ['players', 'teams']
arr = []
n.times do |i|
arr << "/#{sports.sample}/#{type.sample}/#{rand(100)}"
end
This file contains 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
# 298 character CGOL in Julia. (Would fit into a tweet if not for the | |
# pretty-printing / animation loop!). It goes through 99 generations. | |
# | |
# Works using matrix operations, starts with randomly generated board. | |
# Parameters by line (uppercase are matrices): | |
# | |
# 1. `d` = size of board `(dxd)`. | |
# 2. S game / map state in 1 and 0 values for on/off. | |
# 3. `U` = shift board up if left-multiplied, right if right-multiplied. `D` = | |
# down, left. |
This file contains 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
# Buggy and incomplete LISP-ish interpreter based mostly on the | |
# SICP Chapter 4 metacircular | |
# evaluator with a few changes to better suit Julia implementation. | |
# | |
# I also added a simple parser since the host language is not S-expression | |
# based. The parser generates arrays, which can cause some bugs... maybe | |
# at some point I'll make the interpreter properly cons-list based | |
# but I have to go shower now. | |
This file contains 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
defmodule UdioDb.Hooks do | |
@moduledoc """ | |
This module macro defines the following functions within the model, | |
delegating to `Repo`, but allowing us to add `after_*` hooks, | |
which are no longer supported in Ecto | |
(http://blog.plataformatec.com.br/2015/12/ecto-v1-1-released-and-ecto-v2-0-plans/) | |
delete, | |
delete!, | |
delete_all, |
This file contains 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
azurerm_virtual_machine.core-build: Still creating... (10s elapsed) | |
2016/05/18 00:11:18 [DEBUG] vertex root, waiting for: provisioner.file (close) | |
2016/05/18 00:11:18 [DEBUG] terraform-provider-azurerm: 2016/05/18 00:11:18 [DEBUG] Sending Azure RM Request "GET" to "https://management.azure.com/ ... " | |
2016/05/18 00:11:19 [DEBUG] terraform-provider-azurerm: 2016/05/18 00:11:19 [DEBUG] Received Azure RM Request status code 200 OK for https://management.azure. ..." | |
2016/05/18 00:11:19 [DEBUG] root: eval: *terraform.EvalWriteState | |
2016/05/18 00:11:19 [DEBUG] root: eval: *terraform.EvalApplyProvisioners | |
2016/05/18 00:11:19 [DEBUG] root: eval: *terraform.EvalIf | |
2016/05/18 00:11:19 [DEBUG] root: eval: *terraform.EvalWriteDiff | |
2016/05/18 00:11:19 [DEBUG] root: eval: *terraform.EvalIf | |
2016/05/18 00:11:19 [DEBUG] root: eval: *terraform.EvalSequence |
This file contains 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
class Response::Onboarding | |
def initialize(command) | |
@command = command | |
end | |
def run | |
OnboardingJob.perform_async(@command) | |
end | |
end |
This file contains 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
.-------------------. .-------------------. | | |
| SlackController | | KickController | | Receive commands | |
'-------------------' '-------------------' | from users. | |
| | | | |
v v | | |
.------------------. .----------------. | | |
| IncomingSlackJob | | IncomingKikJob | | Kick off async jobs. | |
'------------------' '----------------' | | |
| | | | |
v v | |
This file contains 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
class Conversation | |
GOOD_ANSWERS = ["great", "awesome", "radical", "good"] | |
BAD_ANSWERS = ["shitty", "terrible", "bad"] | |
def initialize | |
@ended = false | |
end | |
def ended | |
@ended |
This file contains 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
diff --git a/Gemfile b/Gemfile | |
index d735be0..be79ed8 100644 | |
--- a/Gemfile | |
+++ b/Gemfile | |
@@ -21,6 +21,7 @@ gem 'unicorn' | |
group :development, :test, :staging do | |
gem 'httplog', require: false | |
gem 'pry-byebug' | |
+ gem 'pry-doc' | |
end |
This file contains 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
shared_examples 'BlueprintBase' do | |
subject { described_class.new('') } | |
describe '#alert_type' do | |
it "is defined" do | |
expect(subject.alert_type).to eq(alert_type) | |
end | |
end | |
end |
NewerOlder