Skip to content

Instantly share code, notes, and snippets.

View rlisowski's full-sized avatar

Rafał Lisowski rlisowski

  • Warsaw, Poland
View GitHub Profile
@rlisowski
rlisowski / README.md
Created September 15, 2013 20:48 — forked from netmute/README.md

Game of Life

An implementation of Conway's Game of Life in 140 characters of Ruby.

Author

Created by Simon Ernst (@sier).

@rlisowski
rlisowski / ruby server with daemon.rb
Last active January 13, 2017 19:26
ruby daemonization
require 'fileutils'
class Server
#==========================================================================
VERSION = "1.0.0"
def self.run!
Server.new.run!
end
#!/bin/bash
#
# Script to setup a Elastic Beanstalk AMI with geospatial libraries and postGIS
#
# sh aws_ami_prep.sh > aws_ami_prep.log 2>&1 &
# Go to ec2-user home directory
cd /home/ec2-user
# yum libraries
regex = Regexp.new(/^[0-9]* (.*), (.*) [a-zA-Z]{2} [0-9]{5}(-[0-9]{4})?$/)
addresses = ["420 Fanboy Lane, Cupertino CA 12345"]
addresses << "1829 William Tell Oveture, by Gioachino Rossini 88421"
addresses << "114801 Western East Avenue Apt. B32, Funky Township CA 12345"
addresses << "1 Infinite Loop, Cupertino CA 12345-1234"
addresses << "420 time!"
addresses.each do |address|
print address
if address.match(regex)
@rlisowski
rlisowski / track_spec_times.rb
Created May 22, 2017 12:08
track specs times
SPEC_STATS = {}
SPEC_STAT_ENABLED = 'true' == ENV['SPEC_STAT']
RSpec.configure do |config|
config.before(:each) do
@__started = Time.now if SPEC_STAT_ENABLED
end
config.after(:each) do
if SPEC_STAT_ENABLED
@rlisowski
rlisowski / priority_queue.rb
Created August 27, 2017 18:42
Priority Queue
class Element
include Comparable
attr_accessor :name, :priority
def initialize(name, priority)
@name, @priority = name, priority
end
def <=>(other)
@rlisowski
rlisowski / capybara cheat sheet
Created September 28, 2017 06:10 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@rlisowski
rlisowski / new_ror_app.bash
Last active October 10, 2017 15:10
Generate new RubyOnRails app
rails new MapFilters -T --database=postgresql
@rlisowski
rlisowski / run_ror_app.bash
Created October 10, 2017 15:27
MapFilters
rake db:create
rake db:migrate
rails server
@rlisowski
rlisowski / convert.bash
Created October 11, 2017 09:34
convert map shapes
ogr2ogr -f "ESRI Shapefile" wgs84.shp shapes.shp -s_srs EPSG:27700 -t_srs EPSG:4326