Skip to content

Instantly share code, notes, and snippets.

View jcberthon's full-sized avatar

Jean-Christophe jcberthon

View GitHub Profile
@jcberthon
jcberthon / string_ext.rb
Created June 12, 2012 10:49 — forked from erskingardner/string_ext.rb
Convert String to Boolean value
class String
def to_boolean
return true if self == true || self =~ (/(true|t|yes|y|1)$/i)
return false if self == false || self.nil? || self.empty? || self =~ (/(false|f|no|n|0)$/i)
raise ArgumentError.new("invalid value for Boolean: \"#{self}\"")
end
end
@jcberthon
jcberthon / docker-img-gc
Last active September 11, 2017 02:59 — forked from anildigital/gist:862675ec1b7bccabc311
Remove dangling docker images and volumes
docker images --quiet --filter=dangling=true | xargs --no-run-if-empty docker rmi