Skip to content

Instantly share code, notes, and snippets.

@zealinux
zealinux / install-rails-ubuntu-12.04.sh
Created September 19, 2012 16:09
autoinstall-rvm-rails-etc
#!/bin/bash
# bash script for installing Rails environment on Ubuntu 12.04 Server
#
# Some sources has been changed to mirrors in China mainland.
#
# To use this script, do this in your shell:
#
# $ curl -L https://raw.github.com/gist/2521307/install-rails-12-04-server.sh | bash
require 'bundler/capistrano' #添加之后部署时会调用bundle install, 如果不需要就可以注释掉
require "capistrano/ext/multistage" #多stage部署所需
set :stages, %w(development production)
set :default_stage, "development"
set :application, "crm_app_end" #应用名称
set :repository, "https://chang.abc.com/svn/engineering/vwaccount/mydeploy/trunk"
@zealinux
zealinux / convert.demo.sh
Created September 26, 2012 13:59
imagemagick convert cheat sheet
= IMAGEMAGICK
Working with images, PDFs and the command line
# convert from one format to another
convert image.gif image.jpg
# convert specific PDF page to image
ActiveAdmin.register Event do
#Menu display index
menu :priority => 1
#Scopes
scope :all
scope :pending
scope :approved
scope :rejected
scope :cancelled
(defvar mode-line-cleaner-alist
`((auto-complete-mode . " α")
(yas/minor-mode . " υ")
(paredit-mode . " π")
(eldoc-mode . "")
(abbrev-mode . "")
;; Major modes
(lisp-interaction-mode . "λ")
(hi-lock-mode . "")
(python-mode . "Py")
name供应商名称varchar(255)
address供应商地址varchar(255)
telephone供应商电话varchar(50)
description供应商简介text
work_time供应商工作时间varchar(50)
wokr_qq_list供应商工作客服QQ列表varchar(100)
@zealinux
zealinux / git-kaixin.org
Created October 29, 2012 13:37
给田园学习git的整理资料
$(document).ready(function() {
$('a.loginll').click(function(){
if ($('a#all').hasClass("active")) {
$('a#all').removeClass("active");
$(this).addClass("active");
}
else {
$(this).toggleClass("active");
}
@zealinux
zealinux / application_controller.rb
Created November 12, 2012 08:38 — forked from gonzedge/application_controller.rb
Rails 3.1 - Adding custom 404 and 500 error pages
class ApplicationController < ActionController::Base
# ...
unless Rails.application.config.consider_all_requests_local
rescue_from Exception, with: lambda { |exception| render_error 500, exception }
rescue_from ActionController::RoutingError, ActionController::UnknownController, ::AbstractController::ActionNotFound, ActiveRecord::RecordNotFound, with: lambda { |exception| render_error 404, exception }
end
private
def render_error(status, exception)
function makeAdder(x) {
return function(y) {
return x + y;
};
}
var add5 = makeAdder(5);
var add10 = makeAdder(10);
print(add5(2)); // 7