Skip to content

Instantly share code, notes, and snippets.

View j1n6's full-sized avatar
🎯
Focusing

Jing Dong j1n6

🎯
Focusing
View GitHub Profile
@j1n6
j1n6 / gemrc
Created December 3, 2011 14:30
Not install rdoc by default for all gems
---
:sources:
- http://gems.rubyforge.org
- http://gems.github.com
gem: --no-ri --no-rdoc
console.log("from gist");
@j1n6
j1n6 / gist_tag.rb
Last active December 9, 2015 17:11
without file name {% gist id %} optional file name {% gist id filename %}
require 'cgi'
require 'digest/md5'
require 'net/https'
require 'uri'
module Jekyll
class GistTag < Liquid::Tag
def initialize(tag_name, text, token)
super
@text = text
task :server do
# optional port parameter
port = ENV['PORT'] ? ENV['PORT'] : '3000'
puts 'start unicorn development'
# execute unicorn command specifically in development
# port at 3000 if unspecified
sh "cd #{Rails.root} && RAILS_ENV=development unicorn -p #{port}"
end
# an alias task
task :s => :server
Hulk::Application.configure do
# ...
# other config settings for development
# ...
config.logger = Logger.new(STDOUT)
config.logger.level = Logger.const_get('DEBUG')
# ...
end
require 'rspec'
# Add multiple formatters to formater
RSpec.configure do |c|
c.add_formatter(:documentation)
c.add_formatter(:json)
# built-in textmate formatter
c.add_formatter(:textmate)
end
require 'rspec'
config = RSpec.configuration
# Example 1
# Create a documentation formatter with STDOUT steam
documentation_formatter = RSpec::Core::Formatters::DocumentationFormatter.new($stdout)
documentation_reporter = RSpec::Core::Reporter.new(documentation_formatter)
# Example 2
require 'rspec'
describe "Behaviour" do
it "should pass" do
true.should eq true
end
it "should fail" do
true.should eq false
end
####################################
# BASIC REQUIREMENTS
# http://graphite.wikidot.com/installation
# http://geek.michaelgrace.org/2011/09/how-to-install-graphite-on-ubuntu/
# Last tested & updated 10/13/2011
####################################
cd
sudo apt-get update
sudo apt-get upgrade
@j1n6
j1n6 / deploy.rb
Last active December 18, 2015 16:49
node upstart deploy example
set :stages, %w(production demo staging)
set :default_stage, "staging"
require "capistrano/ext/multistage"
set :application, "example-app"
set :repository, "[email protected]"
set :branch, "master"
set :scm, :git
set :git_enable_submodules, 1