Skip to content

Instantly share code, notes, and snippets.

@jamesfwz
jamesfwz / css-tips.md
Created October 5, 2015 06:37
css tips

Call things what they are

Good class names: <div class='product with-images'>

Bad class names: <div class='rounded-corners'>
@jamesfwz
jamesfwz / new_gist_file_0.md
Last active February 20, 2020 15:00
Auto Deploy AWS

This guide setup Apache2/Passenger/Ruby/Rails/Nginx on CentOS 6.6 64bit

Pre-deployment

# Use ec2-user mode
rvm gemset create <gemset>
rvm gemset use <gemset>
Next, we need to setup the SSH for Capistrano to access the Git:
@jamesfwz
jamesfwz / SETUP ROR ON AWS.md
Last active April 25, 2018 11:26
SETUP ROR ON AWS

This guide setup Apache2/Passenger/Ruby/Rails on Red Hat Enterprise Linux 7.1 (HVM).

# ssh
ssh -i in2ideas.pem ec2-user@52.74.81.212

# switch to root
sudo su -

# install the necessary libraries
@jamesfwz
jamesfwz / new_gist_file_0
Created November 26, 2014 10:29
fix gem install pg error
gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config
@jamesfwz
jamesfwz / new_gist_file_0
Created November 6, 2014 05:37
Omniauth Github
http://natashatherobot.com/rails-omniauth-github-tutorial/
/lib/tasks/ckeditor.rake
require 'fileutils'
desc "Create nondigest versions of all ckeditor digest assets"
task "assets:precompile" do
fingerprint = /\-[0-9a-f]{32}\./
for file in Dir["public/assets/ckeditor/**/*"]
next unless file =~ fingerprint
nondigest = file.sub fingerprint, '.'
FileUtils.cp file, nondigest, verbose: true
rspec -fd
git reset --hard d63bd55
git commit --amend -m 'Refactor enquires controller spec'
These are steps to setup a new project in ROR.
You must configure and install your Gems individually instead of copying the Gemfile from a previous project.
Refer to Heroku setup if you want to push your project to Heroku.
## Setup directory
```sh
# Create directory in ~/workspace
mkdir ./testproject
cd ./testproject

Extracting model configuration

# app/models/booking.rb
class Booking
  include RailsAdmin::Booking
end

# app/models/concerns/rails_admin/booking.rb
module RailsAdmin::Booking
@jamesfwz
jamesfwz / RVM.md
Created June 17, 2014 10:38 — forked from ivan22/RVM.md

Installing RVM

# install RVM
curl -L https://get.rvm.io | bash -s stable

# runs RVM
source /etc/profile.d/rvm.sh

# Setups required files for RVM