Adam Lassek alassek

View location.js
1 2 3 4 5 6 7 8 9 10
/**
* `window.location` is a BAD api. Doesn't have a prototype, 'too much recursion' error
* if you try to inspect the constructor. Monkey-patching causes random disappearances
* of the monkey-patched function in Chrome, cloning causes 'too much recursion' in FF.
*
* This is what I'm reduced to. ಠ_ಠ
**/
(function () {
 
function Location () {
View html_truncate.rb
1 2 3 4 5 6 7 8 9 10
# By Henrik Nyh <http://henrik.nyh.se> 2008-01-30.
# Free to modify and redistribute with credit.
 
require "rubygems"
require "hpricot"
 
module TextHelper
 
# Like the Rails _truncate_ helper but doesn't break HTML tags or entities.
def truncate_html(text, max_length = 30, ellipsis = "...")
View extendEach.js
1 2 3 4 5 6 7 8 9
(function () {
 
function extendEach () {
var args = Array.prototype.slice.call(arguments),
child = this;
 
_.each(args, function (proto) {
child = child.extend(proto);
});
View typeIntent.js
1 2 3 4 5 6 7 8 9 10
/*
* 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:
*
View store_ext.js
1 2 3 4 5
amplify.store.remove = function ( key ) {
var value = amplify.store( key );
amplify.store( key, null );
return value;
}
View konami.js
1 2 3 4 5 6 7 8 9 10
(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);
View get_flash.rb
1 2 3 4 5 6 7 8 9
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')
View load_erb.rb
1 2 3 4 5 6 7 8 9
class << YAML
def load_erb(file)
load(
ERB.new(
IO.read(file)
).result
)
end
end
View activesupport_stacktrace
1 2 3 4 5 6 7 8 9 10
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'
View bash_tricks.sh
1 2
# batch-rename files by extension less -> scss
for f in *less ; do mv $f `basename $f less`scss; done
Something went wrong with that request. Please try again.