This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lsof -wni tcp:PORT | |
kill -9 PID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git config --local --unset gui.geometry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "export PATH=$PATH:/Users/iqbalhasnan/.rvm/gems/ruby-1.9.3-p550/bin" >> ~/.bash_profile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo chown -R `whoami` /usr/local | |
cd /usr/local | |
git reset --hard origin/master | |
brew doctor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
# default gems here | |
#--------------------------- | |
# add paperclip and bootstrap | |
gem "paperclip", "~> 4.1" | |
gem 'bootstrap-sass', '~> 3.1.1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Admin::UsersController < ApplicationController | |
before_filter :authenticate_user! | |
before_filter :check_if_admin | |
include Pundit | |
def index | |
@users = User.all | |
end | |
def update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module RedisHelper | |
# decode Redis value back to Ruby object | |
def self.decode(json) | |
self.new(ActiveSupport::JSON.decode(json)["#{self.name.downcase}"]) | |
end | |
# encode Ruby object for Redis | |
def encoded | |
self.updated_at = nil | |
self.to_json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/models/User.rb | |
#As we all know that Devise sends all emails through the send_devise_notification method | |
#So, without having to install devise-async gem , we just need to change the code to send it asynchronously | |
# send to the delayed_job queue | |
def send_devise_notification(notification, *args) | |
devise_mailer.delay.send(notification, self, *args) | |
end |