{{ message }}

Instantly share code, notes, and snippets.

💭
Crafting

# Calinoiu Alexandru Nicolae alexandru-calinoiu

💭
Crafting
Last active Feb 14, 2021
View agilePool.json
 { "name": "AgilePool", "description": "Testing pool from Agile Freaks", "ticker": "AFPL", "homepage": "https://www.agilefreaks.com" }
Created Nov 4, 2018
Solve knights tour both recursively and iteratevely
View knights_tour.rb
 # 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
Created Nov 6, 2017
 require 'thread' q = Queue.new eq = Enumerator.new(-> { q.size }) do |y| loop do y << q.pop end end doubler = Thread.new do
Created Sep 7, 2017
View e2e.ts
 /** * 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';
Last active Jul 9, 2017
View function_strong_params.rb
 #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' } }
Last active May 22, 2017
My take on resilience inspired by https://johnnunemaker.com/resilience-in-ruby/
View resilience.rb
 class Client class NotificationsResponse attr_reader :content, :error def self.build(&block) error = false content = begin yield rescue Errno::ECONNREFUSED => exception error = exception
Created Apr 20, 2017