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
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
@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')
@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 / 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
// Copyright 2013 Petter Törnberg
//
// This demo code has been kindly provided by Petter Törnberg <pettert@chalmers.se>
// for the SentiWordNet website.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//

Initial Server Setup

  1. Root Login: ssh root@SERVER_IP_ADDRESS
  2. Create a New User: adduser deploy
  3. Root Privileges: gpasswd -a deploy sudo
  4. Add Public Key Authentication:
  • Login to new user: su - deploy
  • Add Public Key to New Remote User
    mkdir .ssh
    chmod 700 .ssh
@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