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
sishen / Usage:
Created May 10, 2012
Controller Observer: It's very similar like Sweeper but the observer should be manually added into config/application.rb. The benefit is that the observe still can be callable in the non-request environment such as console or rake.
View Usage:
# In Controller such as comments_controller.rb
observer :comment_observer, only: [:create, :destroy]
@sishen
sishen / clean_eco_template.rb
Created Apr 11, 2012 — forked from doitian/clean_eco_template.rb
CleanEcoTemplate for Sprockets in Rails app
View clean_eco_template.rb
# Put this file in lib/
require 'sprockets/eco_template'
class CleanEcoTemplate < Sprockets::EcoTemplate
FROM = " (function() {"
TO = "}).call(__obj);"
def evaluate(scope, locals, &block)
content = Eco.compile(data)
@sishen
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
sishen / Emacs-JSLint
Created Jan 7, 2011
Emacs Func: Use ~/bin/jslint4java-1.4.4.jar to automatically JSLint the Javascript file
View Emacs-JSLint
;;; C-x c calls jslint and outputs to the *compilation* buffer.
(setq jslint-wrapper (concat "java -jar " (substitute-in-file-name "$HOME") "/bin/jslint4java-1.4.4.jar "))
(require 'compile)
(add-hook 'javascript-mode-hook
(lambda ()
(set (make-local-variable 'compilation-read-command) nil)
(set (make-local-variable 'compile-command)
(concat jslint-wrapper buffer-file-name))
(local-set-key (kbd "C-x c") 'compile)))
View cucumber: feature-mode.el.patch
diff --git b/cucumber/feature-mode.el a/cucumber/feature-mode.el
index 06b5667..9f37685 100644
--- b/cucumber/feature-mode.el
+++ a/cucumber/feature-mode.el
@@ -57,7 +57,7 @@
(list
'("^ *Feature:" (0 font-lock-keyword-face) (".*" nil nil (0 font-lock-type-face t)))
'("^ *Background:$" (0 font-lock-keyword-face))
- '("^ *Scenario\\(?: Outline\\)?:" (0 font-lock-keyword-face) (".*" nil nil (0 font-lock-function-name-face t)))
+ '("^ *Scenarios?\\(?: Outline\\)?:" (0 font-lock-keyword-face) (".*" nil nil (0 font-lock-function-name-face t)))
You can’t perform that action at this time.