Skip to content

Instantly share code, notes, and snippets.

@samgooi4189
samgooi4189 / JS_piktochart
Created June 26, 2014 01:15
Piktochart project
JAVASCRIPT
I would like to let you know that most people go through a Javascript test which will have to be very well commented on (with proper indentations and follow strictly the descriptions as following). You will have 7 days to take the test and pass it back to us.
Basic Requirement:
- Build a chart with custom icons
- Build an editor to accommodate the chart
@samgooi4189
samgooi4189 / rails_model_naming
Created July 10, 2014 06:25
Rails naming convention
if you get error message:
undefined method `equipment_index_path'
you are probably violated the pluralize convention when naming the model.
For next time, please launch rails c, then use '[Enter word here]'.pluralize to make sure the word fits the convention.
@samgooi4189
samgooi4189 / falseIsBlank
Created July 18, 2014 06:58
Paasing false in hidden field will get validation error
After wondering why I can't pass my model validation after assigning false boolean,
I run some test in console.
I found out that the value false is equivalent to blank. So if you set your model to validate presence, you will get error when you pass false into your input field.
@samgooi4189
samgooi4189 / Nginx and Passenger SSL
Created August 20, 2014 02:18
[Solution] Nginx and Passenger running but Rails is not up
After configure Nginx and Passenger correctly, you should check on config/environments/production.rb to make sure that force-ssl is false. If you tend to use SSl for your application, you will be using port 443 and required to buy SSL certificate from vendors.
@samgooi4189
samgooi4189 / Nginx, Passenger, Rails
Created August 20, 2014 08:31
Setting up Nginx with Passenger with Rails 4
Taken from: http://alexbachuk.com/launch-rails-4-application-with-passenger-and-nginx/
ssh root@111.111.1.111 SSH as root, using IP address and password you get by email
adduser alex Create new username, because using root is not recommended.
visudo Open sudo config file and add admin privileges to newly created user.
alex ALL=(ALL) ALL) add this and ctrl+x to save ‘y’ and enter to overwrite
sudo apt-get update update system packages
curl -L get.rvm.io | bash -s stable install ruby version manager
source ~/.rvm/scripts/rvm load RVM
rvm requirements install all RVM dependencies
@samgooi4189
samgooi4189 / GRUB2 fix
Created October 1, 2014 15:13
repair grub2
boot live cd
sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install -y boot-repair
boot-repair
@samgooi4189
samgooi4189 / Prompt color
Created February 7, 2015 10:00
Bash text color
txtblk='\e[0;30m' # Black - Regular
txtred='\e[0;31m' # Red
txtgrn='\e[0;32m' # Green
txtylw='\e[0;33m' # Yellow
txtblu='\e[0;34m' # Blue
txtpur='\e[0;35m' # Purple
txtcyn='\e[0;36m' # Cyan
txtwht='\e[0;37m' # White
bldblk='\e[1;30m' # Black - Bold
bldred='\e[1;31m' # Red
@samgooi4189
samgooi4189 / gist:d674547448e60ec42769
Created April 24, 2015 02:18
[Solution] Whitespace trailing remove on Atom
For Atom editor, the whitespace trailing removal is activated as default, which is annoying because it overrides your files without telling you then cause massive git diff in your project.
To disable this:
1. Go to Edit >> Preferences
2. Select Packages, search for whitespace, then click edit
3. untick Remove Trailing Whitespace
You are good to go.
@samgooi4189
samgooi4189 / iAtkosS3
Created July 23, 2015 16:05
Installation guide for installing OSX 10.6.7 for BenQ S41
Download iAtkos S3v2
Restore iAtkos S3 image to USB
Install Chameleon into USB
Boot iAtkos S3 USB with -v -x
Chameleon RC5, GraphicsEnabler=Yes, RTCFix, USBBusFix, VoodooHDA, PS2, dont pick VoodooBattery
After installation, boot with -v -x (remember to connect USB mouse and keyboard)
After setting up, reboot
@samgooi4189
samgooi4189 / FinderHiddenConfig
Created November 1, 2012 06:23
Config Finder to view hidden files
Open the Terminal application (or, I much prefer iTerm) and type the following:
defaults write com.apple.finder AppleShowAllFiles TRUE
and after hitting return, follow it up with
killall Finder
which restarts the Finder and shows all files.