Skip to content

Instantly share code, notes, and snippets.

View bhenderson's full-sized avatar

Brian Henderson bhenderson

View GitHub Profile
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
something: Ember.computed(function() {
return 'Something';
}),
list: [
@bhenderson
bhenderson / patch0
Created September 16, 2014 05:08
zentest issue #44
diff --git a/.autotest b/.autotest
index be4dedd..5ce4720 100644
--- a/.autotest
+++ b/.autotest
@@ -21,6 +21,17 @@ Autotest.add_hook :initialize do |at|
# end
end
+Autotest.add_hook :initialize do |at|
+ raise ENV['ERR']
diff --git a/lib/autotest.rb b/lib/autotest.rb
index 479b3e9..2695a35 100755
--- a/lib/autotest.rb
+++ b/lib/autotest.rb
@@ -264,7 +264,11 @@ def run
hook :quit
puts
rescue Exception => err
- hook(:died, err) or raise err
+ hook(:died, err) or (
@bhenderson
bhenderson / gist:676d423c1488d0fea4a9
Created March 12, 2015 21:04
minitest-autotest pr
diff --git a/lib/autotest.rb b/lib/autotest.rb
index 7be003d..281d824 100755
--- a/lib/autotest.rb
+++ b/lib/autotest.rb
@@ -293,6 +293,8 @@ def run_tests
system cmd
hook :ran_command
+
+ hook all_good ? :green : :red
@bhenderson
bhenderson / gist:45b786e5a55506e2f6f7
Created July 20, 2015 18:54
minitest/minitest#467 - store pid that registered at_exit hook
diff --git a/lib/minitest.rb b/lib/minitest.rb
index 2d4344e..5c50120 100644
--- a/lib/minitest.rb
+++ b/lib/minitest.rb
@@ -43,12 +43,14 @@ module Minitest
# Registers Minitest to run at process exit
def self.autorun
+ registered_pid = $$
at_exit {
# this is a partial of a script that does my setup-routing. I needed to modify it to accept parameters.
# performs round-robin like link assignment
# args processing
function echo_usage {
echo "Usage: `basename $0` [link]* (defaults to last run params if exists, or ppp101 ppp102)"
}
if [ "$1" == "-h" ]
echo_usage
#!/usr/bin/env ruby
#helpful page:
# http://www.ruby-doc.org/docs/ruby-doc-bundle/Manual/man-1.4/IO.html
#
# This program tests the ability of ruby to know what stdout is.
# Its useful in the case below when I don't want a newline at the end if I am
# piping to something
def print_things
class YMech < WWW::Mechanize
private_class_method :new
def YMech.create
#do some stuff, define a global variable
#
# so my question is, how do I pass a block that I can also then pass to `new`?
# example of how you normally pass a block to new
#a = WWW::Mechanize.new { |agent|
# agent.follow_meta_refresh = true
~/.profile
...
##########
# http://linuxtidbits.wordpress.com/2009/03/23/less-colors-for-man-pages/
# Less Colors for Man Pages
export LESS_TERMCAP_mb=$'\E[01;31m' # begin blinking
#export LESS_TERMCAP_md=$'\E[01;38;5;74m' # begin bold
#bold colors don't work well in OSX Terminal. These changes add red keywords, with blue 'option' words (not sure precise term)
export LESS_TERMCAP_md=$'\E[00;31;2;74m' # begin bold
export LESS_TERMCAP_me=$'\E[0m' # end mode
class Myclass
#do some stuff
end
exit # I want to load this file into irb, but not actually run the below code. but exit quits irb
foo = Myclass.new
foo.poop