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
/* `Utilities | |
/******************************/ | |
/* Gilder/Levin & Phark image replacement */ | |
a.ir, a.phark { cursor:pointer; text-decoration:none } | |
a.ir:active, a.phark:active { outline:0 } | |
.ir, .phark { display:block; position:relative; overflow:hidden } | |
.ir span { display:block; height:100%; width:100%; position:absolute; top:0; left:0; background:no-repeat 0 0 } | |
.phark{text-indent:-999em} |
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
$.fn.alphabetize = function(options){ | |
var $list = this, | |
$item = this.children(); | |
options = options || {}; | |
$item.sort(function(a,b){ | |
var x = (options.on && $(a).find(options.on) || $(a)).text(), | |
y = (options.on && $(b).find(options.on) || $(b)).text(); |
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(exports){ | |
// When the DOM is ready... | |
$(function(){ | |
// ...Find any elements that have a data-view attribute | |
$('[data-view]').each(function(){ | |
// Store a reference to the node and the data-view attribute value. | |
var $node = $(this), attr = $node.data('view'); | |
// Create an instance of a class with a name that matches the value of attr, | |
// pass the node as a parameter to the constructor, and then store the instance | |
// in the node's data hash. |
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() { | |
var svgns = "http://www.w3.org/2000/svg"; | |
function forceTextWrappingOn(node, width) { | |
console.log(node); | |
var chars = node.firstChild.nodeValue.split(' '), | |
x = parseInt(node.getAttribute('x'), 10), | |
y = parseInt(node.getAttribute('y'), 10), | |
index = 0, | |
tspan, tspanWidth, textNode |
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
var camelize = function(str) { | |
return str[0].toLowerCase() + str.replace(/-([a-z])/g, function(a, b) { return b.toUpperCase(); }).slice(1); | |
} | |
var pluginize = function(classname, context) { | |
var camelized = camelize(classname) | |
$.fn[camelized] = function(config){ | |
if (!this.length) return; | |
return this.each(function(){ | |
var $element = $(this) |
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
select.form-control + .chosen-container.chosen-container-single .chosen-single { | |
display: block; | |
width: 100%; | |
height: 34px; | |
padding: 6px 12px; | |
font-size: 14px; | |
line-height: 1.428571429; | |
color: #555; | |
vertical-align: middle; | |
background-color: #fff; |
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
class ApplicationController < ActionController::Base | |
protect_from_forgery with: :exception | |
def devise_parameter_sanitizer | |
return super unless resource_class == User | |
Sanitizers::User.new(User, :user, params) | |
end | |
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
select table_name, | |
round((data_length + index_length)/1024/1024/1024, 2) as `gb` | |
from information_schema.tables | |
where table_schema = "schema" | |
order by `gb` desc; |
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
class Scrubber | |
VALUE_PROVIDERS = { | |
"name" => Proc.new { Faker::Name.name }, | |
"email" => Proc.new { Faker::Internet.email }, | |
"ssn" => Proc.new { rand.to_s[2..10] } | |
} | |
def scrub(*classes) | |
classes.each do |klass| | |
klass.all.each { |model| fake(model) } |
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 Model(){} | |
// Converts a hash or each hash of an array into an instance of the calling class. | |
Model.fromObject = function(obj){ | |
if (obj && !$.isArray(obj)){ | |
return $.extend(new this(), obj); | |
} | |
var collection = []; | |
for(var index in obj){ collection.push(this.fromObject(obj[index])); } |
OlderNewer