Skip to content

Instantly share code, notes, and snippets.

Dingding Ye sishen

Block or report user

Report or block sishen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
sishen / gist:1019347
Created Jun 10, 2011
Nokogiri Template Builder. (Rails 3.0)
View gist:1019347
require 'action_view'
module ActionView
module Template::Handlers
class NokogiriBuilder
class_attribute :default_format
self.default_format = Mime::XML
def call(template)
require 'nokogiri'
sishen /
Created Nov 12, 2013
Turn website to application using Chrome
echo "What should the Application be called (no spaces allowed e.g. GCal)?"
read inputline
echo "What is the url (e.g."
read inputline
sishen / unicorn
Created Jan 13, 2013
The unicorn init.d script to start/stop/restart the service
View unicorn
set -u
set -e
# Feel free to change any of the following variables for your app:
export PATH=/usr/local/bin:$PATH
export HOME=/home/deploy
sishen / mails_viewer_config.rb
Created Sep 19, 2012
Sample configuration of mails_viewer to allow the mails real sent to "" domain
View mails_viewer_config.rb
config.action_mailer.delivery_method = :file
config.action_mailer.file_settings = {
location: 'tmp/mails',
smtp_settings: {
address: "localhost",
port: 25,
domain: 'localhost.localdomain',
user_name: nil,
password: nil,
authentication: nil,
sishen /
Created Aug 16, 2012
Url Scoping in Spine.js
class App.Ticket extends Spine.Model
@configure 'Ticket', "id", "project_id"
@scope: ->
scope: ->
sishen /
Created Aug 16, 2012
Sample Spine.js Model in
class App.Project extends Spine.Model
@configure 'Project', 'id', 'name', 'description', 'owner_id', 'uid'
@extend Spine.Model.Ajax
@extend Spine.Model.Dirty
validate: ->
'name required' unless @name
inviteUser: (email) ->
App.Invitation.create(project_id: @id, email: email)
sishen /
Created Aug 16, 2012
Sample Spine.js Controller in
class App.LeftIterationController extends Spine.Controller
el: '.sidebar #iterations'
'ul.list': 'list'
constructor: ->
App.Iteration.bind 'create', @addIteration
App.Iteration.bind 'refresh', @refreshIterations
sishen /
Created Aug 16, 2012
Sample Spine.js Routing Controller in
class App.TicketsController extends Spine.Controller
constructor: ->
"/tickets": @index
"/tickets/:id" : (params) ->
index: ->
tickets = App.Ticket.all()
sishen / JS Structure
Created Aug 16, 2012
Tree Structure of a real world Spine App
View JS Structure
├── app
│   ├── controllers
│   │   ├── center
│   │   │   ├──
│   │   │   └──
│   │   ├──
│   │   ├──
│   │   ├── header
│   │   │   └──
│   │   ├──
sishen /
Created Aug 2, 2012
Web Notifications integration in
class Notifier
constructor: ->
@enableNotification = false
hasSupport: ->
requestPermission: (cb) ->
window.webkitNotifications.requestPermission (cb)
You can’t perform that action at this time.