This file contains hidden or 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
| #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 |
This file contains hidden or 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
| #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 |
This file contains hidden or 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
| var myData = CUSTOM.getData(); | |
| var myJsCallback = function(data) { | |
| alert(data); | |
| } |
This file contains hidden or 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
| appView = super.getView(); | |
| custom_js = new CustomJS(); | |
| appView.addJavascriptInterface(custom_js, "CUSTOM"); |
This file contains hidden or 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
| private class CustomJS { | |
| private WebView webview; | |
| public CustomJS(WebView view) { | |
| webview = view; | |
| } | |
| /** | |
| * holds some java data |
This file contains hidden or 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
| #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)) |
This file contains hidden or 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
| 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 { | |
This file contains hidden or 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 '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 |
This file contains hidden or 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
| 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) |
This file contains hidden or 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 'fileutils' | |
| require 'pathname' | |
| require 'ruby-debug' | |
| require 'ostruct' | |
| require 'rest_client' | |
| require 'json' | |
| # multiple gems use the require tumblr, this one refers to http://github.com/mwunsch/tumblr | |
| # note that ruby-debug and the weary lib, which makes reqs for this tumblr gem, don't play nicely together | |
| require 'tumblr' |