Skip to content

Instantly share code, notes, and snippets.

View sishen's full-sized avatar

Dingding Ye sishen

View GitHub Profile
@sishen
sishen / url_scoping.js.coffee
Created August 16, 2012 17:32
Url Scoping in Spine.js
class App.Ticket extends Spine.Model
@configure 'Ticket', "id", "project_id"
@scope: ->
"projects/#{current.project_id}"
scope: ->
"projects/#{@project_id}"
@sishen
sishen / mails_viewer_config.rb
Created September 19, 2012 17:57
Sample configuration of mails_viewer to allow the mails real sent to "pragmatic.ly" domain
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
sishen / unicorn
Created January 13, 2013 15:33
The unicorn init.d script to start/stop/restart the service
#!/bin/sh
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
APP_ROOT=/var/www/pragmaticly/current
PID=$APP_ROOT/tmp/pids/unicorn.pid
@sishen
sishen / makeapp.sh
Created November 12, 2013 11:03
Turn website to application using Chrome
#!/bin/sh
echo "What should the Application be called (no spaces allowed e.g. GCal)?"
read inputline
name=$inputline
echo "What is the url (e.g. https://www.google.com/calendar/render)?"
read inputline
url=$inputline
@sishen
sishen / gist:1019347
Created June 10, 2011 17:49
Nokogiri Template Builder. (Rails 3.0)
require 'action_view'
module ActionView
module Template::Handlers
class NokogiriBuilder
class_attribute :default_format
self.default_format = Mime::XML
def call(template)
require 'nokogiri'