Skip to content

Instantly share code, notes, and snippets.

View chamnap's full-sized avatar

Chamnap Chhorn chamnap

View GitHub Profile
@chamnap
chamnap / loader.js.coffee
Created March 14, 2013 15:32
Manage javascript code in large rails app
NS.Loader =
exec: (controller, action="init") ->
ns = NS
controller = _.capitalize(_.singularize(controller))
ns[controller][action]() if controller? and ns[controller]? and ns[controller][action]?
return
init: () ->
## load underscore string
_.mixin(_.string.exports())
@chamnap
chamnap / content-popover.js
Created March 4, 2013 15:36
Twitter bootstrap popover without title and close popover when outside
# This plugin does two things:
# 1. make popover with no title, https://github.com/twitter/bootstrap/issues/1892
# 2. click elsewhere to close, http://jsfiddle.net/asanger/AFffL/266/
( ($) ->
$.fn.content_popover = (options) ->
$.each @, () ->
# Default set to false
isVisible = false
clickedAway = false
@chamnap
chamnap / file1
Last active December 14, 2015 03:59
Mongoid collection name
require 'mongoid'
class A
end
class B
end
class Book
include Mongoid::Document
end
@chamnap
chamnap / gist:1086151
Created July 16, 2011 08:16
My Toolbox
Ruby Gems
nokogiri
typhoeus
dalli
rails
sinatra
mongo_mapper
rabl
rake