A painfully obsessive cheat sheet to favicon sizes/types. Compiled from:
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
if @params[:highlighting] | |
hash[:hl] = true | |
hash["hl.fl"] = @params[:highlighting][:field_list].join(',') if @params[:highlighting][:field_list] | |
snippets = @params[:highlighting][:max_snippets] | |
if snippets | |
if snippets.kind_of? Hash | |
if snippets[:default] | |
hash["hl.snippets"] = snippets[:default] | |
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
~$ ARCHFLAGS='-arch i386 -arch x86_64' | |
~$ rvm install 1.8.7 --debug --reconfigure -C --enable-shared=yes | |
~$ wget http://sourceforge.net/projects/rubycocoa/files/RubyCocoa/1.0.0/RubyCocoa-1.0.0.tar.gz/download | |
~$ tar xzf RubyCocoa-1.0.0.tar.gz && rm RubyCocoa-1.0.0.tar.gz && cd RubyCocoa-1.0.0 | |
~/RubyCocoa-1.0.0$ ruby install.rb config --build-universal=yes | |
~/RubyCocoa-1.0.0$ ruby install.rb setup | |
~/RubyCocoa-1.0.0$ sudo ruby install.rb install |
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
# pgbackups client from heroku gem | |
require 'pgbackups/client' | |
desc 'Backup database' | |
task(:backup_database => :environment) { backup_database } | |
desc 'cron' | |
task :cron => :backup_database | |
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
// checksum calculation for GTIN-8, GTIN-12, GTIN-13, GTIN-14, and SSCC | |
// based on http://www.gs1.org/barcodes/support/check_digit_calculator | |
function isValidBarcode(barcode) { | |
// check length | |
if (barcode.length < 8 || barcode.length > 18 || | |
(barcode.length != 8 && barcode.length != 12 && | |
barcode.length != 13 && barcode.length != 14 && | |
barcode.length != 18)) { | |
return false; | |
} |
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
namespace :db do | |
namespace :sessions do | |
desc "Clean up expired Active Record sessions (updated before ENV['UPDATED_AT'], defaults to 1 month ago)." | |
task :expire => :environment do | |
time = Time.parse( ENV['UPDATED_AT'] || 1.month.ago.to_s(:db) ) | |
say "cleaning up expired sessions (older than #{time}) ..." | |
session = ActiveRecord::SessionStore::Session | |
rows = session.delete_all ["updated_at < ?", time] | |
say "deleted #{rows} session row(s) - there are #{session.count} session row(s) left" | |
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 validateEmail(email){} | |
* @author Anunay Dahal | |
* @param String email [Email address as a parameter] | |
* @return Boolean [Returns TRUE if email address is valid else return FALSE] | |
*/ | |
function validateEmail(email){ | |
return /^([\w!.%+\-])+@([\w\-])+(?:\.[\w\-]+)+$/.test(email); | |
} |
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
/* | |
Check digit GS1 | |
Arguments: | |
- [String] GS1 code without check digit to generate | |
the check digit | |
Returns: | |
- [Number] Check digit for given code | |
Author: Matheus R. Kautzmann | |
*/ |
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
/** | |
* Is string a valid phone number? | |
* | |
* @param {string} str | |
* @return {boolean} | |
*/ | |
var isValidPhone = function (str) { | |
if (!str) return false; | |
var count = str.replace(/[^0-9]/g, '').length; | |
return count == 10 || count == 11; |
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: | |
<header id="js-cover" class="cover"> | |
<!-- Optionally specify image width stoppoints to reduce the maximum possible no of transforms per image --> | |
<!-- The appropriate image resolution will automatically be loaded --> | |
<img | |
data-stoppoints="480,768,1200" | |
data-src="http://res.cloudinary.com/<your account name>/image/fetch/w_auto,dpr_auto/http://<your full img url>" | |
class="cld-responsive cover-img" id="js-cover-img"> |
OlderNewer