Skip to content

Instantly share code, notes, and snippets.

View bhushangahire's full-sized avatar

Bhushan Ahire bhushangahire

View GitHub Profile
@bhushangahire
bhushangahire / Gemfile
Created December 13, 2017 16:19 — forked from goncalvesjoao/Gemfile
Changes you need to make in order to make Devise use JWT Header Authentication
# Add the "https://github.com/jwt/ruby-jwt" gem to your "Gemfile"
gem 'jwt'
@bhushangahire
bhushangahire / active_admin.rb
Created July 19, 2017 16:06 — forked from tinynumbers/active_admin.rb
ActiveAdmin controller extension to persist resource index filters between requests.
# this stuff goes in config/initializers/active_admin.rb
ActiveAdmin.setup do |config|
# ...
# put these lines in the "Controller Filters" section of the ActiveAdmin.setup block
# These two are defined in ActiveAdmin::FilterSaver::Controller, which is loaded below.
config.before_filter :restore_search_filters

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat

Ruby on Rails coding standard

Code style

  • Use UTF-8. It’s 21 century, 8bit encodings dead now.
  • Use 2 space indent, not tabs
  • Use Unix-style line endings
  • Keep lines not longer than 120 chars
  • Remove trailing whitespace
@bhushangahire
bhushangahire / 1.9.2 osx 10.10 error
Last active August 29, 2015 14:02
rvm reinstall 1.9.2 - OSX 10.10 Error
rvm reinstall 1.9.2 *[wgs_ui][ruby-2.1.2]
Checking requirements for osx.
Installing requirements for osx.
Updating system - please wait
Installing required packages: gcc46, libksba - please wait
Error running 'requirements_osx_brew_libs_install gcc46 libksba',
showing last 15 lines of /Users/bhushanahire/.rvm/log/1402346437_ruby-1.9.2-head/package_install_gcc46_libksba.log
+rvm_pretty_print:10> case stdout (stdout)
+rvm_pretty_print:11> [[ -t 1 ]]
+rvm_pretty_print:11> return 1
@bhushangahire
bhushangahire / gist:9f907be0eda0df410563
Created June 5, 2014 01:30
rvm 1.9.2-p290 on 10.10 issue
rvm install 1.9.2-p290 []
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.10/x86_64/ruby-1.9.2-p290.
It is not possible to build movable binaries for rubies 1.8-1.9.2, but you can do it for your system only.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
bhushanahire password required for 'rm -f /usr/share/xcode-select/xcode_dir_path':
Checking requirements for osx.
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/bhushanahire/.rvm/rubies/ruby-1.9.2-p290, this may take a while depending on your cpu(s)...
user www-data www-data;
worker_processes 4; # Rule of thumb is 1 process per core.
error_log logs/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
}
ENV["PATH"] = "/opt/ruby/bin:#{ENV['PATH']}"
ENV["RAILS_ENV"] = "production"
ENV["QUEUE"] = "*"
Bluepill.application("nichelator") do |app|
app.working_dir = "/var/apps/nichelator/current"
app.uid = "app"
app.gid = "app"
2.times do |i|
app.process("resque-#{i}") do |process|
# app/uploaders/avatar_uploader.rb
process :fix_exif_rotation
process :strip
process :resize_to_fill => [1024, 768]
process :quality => 90 # Percentage from 0 - 100
(function(a,b,c){if(c in b&&b[c]){var d,e=a.location,f=/^(a|html)$/i;a.addEventListener("click",function(a){d=a.target;while(!f.test(d.nodeName))d=d.parentNode;"href"in d&&(chref=d.href).replace(e.href,"").indexOf("#")&&(!/^[a-z\+\.\-]+:/i.test(chref)||chref.indexOf(e.protocol+"//"+e.host)===0)&&(a.preventDefault(),e.href=d.href)},!1)}})(document,window.navigator,"standalone");