Skip to content

Instantly share code, notes, and snippets.

View any_attribute_error_in_the_stack.py
class A(object):
def __getattr__(s,i):
raise Exception('wth')
def raises(self):
"aoeu".nonexistent
@property
def yep(self):
self.raises()
A().yep
View notify_on_long_exec.sh
export NOTIFY_TIME=10
function timer_start {
previous_command=$this_command
if [ "$BASH_COMMAND" != "timer_stop" ]
then
this_command=$BASH_COMMAND
fi
timer=${timer:-$SECONDS}
View compare_branches.bash
function silencing_stderr() {
$* 2>/dev/null
}
function branch_names() {
git br | awk '{print $1}' | grep -v '*' | xargs
}
for branch_name in $(branch_names)
do
View array_blocking_fair.mirah
import java.util.concurrent.ArrayBlockingQueue
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.atomic.AtomicLong
queue_size = 10
queue = ArrayBlockingQueue.new queue_size, true
counts = {"A"=> AtomicLong.new, "B" => AtomicLong.new}
producerA = Thread.new do
while true
@baroquebobcat
baroquebobcat / mirah_0_1_2_notes
Created Jan 6, 2014
Mirah 0.1.2 release process notes
View mirah_0_1_2_notes
mirah 0.1.2 release highlights
- improvements to the new mirrors implementation (try it with -T)
- improvements to the new backend implementation (try it with -N)
- added better casting for methods that return primitives (754cc38f)
- =~, include? macros added to String (Thanks altamic)
- << operator added to StringBuilder
- improved line number recording in new backend
- fixed a few macro expansion related bugs
- Added Apache 2 license to gem metadata
@baroquebobcat
baroquebobcat / mirah_lambda.md
Last active Jan 2, 2016
Mirah Lambda Proposal
View mirah_lambda.md

Mirah Lambda Proposal

Lambda types

  • Stabby / Lambda
  • Block
  • Nested Methods

Stabby / Lambda

View gist:8227106
$ rake gem
rm -rf build/bootstrap
mkdir -p build/bootstrap
Compiling 10 source files to /Users/nick/hacking/mirah_hacking/mirah/build/bootstrap
/Users/nick/hacking/mirah_hacking/mirah/src/org/mirah/IsolatedResourceLoader.java
/Users/nick/hacking/mirah_hacking/mirah/src/org/mirah/MirahClassLoader.java
/Users/nick/hacking/mirah_hacking/mirah/src/org/mirah/jvm/compiler/Cleaned.java
/Users/nick/hacking/mirah_hacking/mirah/src/org/mirah/jvm/types/Flags.java
/Users/nick/hacking/mirah_hacking/mirah/src/org/mirah/jvm/types/MemberAccess.java
/Users/nick/hacking/mirah_hacking/mirah/src/org/mirah/jvm/types/MemberKind.java
@baroquebobcat
baroquebobcat / symbol_curry.rb
Last active Dec 31, 2015
Symbol#curry, because one kind of curry just isn't enough
View symbol_curry.rb
# add a curry method to symbol for evil/awesome symbol to proc powers.
class Symbol
def curry(n=nil)
->(*args) {
->(obj) {obj.send self, *args}
}.curry(n)
end
def call(*n)
curry.(*n)
View prompt.bash
function java_change_16 {
export MY_JAVA_VERSION=1.6
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
}
function java_change_17_15 {
export MY_JAVA_VERSION=1.7_15
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_15.jdk/Contents/Home/
}
You can’t perform that action at this time.