Skip to content

Instantly share code, notes, and snippets.

View gstark's full-sized avatar

Gavin Stark gstark

View GitHub Profile
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):
" 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>
# 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
@gstark
gstark / gist:2571816
Created May 1, 2012 22:06
gstvideoscale_patch.diff
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;
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) } }
@gstark
gstark / gist:2554213
Created April 30, 2012 00:03
rails tests postgres

I'm trying to run the rails test suite but I keep getting this error:

$ bundle exec rake postgresql:build_databases
createdb: database creation failed: ERROR:  encoding UTF8 does not match locale en_US
DETAIL:  The chosen LC_CTYPE setting requires encoding LATIN1.
createdb: database creation failed: ERROR:  encoding UTF8 does not match locale en_US
DETAIL:  The chosen LC_CTYPE setting requires encoding LATIN1.
#
# 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
case something
when value1
command1
command2
command3
when value2
command4
command5
when value3
command6
((rand().to_i)...rand((rand(5000).to_i))).send(Enumerable.instance_methods[rand(Enumerable.instance_methods.size)]) { rand(6) > 2 }
@gstark
gstark / bc_howto.txt
Created March 14, 2012 22:43
beyond compare howto
I've owned and used Beyond Compare for a long time and its my go-to tool whenever doing Windows work. I miss it so much I recently went to see if it would run under wine installed via Homebrew. Surprisingly it works quite well. I still won't let up on my yearly emails to Beyond Compare support to encourage a native verison.
brew install wine --use-gcc
<download the beyond compare installer exe>
wine ~/path/to/installer.exe
<install>
wine ~/.wine/drive_c/Program\ Files/Beyond\ Compare\ 3/BCompare.exe
Its a darn good diff tool with great directory compare support, lots of config options. Surprisingly on my Mac via WINE its pretty damn speedy (once X11 is already loaded...)