Skip to content

Instantly share code, notes, and snippets.

View fongfan999's full-sized avatar
🏠
Working from home

Phong Phan fongfan999

🏠
Working from home
View GitHub Profile
@fongfan999
fongfan999 / Ubuntu Rails Setup Steps
Created May 2, 2017 06:36 — forked from JElbourne/Ubuntu Rails Setup Steps
SETUP STEPS for Ubuntu Desktop with various apps and settings, Ruby, Rails, PostgreSQL, and others
#********************************************************************
# Ubuntu Setup Steps for initial install PLUS
# Ruby on Rails setup using PostreSQL
#
# by: Jay Elbourne
# date: March 2016
# Ubuntu 15.10 (32 bit [because of VirtualBox])
# Ruby 2.2.3
# Rails 4.2.4
# PostreSQL 9.5
@fongfan999
fongfan999 / Install_tmux
Last active April 25, 2017 12:10 — forked from simme/Install_tmux
Install and configure tmux on Mac OS X
# First install tmux
brew install tmux
# For mouse support (for switching panes and windows)
# Only needed if you are using Terminal.app (iTerm has mouse support)
Install http://www.culater.net/software/SIMBL/SIMBL.php
Then install https://bitheap.org/mouseterm/
# More on mouse support http://floriancrouzat.net/2010/07/run-tmux-with-mouse-support-in-mac-os-x-terminal-app/
@fongfan999
fongfan999 / gist:b3188d84e0eefeae30a264e23816f0a9
Created April 7, 2017 13:04 — forked from mediasota/gist:7c46c8e105acc386d62f
config/initializers/simple_form_materialize-sass.rb
# Use this setup block to configure all options available in SimpleForm.
SimpleForm.setup do |config|
config.error_notification_class = 'alert alert-danger'
config.button_class = 'waves-effect waves-light btn'
config.boolean_label_class = nil
config.wrappers :vertical_form, tag: 'div', class: 'input-field', error_class: 'has-error' do |b|
b.use :html5
b.use :placeholder
b.optional :maxlength
@fongfan999
fongfan999 / authenticated_scraper.rb
Created March 24, 2017 17:10 — forked from prokizzle/authenticated_scraper.rb
Serialize authenticated Mechanize sessions in Ruby
class AuthenticatedScraper
def initialize(args)
if args[:session]
@cookie_jar = args[:session]
@agent = Mechanize.new
@agent.cookie_jar = load_session(@cookie_jar)
else
@agent = Mechanize.new
@agent.login(args[:username], args[ password])
end
@fongfan999
fongfan999 / install.md
Created March 15, 2017 10:17 — forked from galulex/install.md
Ruby On Rails Ubuntu 16.10 install

Developer libs

mysql, rmagic, curl, git, vim, sqlite, nodejs nokogiri...

sudo apt-get install libxslt1-dev libxml2-dev build-essential patch libsqlite3-dev libcurl4-openssl-dev curl git git-gui vim-gtk exuberant-ctags nodejs nodejs-legacy rar

Ruby

sudo apt-add-repository ppa:brightbox/ruby-ng

sudo apt-get update

@fongfan999
fongfan999 / regex-o.rb
Created March 3, 2017 03:14 — forked from robmiller/regex-o.rb
Explaining Ruby regex's /o modifier
require "benchmark"
def letters
puts "letters() called"
sleep 0.5
"A-Za-z"
end
words = %w[the quick brown fox jumped over the lazy dog]