Skip to content

Instantly share code, notes, and snippets.

View kohgpat's full-sized avatar
🤖
...

Nikolay Burlov kohgpat

🤖
...
  • Russia, Siberia
View GitHub Profile

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert $1 -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 $2

Results

class Rover
attr_accessor :x, :y
def initialize(x, y, direction)
@x = x
@y = y
@direction = direction
@commands = []
end

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

var notify = require('gulp-notify');
function log() {
var args = Array.prototype.slice.call(arguments);
// Send error to notification center with gulp-notify
notify.onError({
title: 'Compile Error',
message: '<%= error %>'
}).apply(this, args);
@kohgpat
kohgpat / ruby_spreadsheet_example.rb
Created April 2, 2012 11:40
Ruby spreadsheet example
1 require 'spreadsheet'
# Open workbooks
current_workbook = Spreadsheet.open('jan.xls')
total_workbook = Spreadsheet.open('output.xls')
# Process xls
# Iterate through workbook spreadsheets
current_workbook.worksheets.each_with_index do |current_spreadsheet, spreadsheet_index|
@kohgpat
kohgpat / statistics.rb
Created April 19, 2012 17:00
Statistics from xml parcels
# encoding: UTF-8
require 'hpricot'
class Reporter
attr_accessor :path
attr_accessor :documents
def initialize(path)
@path = path
@kohgpat
kohgpat / remove_dups_from_array_by_key.rb
Created April 25, 2012 15:52
Remove dups from array by key
Hash[*a.map{|x| [x.text, x]}].values
a = [Thing.new('a'), Thing.new('b'), Thing.new('c'), Thing.new('c')]
# => [#<Thing a>, #<Thing b>, #<Thing c>, #<Thing c>]
Hash[a.map{|x| [x.text, x]}].values
# => [#<Thing a>, #<Thing b>, #<Thing c>]
class Thing
attr_reader :text
@kohgpat
kohgpat / duplicates.rb
Created April 30, 2012 12:42
Duplicates P023
# encoding: UTF-8
require 'builder'
require 'spreadsheet'
Spreadsheet.client_encoding = 'UTF-8'
class Person
attr_accessor :fam, :im, :ot, :w, :dr
attr_accessor :s_pol, :n_pol, :enp, :dp
@kohgpat
kohgpat / peoplescinema.rb
Created May 18, 2012 11:28
Peoples Cinema - Movies and Shows
# encoding: UTF-8
require 'nokogiri'
require 'open-uri'
require 'colorize'
doc = Nokogiri::HTML(open('http://www.peoplescinema.ru/cgi-bin/i10.cgi'))
puts "Peoples Park\n".colorize(:blue)
@kohgpat
kohgpat / peoplescinema.rb
Created May 18, 2012 11:28
Peoples Cinema - Movies and Shows - Today
# encoding: UTF-8
require 'nokogiri'
require 'open-uri'
require 'colorize'
doc = Nokogiri::HTML(open('http://www.peoplescinema.ru/cgi-bin/i10.cgi'))
puts "Peoples Park\n".colorize(:blue)