Example: <script type="text/x-jquery-tmpl" id="timeTagTemplate"> ${$data} </script> <script type="text/x-jquery-tmpl" id="commentTemplate">
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module SessionsHelper | |
def sign_in(user) | |
cookies.permanent.signed[:remember_token] = [user.id, user.salt] | |
self.current_user = user | |
end | |
def current_user=(user) | |
@current_user = user | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!!! | |
%html | |
%head | |
= csrf_meta_tags | |
= stylesheet_link_tag "application" | |
%body | |
= yield | |
= javascript_include_tag "application" | |
= render_inline_javascript_controller_action_asset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'fileutils' | |
Dir['./db/migrate/*.rb'].each do |from| | |
to = File.join(File.dirname(from), | |
"%014d%s" % File.basename(from).match(/^(\d+)(_.*)$/)[1..-1].map.with_index do |f, i| | |
0 == i ? f.to_i : f | |
end) | |
FileUtils.mv(from, to) if from != to | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function throttle(millis, fn) { | |
var sched; | |
return function() { | |
if (!sched) | |
sched = setTimeout(function executeAndClear() { fn(); sched = false; }, millis); | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package { | |
import net.flashpunk.Entity; | |
import net.flashpunk.FP; | |
import net.flashpunk.graphics.Graphiclist; | |
import net.flashpunk.graphics.Text; | |
public class HUD extends Entity { | |
[Embed(source = "assets/fonts/pf_tempesta_seven.TTF", embedAsCFF=false, fontFamily = "what")] | |
public var myvar:String; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function AsynchDispatcher() { | |
var listeners = [], | |
m = 'message', | |
w = window; | |
function receiveMessage(index) { | |
index = parseInt(index.data || index); | |
setTimeout(listeners[index], 10); | |
if (index) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Factory.sequence :luhn do |n| | |
def luhn?(n) | |
odd = false | |
0 == n.to_s.scan(/\d/).inject(0) { |a, d| | |
i = d.to_i * (odd = !odd ? 2 : 1) | |
a + (i > 9 ? i - 9 : i) | |
} % 10 | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'stringio' | |
class Capistrano::Logger | |
class StringIOProxy < StringIO | |
def initialize(proxy_target) | |
@proxy_target = proxy_target | |
super('') | |
end | |
def write(*args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* Base64 encode / decode | |
* http://www.webtoolkit.info/ | |
* | |
**/ | |
var Base64 = (function() { | |
// Private methods for UTF-8 encoding and decoding |