Skip to content

Instantly share code, notes, and snippets.

@maksar
maksar / parallel_assets_compiler.gemspec
Created September 19, 2012 09:31 — forked from joerichsen/parallel_assets_compiler.gemspec
Microgem for compiling assets in parallel
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'parallel_assets_compiler'
s.version = '0.2.2'
s.platform = Gem::Platform::RUBY
s.author = 'Jørgen Orehøj Erichsen'
s.email = 'joe@erichsen.net'
s.summary = 'Compile assets in parallel'
s.description = 'Compile assets in parallel to speed up deployment'
@maksar
maksar / identification_strategy.rb
Last active January 4, 2016 14:29
identification service
class IdentificationStrategy
def initialize origin, priorities
@origin = origin
@priorities = [priorities].flatten
end
def branch candidates
case candidates.length
when 0
zero
class IdentificationStrategy
def initialize origin, priorities
@origin = origin
@priorities = [priorities].flatten
end
def branch candidates
case candidates.length
when 0
zero
@maksar
maksar / sample.feature
Created January 26, 2014 21:29
feature
Feature: Identification process
Background:
Given following EGRUL source configuration
| step | suspicious_threshold | identification_threshold |
| 1 | 0 | 90 |
| 2 | 65 | 90 |
And following attributes weights
| inn | kpp | ogrn | okpo | short_name | full_name |
| 90 | 10 | 90 | 85 | 5 | 5 |
And following priorities
permissionProducer : Producer Permission
permissionProducer =
let permission i = case i of
1 -> VOTE
2 -> FORCE
_ -> NONE
in Check.Producer.map permission <| rangeInt 0 2
userProducer : Producer User
userProducer =
require 'set'
class Workflow
def initialize(steps_config)
@steps_config = steps_config
@current_step = 0
@votes = Array.new(steps_config.size) { Set.new }
end
def approve(actor)
@maksar
maksar / makeapp.sh
Created June 6, 2017 08:11 — forked from demonbane/makeapp.sh
Create a Fluid-style app launcher for single-window Chrome instances on OSX
#!/bin/sh
echo "What should the Application be called (no spaces allowed e.g. GCal)?"
read inputline
name="$inputline"
echo "What is the url (e.g. https://www.google.com/calendar/render)?"
read inputline
url="$inputline"
#!/usr/bin/env ruby
# Copyright: https://gist.github.com/skanev/9d4bec97d5a6825eaaf6
# A sneaky wrapper around Rubocop that allows you to run it only against
# the recent changes, as opposed to the whole project. It lets you
# enforce the style guide for new/modified code only, as opposed to
# having to restyle everything or adding cops incrementally. It relies
# on git to figure out which files to check.
#
def solution(input)
log_sum = input.map { |i| Math.log10(i) }.sum
input.map { |i| (10**(log_sum - Math.log10(i))).round }
end
def solution(input)
log_sum = input.map { |i| Math.log10(i) }.sum
input.map { |i| (10**(log_sum - Math.log10(i))).round }
end