Skip to content

Instantly share code, notes, and snippets.

View kany's full-sized avatar

Frank Kany kany

  • Rickman, TN
View GitHub Profile
@kany
kany / rubocop.sh
Created January 14, 2015 18:40
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
run_rubocop(){
if gem list | gem list | grep 'rubocop\|rubocop-rspec' ; then
@kany
kany / sendmail_setup.md
Last active September 22, 2023 00:16
Setup SENDMAIL on Mac OSX Yosemite
@kany
kany / compile_less
Last active March 27, 2017 13:00
compile '.less' files into '.css' files
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 / libv8.rb
Created April 23, 2015 21:24
libv8 issues
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 / airbrake.rb
Created October 26, 2015 19:43
Test Airbrake From Rails Development Environment
# 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 / index.txt
Created December 30, 2015 17:09 — forked from gus/index.txt
Ruby/Clojure analogs
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 / raw_sql_to_calculate_distance.rb
Last active September 26, 2016 16:10
Use raw sql to calculate distance between latitude/longitude coordinates
# 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 / Deploy-ReactVR-To-Heroku.md
Last active November 6, 2019 11:07
Deploy Facebooks' React VR `TourSample` to Heroku in 5 minutes or less
@kany
kany / formatting_xml_or_json.rb
Created February 12, 2019 11:50
Formatting XML or JSON
# resource - http://richardlog.com/post/12743073497/pretty-printing-json-and-xml-on-mac-osx
# Formatting XML
cat unformatted.xml | xmllint --format - > formatted.xml
# Formatting JSON
cat unformatted.json | python -m json.tool > formatted.json
@kany
kany / README.md
Last active September 20, 2019 01:37
Toggle Wireless Mode

Toggle Wireless Mode

This script will allow switching between managed and monitor mode for a wireless adapter.

Managed mode is the default wireless adapter mode.

Monitor mode allows monitoring all traffic received on a wireless channel and allows packets to be captured without having to associate with an access point.

Environment