Skip to content

Instantly share code, notes, and snippets.

@rorlab
rorlab / environment.rb
Created October 4, 2012 10:51
Custom field_error_proc
# Custom field_error_proc
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
errors = Array(instance.error_message).join(', ')
if html_tag =~ /^<label/
if html_tag !~ /^<label(?:\s+.*)*(\s+alt="(?:checkbox|hidden)")(?:\s+.*)*\s*/
%(#{html_tag}).html_safe
else
%(#{html_tag}<span class="validation-error">&nbsp;#{errors}</span>).html_safe
end
else
@rorlab
rorlab / git-create.sh
Created March 13, 2016 00:40
Shell script for making github repository and pushing source codes
#!/bin/sh
repo_name=$1
test -z $repo_name && echo "Repo name required." 1>&2 && exit 1
curl -u '[username]:[password]' https://api.github.com/user/repos -d "{\"name\":\"$repo_name\"}"
git init
git add .
git commit -m "initial commit"
git remote add origin "https://github.com/[username]/$repo_name.git"
git push -u origin master
@rorlab
rorlab / setup.sh
Last active December 14, 2017 08:10
Shell Provisioning Script used in Vagrantfile for Team-Developing Rails Applications
echo "Provision virtual machine..."
echo "Updating Packages"
sudo apt-get update > /dev/null 2>&1
echo "Installing Korean Language Pack"
sudo apt-get install language-pack-ko -y > /dev/null 2>&1
echo "Set TimeZone to Asia/Seoul"
sudo timedatectl set-timezone Asia/Seoul
@rorlab
rorlab / Vagrantfile
Last active October 26, 2016 11:23
Vagrantfile for Developing Rails Applications
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "bento/ubuntu-16.04"
config.vm.network "forwarded_port", guest: 3000, host: 9000, auto_correct: true
config.vm.network "forwarded_port", guest: 80, host: 8080, auto_correct: true
# config.vm.network "private_network", ip: "192.168.33.10"
config.vm.provider "virtualbox" do | vb |
# vb.name = "RORLAB DEV Vagrant"
@rorlab
rorlab / .gitignore
Created April 1, 2016 10:48
[AGAIN2011] gitignore file for exluding sensitive data file
.vagrant/*
# development 환경
.rbenv-vars
# staging 환경
.rbenv-vars.staging
config/database.staging.yml
config/secrets.staging.yml
@rorlab
rorlab / p1.html
Last active January 3, 2016 20:59
Github Forking to Pull Request - images
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAa8AAADqCAYAAAAVicpqAAAKQWlDQ1BJQ0MgUHJvZmlsZQAASA2dlndUU9kWh8+9N73QEiIgJfQaegkg0jtIFQRRiUmAUAKGhCZ2RAVGFBEpVmRUwAFHhyJjRRQLg4Ji1wnyEFDGwVFEReXdjGsJ7601896a/cdZ39nnt9fZZ+9917oAUPyCBMJ0WAGANKFYFO7rwVwSE8vE9wIYEAEOWAHA4WZmBEf4RALU/L09mZmoSMaz9u4ugGS72yy/UCZz1v9/kSI3QyQGAApF1TY8fiYX5QKUU7PFGTL/BMr0lSkyhjEyFqEJoqwi48SvbPan5iu7yZiXJuShGlnOGbw0noy7UN6aJeGjjAShXJgl4GejfAdlvVRJmgDl9yjT0/icTAAwFJlfzOcmoWyJMkUUGe6J8gIACJTEObxyDov5OWieAHimZ+SKBIlJYqYR15hp5ejIZvrxs1P5YjErlMNN4Yh4TM/0tAyOMBeAr2+WRQElWW2ZaJHtrRzt7VnW5mj5v9nfHn5T/T3IevtV8Sbsz55BjJ5Z32zsrC+9FgD2JFqbHbO+lVUAtG0GQOXhrE/vIADyBQC03pzzHoZsXpLE4gwnC4vs7GxzAZ9rLivoN/ufgm/Kv4Y595nL7vtWO6YXP4EjSRUzZUXlpqemS0TMzAwOl89k/fcQ/+PAOWnNycMsnJ/AF/GF6FVR6JQJhIlou4U8gViQLmQKhH/V4X8YNicHGX6daxRodV8AfYU5ULhJB8hvPQBDIwMkbj96An3rWxAxCsi+vGitka9zjzJ6/uf6Hwtcim7hTEEiU+b2DI9kciWiLBmj34RswQISkAd0oAo0gS4wAixgDRyAM3AD3iAAhIBIEAOWAy5IAmlABLJBPtgACkEx2AF2g2pwANSBetAEToI2cAZcBFfADXALDIBHQAqGwUswAd6BaQiC8BAVokGqkBakD5lC1hAbWgh5Q0FQOBQDxUOJkBCSQP
require "faker"
FactoryGirl.define do
factory :post do
group
association :writer, factory: :user
content { Faker::Lorem.sentence }
factory :post_transactions do
after(:create) do |post|
create_list(:transaction, 4, post: post)
2013-12-10 09:18:47 executing `bundle:install'
* executing "cd /home/user1/apps/test_app/releases/20131210001847 && env RBENV_ROOT=\"/home/user1/.rbenv\" PATH=\"/home/user1/.rbenv/shims:/home/user1/.rbenv/bin:$PATH\" RBENV_VERSION=\"2.0.0-p195\" /home/user/.rbenv/bin/rbenv exec bundle install --gemfile /home/user/apps/test_app/releases/20131210001847/Gemfile --path /home/user/apps/test_app/shared/bundle --deployment --quiet --without development test"
servers: ["14.63.167.166"]
[14.63.167.166] executing command
** [out :: 14.63.167.166] fatal: Could not parse object '9c6c07f74ff515cf38380b014cfede14a4f0eae4'.
** [out :: 14.63.167.166] Git error: command `git reset --hard 9c6c07f74ff515cf38380b014cfede14a4f0eae4`
** [out :: 14.63.167.166] in directory
** [out :: 14.63.167.166] /home/user/apps/test_app/shared/bundle/ruby/2.0.0/bundler/gems/bootstrap-sass-9c6c07f74ff5
** [out :: 14.63.167.166] has failed.
** [out :: 14.63.167.166] If this error persists you could try removing the cache directory
$ rbenv install 2.0.0-p353
Downloading openssl-1.0.1e.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/66bf6f10f060d561929de96f9dfe5b8c
Installing openssl-1.0.1e...
Installed openssl-1.0.1e to /Users/hyo/.rbenv/versions/2.0.0-p353
Downloading ruby-2.0.0-p353.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/78282433fb697dd3613613ff55d734c1
Installing ruby-2.0.0-p353...
Installed ruby-2.0.0-p353 to /Users/hyo/.rbenv/versions/2.0.0-p353
<h3><%=t('head_title.share_your_stories')%></h3>
<div class="new_timeline_link">
<%= link_to t('timelines.add_your_story'), new_timeline_path, remote: true, id:"new_timeline_link" %>
</div>
<div id="new_timeline_form"></div>
<div id="timelines" class="timelines">
<% if @timelines.size > 0 %>
<%= render @timelines %>