This file contains hidden or 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
/* | |
* Copyright (c) 2011 Lyconic, LLC. | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights | |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
* copies of the Software, and to permit persons to whom the Software is | |
* furnished to do so, subject to the following conditions: | |
* |
This file contains hidden or 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
amplify.store.remove = function ( key ) { | |
var value = amplify.store( key ); | |
amplify.store( key, null ); | |
return value; | |
} |
This file contains hidden or 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 ($) { | |
$.fn.konami = function (callback, code) { | |
code = code || "38,38,40,40,37,39,37,39,66,65,13"; | |
return this.each(function () { | |
var kkeys = []; | |
$(this).keydown(function (e) { | |
kkeys.push(e.keyCode); | |
if (kkeys.toString().indexOf(code) >= 0) { | |
$(this).unbind('keydown', arguments.callee); | |
callback(e); |
This file contains hidden or 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
def get_flash | |
signed_message = request.cookies['_project_name_session'] | |
if signed_message.present? | |
secret = ProjectName::Application.config.secret_token | |
verifier = ActiveSupport::MessageVerifier.new(secret) | |
session = verifier.verify(signed_message) | |
@flash = session.delete('flash') |
This file contains hidden or 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
class << YAML | |
def load_erb(file) | |
load( | |
ERB.new( | |
IO.read(file) | |
).result | |
) | |
end | |
end |
This file contains hidden or 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
activesupport (3.0.3) lib/active_support/dependencies.rb:304:in `depend_on' | |
activesupport (3.0.3) lib/active_support/dependencies.rb:216:in `require_dependency' | |
actionpack (3.0.3) lib/abstract_controller/helpers.rb:148:in `modules_for_helpers' | |
actionpack (3.0.3) lib/abstract_controller/helpers.rb:144:in `map!' | |
actionpack (3.0.3) lib/abstract_controller/helpers.rb:144:in `modules_for_helpers' | |
actionpack (3.0.3) lib/action_controller/metal/helpers.rb:101:in `modules_for_helpers' | |
actionpack (3.0.3) lib/abstract_controller/helpers.rb:97:in `helper' | |
actionpack (3.0.3) lib/abstract_controller/helpers.rb:161:in `default_helper_module!' | |
actionpack (3.0.3) lib/abstract_controller/helpers.rb:24:in `inherited' | |
actionpack (3.0.3) lib/abstract_controller/helpers.rb:24:in `class_eval' |
This file contains hidden or 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
# batch-rename files by extension less -> scss | |
for f in *less ; do mv $f `basename $f less`scss; done |
This file contains hidden or 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
/Users/adam/.rvm/gems/ruby-1.8.7-p299@rails3/gems/activerecord-3.0.3/lib/active_record/connection_adapters/mysql_adapter.rb:22:in `mysql_connection': !!! Missing the mysql2 gem. Add it to your Gemfile: gem 'mysql2' (RuntimeError) | |
from /Users/adam/.rvm/gems/ruby-1.8.7-p299@rails3/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:228:in `send' | |
from /Users/adam/.rvm/gems/ruby-1.8.7-p299@rails3/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:228:in `new_connection' | |
from /Users/adam/.rvm/gems/ruby-1.8.7-p299@rails3/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:236:in `checkout_new_connection' | |
from /Users/adam/.rvm/gems/ruby-1.8.7-p299@rails3/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:190:in `checkout' | |
from /Users/adam/.rvm/gems/ruby-1.8.7-p299@rails3/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb: |
This file contains hidden or 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
<%@ Page Language="C#" %> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<script runat="server"> | |
protected void Page_Load(object sender, EventArgs e) | |
{ | |
Response.AddHeader("Refresh", Convert.ToString((Session.Timeout * 60) - 10)); | |
} | |
</script> |
This file contains hidden or 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
// http://blog.stevenlevithan.com/archives/faster-trim-javascript | |
function trim12 (str) { | |
var str = str.replace(/^\s\s*/, ''), | |
ws = /\s/, | |
i = str.length; | |
while (ws.test(str.charAt(--i))); | |
return str.slice(0, i + 1); | |
} |