Skip to content

Instantly share code, notes, and snippets.

View chucai's full-sized avatar

He Xudong chucai

  • 北京
View GitHub Profile
@chucai
chucai / jquerymobile.html
Created November 21, 2012 13:49
JQueryMobile: base html template
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="jquery.mobile.css" />
<script type="text/javascript" src="jquery.js"></script>
<!--<script src="custom-scripts-here.js"></script>-->
<script type="text/javascript" src="jquery.mobile.js"></script>
@chucai
chucai / form.js
Created November 21, 2012 06:43
Javascript: Create a Form widget
//= require component/base
//= require component/placeholder
//= require component/form_helper
/**
* Form Component.
* @class
* @extends FW.Component
*/
FW.Form = Class.create(FW.Component,
@chucai
chucai / README.markdown
Created September 28, 2012 05:47 — forked from hooopo/README.markdown
Rails: nav_link helper for adding 'selected' class to navigation elements

#Behold, the nav_link:

The nav_link helper works just like the standard Rails link_to helper, but adds a 'selected' class to your link (or its wrapper) if certain criteria are met. By default, if the link's destination url is the same url as the url of the current page, a default class of 'selected' is added to the link.

For full usage details, see: http://viget.com/extend/rails-selected-nav-link-helper

Drop nav_link_helper.rb into app/helpers in your Rails 3.x app and enjoy.

@chucai
chucai / railsrc
Created August 4, 2012 02:30
my railsrc config page
-m https://raw.github.com/RailsApps/rails3-application-templates/master/rails3-haml-html5-template.rb
--old-style-hash
--skip-bundle
--skip-test-unit
@chucai
chucai / haml
Created August 4, 2012 02:21
a template for rails: html5 , haml...else...
# Application Generator Template
# Modifies a Rails app to set up Haml with an HTML5 application layout and options for CSS with Twitter Bootstrap
# Usage: rails new APP_NAME -m https://github.com/RailsApps/rails3-application-templates/raw/master/rails3-haml-html5-template.rb
# Generated using the rails_apps_composer gem:
# https://github.com/RailsApps/rails_apps_composer/
# Based on application template recipes by:
# Michael Bleigh https://github.com/mbleigh
# Daniel Kehoe https://github.com/DanielKehoe
@chucai
chucai / .railsrc
Created August 4, 2012 02:08 — forked from janlelis/.railsrc
13 Rails-specific hints for your rails 3 console.
# .railsrc for Rails 3, encoding: utf-8
# see http://rbjl.net/49-railsrc-rails-console-snippets
if !Rails.application then warn "Rails isn't loaded, yet... skipping .railsrc" else
# # #
def ripl?; defined?(Ripl) && Ripl.instance_variable_get(:@shell); end
# # #
# loggers
@chucai
chucai / faye.rb
Created July 19, 2012 02:52 — forked from betamatt/faye.rb
Faye monit wrapper
#!/usr/env ruby
base_dir = File.expand_path("../..", __FILE__)
NAME="faye"
PID="#{base_dir}/tmp/pids/#{NAME}.pid"
COMMAND="bundle exec rackup -s thin -E production -p 3001 faye.ru"
case ARGV[0]
when "start"
# See http://m.onkey.org/running-rails-performance-tests-on-real-data
# START : HAX HAX HAX
# Load Rails environment in 'test' mode
RAILS_ENV = "test"
require File.expand_path('../../config/environment', __FILE__)
# Re-establish db connection for 'performance' mode
silence_warnings { RAILS_ENV = "performance" }
ActiveRecord::Base.establish_connection
@chucai
chucai / description
Created July 14, 2012 02:19 — forked from irrationalidiot/description
Cucumber, rspec and spork setup using watchr for rails
Gems:
gem 'cucumber'
gem 'cucumber-rails'
gem 'rspec'
gem 'rspec-rails'
gem 'capybara'
gem 'database_cleaner'
gem 'spork'
gem 'watchr'
@chucai
chucai / description
Created July 13, 2012 10:14 — forked from irrationalidiot/description
Cucumber, rspec and spork setup using watchr for rails
Gems:
gem 'cucumber'
gem 'cucumber-rails'
gem 'rspec'
gem 'rspec-rails'
gem 'capybara'
gem 'database_cleaner'
gem 'spork'
gem 'watchr'