Skip to content

Instantly share code, notes, and snippets.

@liwei78
liwei78 / gist:7261462
Created November 1, 2013 06:05
OpenERP's Rspec file.....
# OOOR: OpenObject On Ruby
# Copyright (C) 2009-2012 Akretion LTDA (<http://www.akretion.com>).
# Author: Raphaël Valyi
# Licensed under the MIT license, see MIT-LICENSE file
if ENV["CI"]
require 'coveralls'
Coveralls.wear!
end
require File.dirname(__FILE__) + '/../lib/ooor'
gem 'sinatra'
group :development,:test do
gem 'rspec'
gem 'rack-test'
end
SampleApp::Application.routes.draw do
resources :users
resources :sessions, only: [:new, :create, :destroy]
resources :events do
member do
get :members
end
collection do
get :search
end
require 'restclient'
# RestClient logs using << which isn't supported by the Rails logger,
# so wrap it up with a little proxy object.
RestClient.log =
Object.new.tap do |proxy|
def proxy.<<(message)
Rails.logger.info message
end
end
Warning: Your developer_dir setting in macports.conf points to a non-existing directory. Since this is known to cause problems, please correct the setting or comment it and let macports auto-discover the correct path.
xcode-select --print-path
sudo nano /opt/local/etc/macports/macports.conf
# Chinese (China) translations for Devise(3.2.2)
# by Kenrick-Zhou (https://github.com/Kenrick-Zhou)
# https://gist.github.com/Kenrick-Zhou/7909822
zh-CN:
devise:
confirmations:
confirmed: "您的帐号已经确认,您现在已登录。"
send_instructions: "几分钟后,您将收到确认帐号的电子邮件。"
send_paranoid_instructions: "如果您的邮箱存在于我们的数据库中,您将收到一封确认账号的邮件。"
namespace :deploy do
desc "Hot-reload God configuration for the Resque worker"
task :reload_god_config do
sudo "god stop resque"
sudo "god load #{File.join(deploy_to, 'current', 'config', 'resque-' + rails_env + '.god')}"
sudo "god start resque"
end
end
# append to the bottom:
# Paginate a collection
#
# Usage:
#
# {% paginate contents.projects by 5 %}
# {% for project in paginate.collection %}
# {{ project.name }}
# {% endfor %}
# {% endpaginate %}
#
@liwei78
liwei78 / puma.sh
Last active August 29, 2015 14:11 — forked from runlevel5/puma.sh
#!/usr/bin/env bash
# Simple move this file into your Rails `script` folder. Also make sure you `chmod +x puma.sh`.
# Please modify the CONSTANT variables to fit your configurations.
# The script will start with config set by $PUMA_CONFIG_FILE by default
PUMA_CONFIG_FILE=config/puma.rb
PUMA_PID_FILE=tmp/pids/puma.pid
PUMA_SOCKET=tmp/sockets/puma.sock
@liwei78
liwei78 / gist:1ca7426be0ae0e8d4f87
Created December 17, 2014 17:00
/etc/init.d/nginx
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemin
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /usr/local/nginx/conf/nginx.conf
# pidfile: /usr/local/nginx/logs/nginx.pid