Skip to content

Instantly share code, notes, and snippets.

View dtolj's full-sized avatar

Dejan Tolj dtolj

  • Toronto, Canada
View GitHub Profile
/*--- waitForKeyElements(): A utility function, for Greasemonkey scripts,
that detects and handles AJAXed content.
Usage example:
waitForKeyElements (
"div.comments"
, commentCallbackFunction
);
@dtolj
dtolj / gist:3005981
Created June 27, 2012 18:52
auto refresh
#Controller
def action
@tm=Random.rand(11)
render :layout => false
end
#View
#action.haml
=@tm
@dtolj
dtolj / gist:3004058
Created June 27, 2012 13:26
periodically_call_remote jQuery
#assets/javascripts/refresh.js
$(document).ready(
function(){
setInterval(function(){
$('#mydiv').load('action');
}, 16000);
});
#CONTROLLER
def action
@dtolj
dtolj / gist:2974143
Created June 22, 2012 17:37
lazy highcharts
app/controllers/callqueue_controller.rb:250:in `block in index'
lazy_high_charts (1.1.5) lib/lazy_high_charts/high_chart.rb:19:in `block in initialize'
lazy_high_charts (1.1.5) lib/lazy_high_charts/high_chart.rb:13:in `tap'
lazy_high_charts (1.1.5) lib/lazy_high_charts/high_chart.rb:13:in `initialize'
app/controllers/callqueue_controller.rb:168:in `new'
app/controllers/callqueue_controller.rb:168:in `index'
actionpack (3.2.3) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.2.3) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.3) lib/action_controller/metal/rendering.rb:10:in `process_action'
@dtolj
dtolj / gist:2853246
Created June 1, 2012 16:10
Active Record query
Started GET "/dashboard/" for 127.0.0.1 at 2012-06-01 12:30:45 -0400
Processing by DashboardController#index as HTML
Completed 500 Internal Server Error in 1ms
ArgumentError (wrong number of arguments (3 for 2)):
app/controllers/dashboard_controller.rb:34:in `index'
Rendered /usr/local/rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.2.3/lib/action_dispatch/middleware/templates/rescues/_trace.erb (5.5ms)
Rendered /usr/local/rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.2.3/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.3ms)
$ gem install sqlite3-ruby
Building native extensions. This could take a while...
ERROR: Error installing sqlite3-ruby:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for sqlite3.h... yes
checking for sqlite3_libversion_number() in -lsqlite3... yes
checking for rb_proc_arity()... no
@dtolj
dtolj / gstreamertutorial3.py
Created January 22, 2012 20:45
Gstreamer sample mosaic
#!/usr/bin/python
import pygst
pygst.require("0.10")
import gst
import pygtk
import gtk
import gtk.glade
'''
gst-launch -e videomixer name=mix \
@dtolj
dtolj / gui.glade
Created January 22, 2012 20:45
gstreamer sample mosaic
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<widget class="GtkWindow" id="mainwindow">
<property name="visible">True</property>
<property name="title" translatable="yes">window1</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
@dtolj
dtolj / gist:1658711
Created January 22, 2012 20:44
Gstreamer sample mosaic
#!/usr/bin/python
import pygst
pygst.require("0.10")
import gst
import pygtk
import gtk
'''
gst-launch -e videomixer name=mix \
@dtolj
dtolj / gist:1378252
Created November 19, 2011 01:07
vlc playlist daemon
#!/usr/bin/ruby
require 'yaml'
require 'socket'
list_file = "~/.music"
vlc_socket = "/tmp/vlc.sock"
vlc_path = "/usr/bin/vlc"
list_file = File.expand_path(list_file)