Skip to content

Instantly share code, notes, and snippets.


Frank Kany kany

  • Rickman, TN
View GitHub Profile
kany /
Last active Nov 6, 2019
Deploy Facebooks' React VR `TourSample` to Heroku in 5 minutes or less
kany / raw_sql_to_calculate_distance.rb
Last active Sep 26, 2016
Use raw sql to calculate distance between latitude/longitude coordinates
View raw_sql_to_calculate_distance.rb
# Use raw sql to calculate distance between latitude/longitude coordinates
# From the web
# -
id, (
3959 * acos (
cos ( radians(78.3232) )
* cos( radians( lat ) )
* cos( radians( lng ) - radians(65.3234) )
kany / index.txt
Created Dec 30, 2015 — forked from gus/index.txt
Ruby/Clojure analogs
View index.txt
For each Ruby module/class, we have Ruby methods on the left and the equivalent
Clojure functions and/or relevant notes are on the right.
For clojure functions, symbols indicate existing method definitions, in the
clojure namespace if none is explicitly given. clojure.contrib.*/* functions can
be obtained from,
ruby-to-clojure.*/* functions can be obtained from the source files in this
If no method symbol is given, we use the following notation:
kany / airbrake.rb
Created Oct 26, 2015
Test Airbrake From Rails Development Environment
View airbrake.rb
# Add 'config.development_environments = []' to config/initializers/airbrake.rb
Airbrake.configure do |config|
config.api_key = "1234"
config.environment_name = AppConfig.environment if AppConfig.environment = true
config.development_environments = []
# Test it out in the console
1) rails console
kany / libv8.rb
Created Apr 23, 2015
libv8 issues
View libv8.rb
gem uninstall libv8
brew install v8
gem install therubyracer
gem install libv8 -v '' -- --with-system-v8
kany / compile_less
Last active Mar 27, 2017
compile '.less' files into '.css' files
View compile_less
gem install less --no-ri --no-rdoc
gem install therubyracer --no-ri --no-rdoc
lessc app/assets/stylesheets/less/mobile/common/core.less > app/assets/stylesheets/css/mobile/core.css
1) delete associated css file(s) for modified less file(s) from public/assets/***.css
2) bundle exec rake assets:precompile
kany /
Last active Nov 23, 2021
Setup SENDMAIL on Mac OSX Yosemite
kany /
Created Jan 14, 2015
rubocop - script to install rubocop and rubocop-rspec gems before running rubocop
# -------
# rubocop
# -------
# example usage:
# check a directory: rubocop app/controllers
# check a file: rubocop app/controllers/application_controller.rb
# check rspec directory: rubycop spec/controllers
# check rspec file: rubycop spec/controllers/application_controller_spec.rb
if gem list | gem list | grep 'rubocop\|rubocop-rspec' ; then
kany / cropper.rb
Created Sep 24, 2014
Cropping images with paperclip
View cropper.rb
# lib/paperclip_processors/cropper.rb
module Paperclip
class Cropper < Thumbnail
def transformation_command
if crop_command
puts "CROP: #{crop_command + super.join(' ').sub(/ -crop \S+/, '').split(' ')}"
crop_command + super.join(' ').sub(/ -crop \S+/, '').split(' ')
kany /
Last active Nov 19, 2020
Clearing dead/stuck/zombie Resque workers redis resque delayed_job

$ rails c

Loading development environment (Rails 3.1.3)
1.9.3p0 :002 > Resque::Worker.working.each{|w| w.done_working}

$ redis-cli

# Removes data from your connection's CURRENT database.