1 JSON.parse({"a" => Date.today}.to_json) # => {"a"=>"2012-06-18"}
:)
1 JSON.parse(JSON.stringify({"a": new Date()})).a // "2012-06-18T14:46:47.357Z"
2 new Date() // Mon Jun 18 2012 16:46:54 GMT+0200 (CEST)
1 EM.add_periodic_timer(nil, &block)
2 EM.add_periodic_timer(0, &block)
1 EM.every_tick(&block) # + warning in doc
commit 28733e5f6ecbb44e006c9780d1a894b15cdde54f
Author: Paweł Pacana <pawel.pacana@gmail.com>
Date: Wed Apr 18 14:04:16 2012 +0200
if you cleanup, dot it AFTER
diff --git a/config/deploy.rb b/config/deploy.rb
index 34af8f0..77b0a1c 100644
--- a/config/deploy.rb
+++ b/config/deploy.rb
@@ -166,8 +166,8 @@ namespace :deploy do
end
before "deploy:update", "deploy:pre_announce"
-before "deploy:update", "deploy:cleanup"
after "deploy:update", "deploy:middle_announce"
+after "deploy:update", "deploy:cleanup"
before "deploy:restart", "deploy:another_announce"
after "deploy:restart", "deploy:post_announce"
The user agent may throw a SecurityError exception instead of returning a Storage object if the request violates a policy decision (e.g. if the user agent is configured to not allow the page to persist data).
1 typeof(window.localStorage)
1 EM.run {
2 EM.stop
3 puts EM.reactor_running?
4 EM.next_tick{
5 puts EM.reactor_running?
6 EM.next_tick{
7 puts EM.reactor_running?
8 }
9 }
10 }
output:
1 true
2 true
"E" + exception
1 output = failures.present?? "F" : output
2 failures.each {|failed| runner.puke(self.class, method_name, failed) }
Forks to have fast running multi-program acceptance tests
1 Assertion failed: ok (mailbox.cpp:84)
2 Aborted (core dumped)
new ZMQ context after fork
1 at_exit{ at_exit { puts "here close things like browsers etc" } }
or
1 MiniTest::Unit.after_tests {}
otherwise:
1 at_exit{ run_minitest } # second , usually from test_helper
2 at_exit{ close_browser } # first
it allows:
1 ruby -Ilib:test test/unit/something_test.rb
and
1 require 'test_helper'
2 class TestX < MiniTest::Unit; end
we should (IMHO) use dedicated test runners like Turn: https://github.com/TwP/turn
1 turn -Ilib:test test/unit/something_test.rb
1 Capistrano::Configuration.instance(:must_exist).load do
2 after "deploy", "deploy:notify_hoptoad"
3 after "deploy:migrations", "deploy:notify_hoptoad"
4
5 namespace :deploy do
6 desc "Notify Hoptoad of the deployment"
7 task :notify_hoptoad, :except => { :no_release => true } do
8 rails_env = fetch(:hoptoad_env, fetch(:rails_env, "production"))
9 local_user = ENV['USER'] || ENV['USERNAME']
10 executable = RUBY_PLATFORM.downcase.include?('mswin') ? fetch(:rake, 'rake.bat') : fetch(:rake, 'rake')
11 notify_command = "#{executable} hoptoad:deploy TO=#{rails_env} REVISION=#{current_revision} REPO=#{repository} USER=#{local_user}"
12 notify_command << " DRY_RUN=true" if dry_run
13 notify_command << " API_KEY=#{ENV['API_KEY']}" if ENV['API_KEY']
14 puts "Notifying Hoptoad of Deploy (#{notify_command})"
15 `#{notify_command}`
16 puts "Hoptoad Notification Complete."
17 end
18 end
19 end
Table of Contents | t |
---|---|
Exposé | ESC |
Full screen slides | e |
Presenter View | p |
Source Files | s |
Slide Numbers | n |
Toggle screen blanking | b |
Show/hide slide context | c |
Notes | 2 |
Help | h |