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
<script src="//s3.amazonaws.com/assets.kickofflabs.com/js/jquery.maskedinput.min.js"></script> | |
<script> | |
jQuery(function($){ | |
$("[name^='phone']").mask("(999) 999-9999"); | |
}); | |
</script> |
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
<script> | |
function getParameterByName(name) | |
{ | |
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); | |
var regexS = "[\\?&]" + name + "=([^&#]*)"; | |
var regex = new RegExp(regexS); | |
var results = regex.exec(window.location.href); | |
if(results == null) | |
{return null;} |
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 EstimateCount | |
extend ActiveSupport::Concern | |
module ClassMethods | |
def estimate_count | |
sql = "SELECT reltuples FROM pg_class WHERE relname = '#{self.table_name}'" | |
query = self.connection.execute(sql) | |
if result = query.first | |
("%f" % result['reltuples']).to_i |
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
Quick tips for finding the perfect theme for vim. | |
1. Install flazz/vim-colorschemes plugin (480+ themes) | |
You can see previews here: http://vimcolorschemetest.googlecode.com/svn/html/index-html.html | |
Too many for me to look through...plus, how does it look with my code? | |
2. Set your colorscheme to random |
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
before_update :audit | |
def audit | |
if self.changed? | |
# find columns we want to audit | |
audit_columns = UserAudit.column_names.reject{|c| %w{id created_at updated_at}.include?(c)} | |
# add the user_id | |
data = self.attributes.dup.merge('user_id' => self.id) | |
# copy the pre-modified values | |
self.changes.each {|att, a| data[att] = a[0]} |
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
<form class="form-inline" role="form" method="POST" action="https://api.kickofflabs.com/v1/1905/subscribe"> | |
<input type="hidden" name="return_url" value="http://kickofflabs.com"> | |
<label for="email">Email address</label> | |
<input type="email" id="email" name="email" placeholder="Your Best Email Address"> | |
<button type="submit">Sign Me Up</button> | |
</form> |
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 ABHelper | |
def choose_test(name, default_option, *options) | |
key = "#{name}_ab" | |
unless current_test = (params[key] || session[key] || cookies[key]) | |
current_test = options[rand(options.count)] | |
end | |
current_test = default_option unless options.include?(current_test) | |
session[key] = cookies.permanent[key] = current_test | |
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
$ = jQuery | |
$.fn.extend | |
nodoublesubmit: (options) -> | |
settings = | |
delay: 2000 | |
debug: false | |
settings = $.extend settings, options |
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 hs(){ | |
heroku "$@" --remote staging | |
} | |
function hp(){ | |
heroku "$@" --remote production | |
} |