Skip to content

Instantly share code, notes, and snippets.


Marko Anastasov markoa

View GitHub Profile
View find_unused_helpers.rb
#!/usr/bin/env ruby
# Shotgun approach (read: slow and dirty hack) to help find unused helpers in a Rails application
puts "Loading all source files into memory :("
source = {}
Dir["app/**/**/*.*"].each do |f|
next if f.include?("app/assets")
markoa / postgis
Last active December 27, 2015 02:08 — forked from Jesterovskiy/postgis
View postgis
echo "deb precise-pgdg main" | sudo tee -a /etc/apt/sources.list.d/pgdg.list
wget --quiet -O - | sudo apt-key add -
sudo apt-get update
sudo apt-get install -y postgresql-9.3-postgis-2.1 postgresql-9.3-postgis-2.1-scripts
markoa / log.log
Created October 17, 2013 10:31
Error while running `bundle install` with RubyGems 2.1.9 on Ubuntu 12.04.
View log.log
Fetching source index from
Could not verify the SSL certificate for
There is a chance you are experiencing a man-in-the-middle attack, but most
likely your system doesn't have the CA certificates needed for verification. For
information about OpenSSL certificates, see To connect without
using SSL, edit your Gemfile sources and change 'https' to 'http'.
markoa / config.rb
Created September 12, 2013 08:52
Current Middleman configuration
View config.rb
# Blog settings
# = "UTC"
activate :blog do |blog|
blog.prefix = "blog"
blog.permalink = ":year/:month/:day/:title.html"
blog.sources = "posts/:year-:month-:day-:title.html"
markoa /
Last active December 19, 2015 11:19

Workaround for Semaphore regression on 2013-07-07/08, bundler missing for Ruby 1.9.2.

If your project is using Ruby 1.9.2, add these build setup commands to avoid the regression:

rbenv local 1.9.2-p320
gem install bundler --no-ri --no-rdoc

Update: regression has been fixed

markoa / irb.rb
Created February 21, 2013 11:55
How to shut up irb
View irb.rb
# either irb --noecho, or
conf.echo = false
markoa / application_controller.rb
Created March 5, 2012 09:16
Log every exception when in Cucumber
View application_controller.rb
class ApplicationController < ActionController::Base
rescue_from Exception do |exception|
logger.error exception.backtrace.join("\n")
head 500
markoa / user.rb
Created February 22, 2012 12:19 — forked from darkofabijan/user.rb
View user.rb
class User < ActiveRecord::Base
def find_form(id)
markoa /
Last active September 27, 2016 12:58
Stuff I usually need in ~/.bash_profile
set -o vi
eval `ssh-agent`
ssh-add ~/.ssh/id_rsa
export PS1="\w ★ "
export LANGUAGE="en"
export LANG="C"
export LC_MESSAGES="C"
markoa / gist:1596632
Created January 11, 2012 20:37
what to paste in application controller when cucumber doesn't tell you what failed in the view
View gist:1596632
class ApplicationController < ActionController::Base
rescue_from 'Exception' do |exception| exception exception.backtrace.join("\n")
render :head => 500