Skip to content

Instantly share code, notes, and snippets.

View danmayer's full-sized avatar

Dan Mayer danmayer

View GitHub Profile
Dan-Mayers-MacBook-Pro:deals danmayer$ RAILS_ENV=test rake hydra:units --trace
(in /Users/danmayer/projects/deals)
** Invoke hydra:units (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute hydra:units
1276290897.15143 MASTER| Initialized
1276290897.1515 MASTER| Files: (["test/unit/helpers/pipeline/base_helper_test.rb", "test/unit/helpers/pipeline/timeline_helper_test.rb"])
1276290897.15154 MASTER| Workers: ([{:type=>:local, :runners=>1}])
1276290897.15157 MASTER| Verbose: (true)
require 'hydra'
require 'hydra/tasks'
#Hydra::TestTask.new('hydra:units' => :environment) do |t|
Hydra::TestTask.new('hydra:units' => ['environment']) do |t|
t.verbose = true
#require 'test/test_helper'
#require 'config/environment'
# add small example tests
t.add_files 'test/unit/helpers/pipeline/**/*_test.rb'
end
Luigi yeah exactly. Phone gap makes it easy to write any native code and add a JS bridge to interact with the code.
This isn't the easiest to follow example, but I learned how to add handlers based on it.
http://www.somms.net/2010/05/28/native-messages-for-android-phonegap/
Basically you create a class (using java for android example):
private class CustomJS {
#Found this, which you can add to your .bash_profile, and use like `retry "cmd_which_often fails"`
function retry {
nTrys=0
maxTrys=250
status=256
until [ $status == 0 ] ; do
$1
status=$?
nTrys=$(($nTrys + 1))
private class CustomJS {
private WebView webview;
public CustomJS(WebView view) {
webview = view;
}
/**
* holds some java data
appView = super.getView();
custom_js = new CustomJS();
appView.addJavascriptInterface(custom_js, "CUSTOM");
var myData = CUSTOM.getData();
var myJsCallback = function(data) {
alert(data);
}
#redirect all traffic to https over ssl with Sinatra
configure :production do
# us a simple before filter to redirect all requests in production to https
# before do
# unless (@env['HTTP_X_FORWARDED_PROTO'] || @env['rack.url_scheme'])=='https'
# redirect "https://#{request.env['HTTP_HOST']}#{request.env["REQUEST_PATH"]}"
# end
# end
@danmayer
danmayer / gist:941718
Created April 26, 2011 03:02
mocha_should_default_prevent_stubbing_non_existent_method
#I think mocha should default to preventing non existent methods, but make it easy to sidestep when you half to
#I find that putting this in your test_helper.rb can help to keep your tests more maintainable in the long run
Mocha::Configuration.prevent(:stubbing_non_existent_method)
def allow_non_existent_stubbing
Mocha::Configuration.allow(:stubbing_non_existent_method)
yield
Mocha::Configuration.prevent(:stubbing_non_existent_method)
end
@danmayer
danmayer / swap_buffer_window.el
Created June 5, 2011 16:41
This function makes emacs move the current buffer to another window. It also closes the current tab and sets focus on the new buffer
;; move buffer to other window
;; after c-x 3 to split screen this lets you move buffers between sides.
;; altered code from:
;; http://stackoverflow.com/questions/1774832/how-to-swap-the-buffers-in-2-windows-emacs
(defun swap-buffer-window ()
"Put the buffer from the selected window in next window, and vice versa"
(interactive)
(let* ((this (selected-window))
(other (next-window))
(this-buffer (window-buffer this)))