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
/** | |
* Takes two version numbers with multiple decimal points (e.g. '7.0.3') and | |
* returns true if the first one is greater than or equal to the second. | |
* | |
* @param v1 version that should be greater than or equal | |
* @param v2 version that should be less than or equal | |
* @returns {boolean} true if 'v1' >= 'v2' | |
*/ | |
function is_version_gte(v1, v2) { | |
var v1_parts = (v1 || 0).toString().split('.').map(function(s) {return parseInt(s)}); |
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
/** | |
* @returns {boolean} true if this is an iOS device running 'version' or greater | |
*/ | |
function is_iOS_app_gte(version) { | |
return typeof window.device != "undefined" && window.device.platform == "iOS" && is_version_gte(window.device.version, version); | |
} | |
/** | |
* Is this an Apple iOS device and running version 7.0 or greater? |
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
cattle = ['hereford', 'angus', 'brahman', 'holstein'] | |
dogs = ['terrier', 'akita', 'poodle', 'afghan'] | |
breed = 'afghan' | |
animal_type = case breed | |
when *cattle | |
'cow' | |
when *dogs | |
'dog' |
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
# test failed create due to validation | |
require 'awesome_print' # support 'ap' | |
sli = nil | |
Octopus.using(LassoDbSharding.key(ShoppingListItem, Retailer.find(767))) do | |
ap sli = ShoppingListItem.create() | |
ap sli.errors | |
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
docker-machine Notes | |
Download docker-machine binary from: | |
https://github.com/cloudnativeapps/machine/releases | |
(not: https://github.com/docker/machine/releases) | |
OR - build it yourself by cloning and following the build instructions at the bottom of the README.md: | |
https://github.com/docker/machine | |
Move the downloaded binary to: | |
/usr/local/bin/docker-machine |
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
require 'log4r' | |
def logger | |
@@logger ||= Logger.new("#{Rails.root}/log/some_profile.log") | |
end | |
def elapsed(start_time) | |
elapsed_secs = Time.now - start_time | |
"#{'%2d' % (elapsed_secs/60)}:#{'%02d' % (elapsed_secs%60)}:#{('%.4f' % (elapsed_secs - elapsed_secs.floor))[-4..-1]}" | |
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
class Asset < ActiveRecord::Base | |
# used for extra mime types that dont follow the convention | |
@@extra_content_types = { :audio => ['application/ogg'], :movie => ['application/x-shockwave-flash'], :pdf => ['application/pdf'] }.freeze | |
cattr_reader :extra_content_types | |
# use #send due to a ruby 1.8.2 issue | |
@@movie_condition = send(:sanitize_sql, ['content_type LIKE ? OR content_type IN (?)', 'video%', extra_content_types[:movie]]).freeze | |
@@audio_condition = send(:sanitize_sql, ['content_type LIKE ? OR content_type IN (?)', 'audio%', extra_content_types[:audio]]).freeze | |
@@image_condition = send(:sanitize_sql, ['content_type IN (?)', Technoweenie::AttachmentFu.content_types]).freeze | |
@@other_condition = send(:sanitize_sql, [ |
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
danlynn:mephisto-emk-rails-2.2 danlynn$ git push public | |
error: object directory /data/git/repositories/7/f2/88/1b/jamesfleeting/mephisto.git/objects does not exist; check .git/objects/info/alternates. | |
error: object directory /data/git/repositories/0/89/0e/7c/igotimac/birdblog.git/objects does not exist; check .git/objects/info/alternates. | |
error: object directory /data/git/repositories/0/89/0e/7c/igotimac/birdblog.git/objects does not exist; check .git/objects/info/alternates. | |
error: object directory /data/git/repositories/7/f2/88/1b/jamesfleeting/mephisto.git/objects does not exist; check .git/objects/info/alternates. | |
Counting objects: 89, done. | |
Compressing objects: 100% (56/56), done. | |
Writing objects: 100% (56/56), 6.85 KiB, done. | |
Total 56 (delta 42), reused 0 (delta 0) | |
error: object directory /data/git/repositories/7/f2/88/1b/jamesfleeting/mephisto.git/objects does not exist; check .git/objects/info/alternates. |
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
danlynn:delete danlynn$ git clone git://github.com/emk/mephisto.git | |
Initialized empty Git repository in /Users/danlynn/Documents/temp/delete/mephisto/.git/ | |
remote: error: object directory /data/git/repositories/7/f2/88/1b/jamesfleeting/mephisto.git/objects does not exist; check .git/objects/info/alternates. | |
remote: error: object directory /data/git/repositories/0/89/0e/7c/igotimac/birdblog.git/objects does not exist; check .git/objects/info/alternates. | |
remote: error: object directory /data/git/repositories/0/89/0e/7c/igotimac/birdblog.git/objects does not exist; check .git/objects/info/alternates. | |
remote: error: object directory /data/git/repositories/7/f2/88/1b/jamesfleeting/mephisto.git/objects does not exist; check .git/objects/info/alternates. | |
remote: error: object directory /data/git/repositories/7/f2/88/1b/jamesfleeting/mephisto.git/objects does not exist; check .git/objects/info/alternates. | |
remote: error: object directory /data/git/repositories/0/89/0e/7c/igotimac/birdblog.git/objects does not e |
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
danlynn:delete danlynn$ git clone git://github.com/emk/mephisto.git | |
Initialized empty Git repository in /Users/danlynn/Documents/temp/delete/mephisto/.git/ | |
remote: error: object directory /data/git/repositories/7/f2/88/1b/jamesfleeting/mephisto.git/objects does not exist; check .git/objects/info/alternates. | |
remote: error: object directory /data/git/repositories/0/89/0e/7c/igotimac/birdblog.git/objects does not exist; check .git/objects/info/alternates. | |
remote: error: object directory /data/git/repositories/0/89/0e/7c/igotimac/birdblog.git/objects does not exist; check .git/objects/info/alternates. | |
remote: error: object directory /data/git/repositories/7/f2/88/1b/jamesfleeting/mephisto.git/objects does not exist; check .git/objects/info/alternates. | |
remote: error: object directory /data/git/repositories/7/f2/88/1b/jamesfleeting/mephisto.git/objects does not exist; check .git/objects/info/alternates. | |
remote: error: object directory /data/git/repositories/0/89/0e/7c/igotimac/birdblog.git/objects does not e |
OlderNewer