Skip to content

Instantly share code, notes, and snippets.

Avatar

Frank Kany kany

  • Rickman, TN
View GitHub Profile
@kany
kany / Deploy-ReactVR-To-Heroku.md
Last active Nov 6, 2019
Deploy Facebooks' React VR `TourSample` to Heroku in 5 minutes or less
View Deploy-ReactVR-To-Heroku.md
@kany
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
# - http://gis.stackexchange.com/questions/31628/find-points-within-a-distance-using-mysql
"SELECT
id, (
3959 * acos (
cos ( radians(78.3232) )
* cos( radians( lat ) )
* cos( radians( lng ) - radians(65.3234) )
@kany
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 http://github.com/kevinoneill/clojure-contrib/tree/master,
ruby-to-clojure.*/* functions can be obtained from the source files in this
gist.
If no method symbol is given, we use the following notation:
@kany
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
config.secure = true
config.development_environments = []
end
# Test it out in the console
1) rails console
@kany
kany / libv8.rb
Created Apr 23, 2015
libv8 issues
View libv8.rb
http://stackoverflow.com/questions/24081473/how-to-install-therubyracer-gem-on-10-10-yosemite
gem uninstall libv8
brew install v8
gem install therubyracer
gem install libv8 -v '3.16.14.3' -- --with-system-v8
@kany
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
kany / sendmail_setup.md
Last active Nov 23, 2021
Setup SENDMAIL on Mac OSX Yosemite
View sendmail_setup.md
@kany
kany / rubocop.sh
Created Jan 14, 2015
rubocop - script to install rubocop and rubocop-rspec gems before running rubocop
View rubocop.sh
# -------
# 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
run_rubocop(){
if gem list | gem list | grep 'rubocop\|rubocop-rspec' ; then
@kany
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(' ')
else
super
end
@kany
kany / redis-resque-stuff.md
Last active Nov 19, 2020
Clearing dead/stuck/zombie Resque workers redis resque delayed_job
View redis-resque-stuff.md

$ 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.