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
{ | |
"name": "AgilePool", | |
"description": "Testing pool from Agile Freaks", | |
"ticker": "AFPL", | |
"homepage": "https://www.agilefreaks.com" | |
} |
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
# A knight is placed on a square of the board, moving according to the rules of the chess he must visit each square exactly once | |
N = 8 | |
sol = Array.new(N) { Array.new(N) { :not_visited } } | |
def print_solution(sol) | |
sol.each do |line| | |
line.each { |char| print "#{char} " } | |
puts |
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 'thread' | |
q = Queue.new | |
eq = Enumerator.new(-> { q.size }) do |y| | |
loop do | |
y << q.pop | |
end | |
end | |
doubler = Thread.new do |
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
/** | |
* e2e task | |
* | |
* You should have the server up and running before executing this task. e.g. run `au run`, otherwise the | |
* protractor calls will fail. | |
*/ | |
import { build, CLIOptions } from 'aurelia-cli'; | |
import * as del from 'del'; | |
import * as eventStream from 'event-stream'; | |
import * as gulp from 'gulp'; |
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
#inspired by http://blog.martinosis.com/blog/simple-functional-strong-params-in-ruby/ | |
require 'pp' | |
filter_hash = -> keys, params { | |
keys.map { |key| [key, params[key]] }.to_h | |
}.curry | |
params = { name: 'Ion', age: 42, pwd: 'plain', contact: { address: 'Danil Ionescu' } } |
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
class Client | |
class NotificationsResponse | |
attr_reader :content, :error | |
def self.build(&block) | |
error = false | |
content = begin | |
yield | |
rescue Errno::ECONNREFUSED => exception | |
error = exception |
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
class Enqueue | |
include Dry::Monads::Either::Mixin | |
include IngestService::Import['enqueue'] | |
def call(step, input, *args) | |
enqueue.call(step.operation_name, input, args) | |
Right(input) | |
end | |
end |
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
query { | |
movie(id: 1) { | |
title | |
shortname | |
release_year | |
extras(first: 25) { | |
images { | |
hero { | |
16_9 |
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
class VideoPresenter | |
def initialize(db_video, facebook_video) | |
@facebook_id = db_video[:id] | |
@age = facebook_video[:age] | |
end | |
end | |
db_videos = [{ id: 42, name: 'Ion' }, { id: 43, name: 'Gheo' }] | |
facebook_videos = [{ facebook_id: 43, age: 42 }, { facebook_id: 44, age: 43 }] |
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 'pp' | |
class Graph | |
def initialize(graph = {}) | |
@hash = graph.freeze | |
end | |
def add_vertex(node) | |
Graph.new(@hash.merge(Hash[node, { edges: {}.freeze }]).freeze) | |
end |
NewerOlder