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
# This shows that set |= collection creates a NEW set with the resulting | |
# members which is slightly inefficient. #merge does the same thing | |
# without creating a new Set object | |
require 'set' | |
set = Set.new([1,2,3,4]) | |
puts "set is: #{set.inspect} and Object ID before |= is #{set.object_id}" |
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
Started POST "/redacted/redacted" for 173.65.43.25 at Thu Jul 12 06:39:04 -0400 2012 | |
NativeException (java.sql.SQLException: javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:/torquebox/datasources/ | |
app-knob.yml/production): | |
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
" noremap <silent> ,cc :<C-B>silent <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR> | |
" noremap <silent> ,cu :<C-B>silent <C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:nohlsearch<CR> |
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
# Hash keyed by y to speed to_s | |
def to_h | |
hash_with_default = Hash.new {|hash,key| hash[key] = []} | |
@points.inject(hash_with_default) { |hash, point| h[point.y] << point.x; hash } | |
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
diff --git a/gst/videoscale/gstvideoscale.c b/gst/videoscale/gstvideoscale.c | |
index 7b44647..5618b37 100644 | |
--- a/gst/videoscale/gstvideoscale.c | |
+++ b/gst/videoscale/gstvideoscale.c | |
@@ -307,6 +307,7 @@ gst_video_scale_class_init (GstVideoScaleClass * klass) | |
static void | |
gst_video_scale_init (GstVideoScale * videoscale, GstVideoScaleClass * klass) | |
{ | |
+ GST_DEBUG("GES: calling video scale init"); | |
videoscale->tmp_buf = 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
require 'benchmark' | |
n = 5_000_000 | |
find = 4 | |
array = [1,2,3,4] | |
Benchmark.bm do |x| | |
x.report { n.times { array.include?(4) } } | |
x.report { n.times { array.include?(5) } } | |
x.report { n.times { [1,2,3,4].include?(5) } } |
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
# | |
# Having #process dependent on File.open | |
# *and* #read, separate the processing to allow a | |
# more general IO processing and another method | |
# that handles the opening to get the IO and delegate | |
# | |
describe "Processing XML file" do | |
it "Reads from a file and processes the contents" do | |
file_path = "/some/path/to.xml" | |
stub_io = stub |
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
case something | |
when value1 | |
command1 | |
command2 | |
command3 | |
when value2 | |
command4 | |
command5 | |
when value3 | |
command6 |
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
((rand().to_i)...rand((rand(5000).to_i))).send(Enumerable.instance_methods[rand(Enumerable.instance_methods.size)]) { rand(6) > 2 } |
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
BOOL canCustomize = No; | |
canCustomize = [self.cust....] || | |
[self.cust....] || | |
[self.cust....] || | |
[self.cust....] || | |
[self.cust....] || | |
[self.cust....]; | |
return canCustomize; |