Skip to content

Instantly share code, notes, and snippets.

View firewalker06's full-sized avatar

Didik Wicaksono firewalker06

View GitHub Profile
name: Deploy
on:
push:
branches:
- master
jobs:
build:
# put this in your staging.rb file. Obviously you'll need more config than this it's just an example.
Rails.application.configure do
config.action_mailer.preview_path ||= defined?(Rails.root) ? "#{Rails.root}/test/mailers/previews" : nil
config.autoload_paths += [config.action_mailer.preview_path]
routes.append do
get '/rails/mailers' => "rails/mailers#index"
get '/rails/mailers/*path' => "rails/mailers#preview"
end
@firewalker06
firewalker06 / .tmux.conf
Last active September 16, 2015 03:45
My Tmux Configuration
# explicitly disable mouse control
setw -g mode-mouse off
set -g mouse-select-pane off
set -g mouse-resize-pane off
set -g mouse-select-window off
# Disable window rename
set-option -g allow-rename off
# Start windows and panes at 1, not 0
@firewalker06
firewalker06 / 0_reuse_code.js
Last active August 29, 2015 14:11
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@firewalker06
firewalker06 / Gemfile
Last active August 29, 2015 14:06
ZeptoJS in Rails
gem "bower-rails", "~> 0.8.3"
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
@firewalker06
firewalker06 / problems.md
Created May 10, 2014 15:27
Trying to validate an attribute inside a child model with a condition that depends on the parent's attribute value.

I have two models, Post and Tag. This is not my real scenario. In order to simplify it, lets assume that:

  • each Post can have many Tags,
  • Tag name can be saved as empty when Post's status is :draft. The reason is so that user could not be bothered with validation when all they want is just save Post as a draft.

This is the models that I have in mind:

# Post model
class Post < ActiveRecord::Base
@firewalker06
firewalker06 / centos6.5_ruby2.1.0_nginx.md
Last active August 29, 2015 14:00
Centos 6.5 with Ruby 2.1.0 and Nginx

Yummy update

$ yum update

Install Git, Curl, and Vim

$ yum install curl git vim`
$ git config --global user.name "Your name"
$ git config --global user.email "your_email@example.com"
@firewalker06
firewalker06 / Html(Rails).sublime-settings
Created March 27, 2014 13:10
User and syntax specifics for Sublime Text
{
// http://guides.rubyonrails.org/contributing_to_ruby_on_rails.html
"tab_size": 2,
"translate_tabs_to_spaces": true
}