Skip to content

Instantly share code, notes, and snippets.

@rorlab
rorlab / application.html.erb
Created July 19, 2012 09:15
app/views/layouts/application.html.erb
<!DOCTYPE html>
<html>
<head>
<title>Blog, ROR Lab. Lecture</title>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
</head>
<body>
@rorlab
rorlab / layout.css.scss
Created July 19, 2012 09:16
app/assets/stylesheets/layout.css.scss
body {
background:#336699 !important;
}
#header {
margin:0 auto;
width:80%;
text-align: right;
h1 {
margin-bottom:5px;
@rorlab
rorlab / .bash_profile
Created August 1, 2012 02:48
Shell Prompt for RVM & Git
function __git_dirty {
git diff --quiet HEAD &>/dev/null
[ $? == 1 ] && echo "!"
}
function __git_branch {
__git_ps1 "%s"
}
function __my_rvm_ruby_version {
@rorlab
rorlab / database.yml
Created August 8, 2012 23:24
database.yml for MySQL
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MYSQL driver
# gem install mysql2
#
# Ensure the MySQL gem is defined in your Gemfile
# gem 'mysql2'
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
@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 / application.rb
Created October 5, 2012 08:46
GMail Setting for Rails Mailer
config.action_mailer.default_url_options = { host: "yourdomain.com" }
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: "smtp.gmail.com",
port: 587,
domain: "yourdomain.com",
authentication: "plain",
enable_starttls_auto: true,
user_name: ENV["GMAIL_USERNAME"],
@rorlab
rorlab / rorlab.css.scss
Created October 5, 2012 08:49
Additional stylesheet for ROR Lab.
table.bordered {
width:100%;
padding:0;
margin:0;
border-collapse:collapse;
th {
background: #cadcf3;
}
th, td {
border:1px solid #79b0e0;
ko:
date:
abbr_day_names:
- 일
- 월
- 화
- 수
- 목
- 금
- 토
@rorlab
rorlab / gist:4959765
Last active December 13, 2015 18:59 — forked from jasoncodes/gist:1223731
# The latest version of this script is now available at
# https://github.com/jasoncodes/dotfiles/blob/master/aliases/rbenv.sh
VERSION=1.9.3-p385
brew update
brew install rbenv ruby-build rbenv-vars readline ctags
if [ -n "${ZSH_VERSION:-}" ]; then
echo 'eval "$(rbenv init - --no-rehash)"' >> ~/.zshrc
else
echo 'eval "$(rbenv init - --no-rehash)"' >> ~/.bash_profile

Usage

= social_link_to "Tweet", 'twitter', { url: object_url(@object), text: @object.title }, 'data-share' => 'twitter'