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 / 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 / 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 / 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 / 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 / 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 / convert sass to scss
Last active May 18, 2017 03:24 — forked from pedrogpimenta/convert sass to scss
Convert SASS to SCSS and delete .sass files (applies to all files in current folder)
sass-convert -R ./ -F sass -T scss && rm *.sass
sass-convert -R ./ -F sass -T scss && find . -type f -name '*.sass' -delete
@fongfan999
fongfan999 / gist:b146632acbd71ac797deed61803c66eb
Created June 3, 2017 06:20 — forked from ryansobol/gist:5252653
15 Questions to Ask During a Ruby Interview

Originally published in June 2008

When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.

To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.

What to expect

Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.

@fongfan999
fongfan999 / capybara cheat sheet
Created June 29, 2017 03:59 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
This gist is the update of this post https://u.osu.edu/hasnan.1/2014/03/30/rails-4-multiple-file-upload-with-carrierwave-nested-form-and-jquery-file-upload/
License MIT