Skip to content

Instantly share code, notes, and snippets.

@douhashi
douhashi / spec_helper.rb
Created September 2, 2011 15:10
my spec/spec_helper.rb
# This file is copied to spec/ when you run 'rails generate rspec:install'
require 'rubygems'
require 'factory_girl'
require 'spork'
require 'database_cleaner'
Spork.prefork do
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
@douhashi
douhashi / template.rb
Created September 2, 2011 15:42
my application template for rails 3.x
####################################################
#
# Name: rails application template
# Author: douhashi
# Usage:
# rails new your_app_name [-d mysql] -T --skip-bundle -m https://raw.github.com/gist/1188958
#
####################################################
@douhashi
douhashi / setup.thor
Created September 2, 2011 20:12
setup tasks for application template
class Setup < Thor
include Thor::Actions
APP_ROOT = File.dirname(__FILE__) + "../../../".freeze
PLUGINS = [:rspec, :cucumber, :simple_form, :devise].freeze
SUCCESS_NOTICE = <<-SUCCESS_TEXT
Successful install [[[Name]]].
SUCCESS_TEXT
@douhashi
douhashi / .zshrc
Created December 8, 2011 17:36
my .zshrc
autoload -U compinit
compinit
setopt auto_pushd
setopt auto_cd
setopt correct
setopt cdable_vars
## keybind
@douhashi
douhashi / nginx_make.sh
Created February 9, 2012 07:42
make script for nginx
#!/bin/sh
NGINX=nginx-1.1.14
cd $NGINX \
&& ./configure \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx.lock \
@douhashi
douhashi / nginx
Created February 9, 2012 08:08
nginx service conf file.
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /etc/nginx/nginx.conf
# config: /etc/sysconfig/nginx
@douhashi
douhashi / unicorn.rb
Created February 9, 2012 08:39
redmine unicorn conf
$unicorn_user = "app"
$unicorn_group = "app"
worker_processes 2
working_directory '/var/rails/redmine'
listen "127.0.0.1:3100", :tcp_nopush => true
listen '/tmp/.unicorn_redmine.sock'
timeout 30
@douhashi
douhashi / unicorn_rails_redmine
Created February 9, 2012 08:46
redmine service conf
#!/bin/bash
#
# unicorn_rails_redmine Startup script for unicorn.
#
# chkconfig: - 85 15
# description: redmine on unicorn start/stop script.
#
#
# set rvm environment valiables.
@douhashi
douhashi / Gemfile
Created October 4, 2012 12:51
Gemfile for example 1
source 'https://rubygems.org'
gem 'rails', '3.2.8'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
@douhashi
douhashi / file_backup.sh
Last active December 17, 2015 16:09
backup scripts for rails
#! /bin/sh
### SETTINGS ################################################
APP_NAME=app_name
APP_ROOT=/var/rails/$APP_NAME/curent
BACKUP_SOURCE_DIR=uploads
BACKUP_DEST=/backups/file
PERIOD=30
#############################################################