Skip to content

Instantly share code, notes, and snippets.

View hara-y-u's full-sized avatar
🏠
Working from home

hara_yu hara-y-u

🏠
Working from home
View GitHub Profile
@njvitto
njvitto / deploy.rake
Created April 11, 2010 16:56 — forked from RSpace/deploy.rake
Rakefile to deploy and rollback to Heroku in two different environments (staging and production) for the same app
#Deploy and rollback on Heroku in staging and production
task :deploy_staging => ['deploy:set_staging_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
task :deploy_production => ['deploy:set_production_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
namespace :deploy do
PRODUCTION_APP = 'YOUR_PRODUCTION_APP_NAME_ON_HEROKU'
STAGING_APP = 'YOUR_STAGING_APP_NAME_ON_HEROKU'
task :staging_migrations => [:set_staging_app, :push, :off, :migrate, :restart, :on, :tag]
task :staging_rollback => [:set_staging_app, :off, :push_previous, :restart, :on]
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@chrisbloom7
chrisbloom7 / README.md
Created June 6, 2011 07:16
A cheap knock off of the default validates_length_of validator, but checks the filesize of a Carrierwave attachment

Note that this validation runs both after the file is uploaded and after CarrierWave has processed the image. If your base uploader includes a filter to resize the image then the validation will be run against the resized image, not the original one that was uploaded. If this causes a problem for you, then you should avoid using a resizing filter on the base uploader and put any specific size requirements in a version instead.

So instead of this:

require 'carrierwave/processing/mini_magick'

@brenthargrave
brenthargrave / NSManagedObjectWithTimestamps.h
Created March 5, 2012 01:28 — forked from mikker/NSManagedObjectWithTimestamps.h
NSManagedObject with Rails-ish timestamps
//
// NSManagedObjectWithTimestamps.h
// Brainbow Apps, 2011
//
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
@interface NSManagedObjectWithTimestamps : NSManagedObject
@posaunehm
posaunehm / gist:4087971
Last active March 26, 2021 19:24
Why OO Sucks by Joe Armstrong
@rummelonp
rummelonp / undersky.md
Last active April 16, 2023 03:57
Ubuntu+Nginx+Unicorn+Rails+Capistrano
@p1nox
p1nox / postgresql_configuration_on_ubuntu_for_rails.md
Last active July 20, 2024 11:55
PostgreSQL configuration without password on Ubuntu for Rails

Abstract

You could have postgre installed on localhost with password (or without user or password seted after instalation) but if we are developing we really don't need password, so configuring postgre server without password for all your rails project is usefull.

Install Postgre packages

  • postgresql
  • postgresql-client
  • libpq-dev
@tommysundstrom
tommysundstrom / sitemap.xml.builder
Last active January 1, 2022 23:21
Middleman xml sitemap (to aid Google and other search engines)
# encoding: utf-8
xml.instruct!
# Drop this file in your source directory
#
# Uses the builder gem.
# Add
# gem 'builder', '~> 2.0'
# to the Gemfile, and run builder install
#
@machida
machida / grid.sass
Created September 18, 2013 02:31
TwitterBootstrap のグリッドの実装を sass の機能を使って作った。
// デバイスの一覧
$xs: 767px !default
$sm: 768px !default
$md: 992px !default
$lg: 1200px !default
// デバイスの名前
$break-points: xs, sm, md, lg, xl
// namespace
anonymous
anonymous / emacs-inline.patch
Created December 27, 2013 04:23
Emacs.appでインラインパッチを当てた時にdistnotedが暴走しなくなる。
diff -r -N -p -x '*.elc' ../emacs-24.3.org/lisp/term/common-win.el lisp/term/common-win.el
*** ../emacs-24.3.org/lisp/term/common-win.el 2013-01-02 05:37:17.000000000 +0900
--- lisp/term/common-win.el 2013-04-13 21:49:53.000000000 +0900
*************** is not used)."
*** 127,132 ****
--- 127,133 ----
(cons (logior (lsh 0 16) 12) 'ns-new-frame)
(cons (logior (lsh 0 16) 13) 'ns-toggle-toolbar)
(cons (logior (lsh 0 16) 14) 'ns-show-prefs)
+ (cons (logior (lsh 0 16) 15) 'mac-change-input-method)