Skip to content

Instantly share code, notes, and snippets.

@svoynow
svoynow / Brownbag notes
Created September 20, 2016 16:50
Brownbag notes
- `git checkout explicit-types`
- show more type errors possible w/ annotations
- `git checkout hello-world`
- show undefined error, type error (in editor, in browser)
- `elm-repl`
- Built-in Types
- `git checkout explicit-types`
- show more type errors possible w/ annotations
@svoynow
svoynow / post.rb
Created August 23, 2013 21:40
changes to post.rb
def sorted_feedback
@sorted_feedback
end
def sort_feedback(opts)
range = opts[:range] || (0..-1)
@sorted_feedback = (opts[:sort] == :best ? highest_rated_feedback : feedback).slice(range)
end
@svoynow
svoynow / precompile_workaround
Created January 9, 2012 20:58
assets:precompile workaround
def jruby_rake_task(task)
maven_home = ENV['MAVEN_HOME'] || ENV['M2_HOME'] || "~/.m2"
maven_repo = File.join(File.expand_path(maven_home), "repository")
env = ENV['RAILS_ENV'] || 'production'
groups = ENV['RAILS_GROUPS'] || 'assets'
jruby_jar = File.join(maven_repo, "org/jruby/jruby-complete/1.6.5/jruby-complete-1.6.5.jar")
tools = File.join(maven_repo, "de/saumya/mojo/ruby-tools/0.28.6/ruby-tools-0.28.6.jar")
cmd = "java -Xbootclasspath/a:#{jruby_jar} org.jruby.Main -e \"load('jar:file:#{tools}\!/META-INF/jruby.home/bin/rake')\""
args = [cmd, task,"RAILS_ENV=#{env}","RAILS_GROUPS=#{groups}"]
args << "--trace" if Rake.application.options.trace
task :foo do
puts "============ The value of $0 is now: #{$0} ================="
end
mvn rails3:rake -Dtask=foo -Drake.args="-f src/rails/Rakefile"
[INFO] --- rails3-maven-plugin:0.28.6:rake (default-cli) @ devconsole ---
[INFO] ============ The value of $0 is now: -e =================
[INFO] ---------------------------------------------------------------
@svoynow
svoynow / rails3_maven_assets_precompile_production
Created January 5, 2012 21:39
rails3 maven plugin assets:precompile w/ production
wm720l44010a:devconsole svoynow$ mvn rails3:rake -Dtask=assets:precompile:all -Drake.args="-f src/rails/Rakefile" -X
Apache Maven 3.0.3 (r1075438; 2011-02-28 09:31:09-0800)
Maven home: /usr/share/maven
Java version: 1.6.0_29, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x", version: "10.6.8", arch: "x86_64", family: "mac"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from /usr/share/maven/conf/settings.xml
[DEBUG] Reading user settings from /Users/svoynow/.m2/settings.xml
@svoynow
svoynow / rails3_maven_assets_precompile
Created January 5, 2012 17:47
rails3 maven plugin assets:precompile
wm720l44010a:devconsole svoynow$ mvn rails3:rake -Dtask=assets:precompile -Drake.args="-f src/rails/Rakefile -T" -X
Apache Maven 3.0.3 (r1075438; 2011-02-28 09:31:09-0800)
Maven home: /usr/share/maven
Java version: 1.6.0_29, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x", version: "10.6.8", arch: "x86_64", family: "mac"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from /usr/share/maven/conf/settings.xml
[DEBUG] Reading user settings from /Users/svoynow/.m2/settings.xml