This file contains 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
struct SingleFiberAccess(T) | |
@object : T | |
{% if flag? :debug %} | |
@fiber = Fiber.current | |
{% end %} | |
def initialize(@object) | |
end | |
macro method_missing(call) |
This file contains 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 theme = { | |
color: [ | |
'#292c36', | |
'#dc3c3c', | |
'#95c76f', | |
'#d28e5d', | |
'#8485ce', | |
'#b73999', | |
'#00aba5', | |
'#a9acb6', |
This file contains 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
module MultiIndexable | |
macro index(type, *args, set_args = [] of Nil) | |
@%lock = Mutex.new | |
{% for arg in args %} | |
@values_by_{{ arg.var }} = Hash({{ arg.type }}, {{ type }}).new | |
def [](*, {{ arg.var }} key : {{ arg.type }}) : {{ type }} | |
@values_by_{{ arg.var }}[key] | |
end | |
def []?(*, {{ arg.var }} key : {{ arg.type }}) : {{ type }}? | |
@values_by_{{ arg.var }}[key]? |
This file contains 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 "http/server" | |
module MaybHTTP | |
VERSION = "0.1.0" | |
class ConcattedIO < IO | |
def initialize(@first : IO::Memory, @second : IO) | |
end | |
def read(bytes) | |
if @first.closed? | |
size = @second.read(bytes) | |
else |
This file contains 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
class Spindle [12/193] | |
@fiber_count = 0 | |
@chan = Channel(Nil).new | |
@subspindles : Array(Spindle)? = nil | |
@on_error : Proc(Exception, Nil)? = nil | |
def initialize | |
end | |
def self.new(existing : Spindle?) |
This file contains 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
#!/bin/bash | |
__then() { | |
fg | |
echo "> $*" | |
"$@" | |
} | |
alias 'then:'=__then |
This file contains 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
### Keybase proof | |
I hereby claim: | |
* I am willhbr on github. | |
* I am willhbr (https://keybase.io/willhbr) on keybase. | |
* I have a public key ASBPxIfCrNsJrL_PZpocUrsB3CWHeAeWZV7Bm_dHMutf8wo | |
To claim this, I am signing this object: |
This file contains 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
#!/usr/bin/env ruby | |
DETAILED_MODE = !ARGV[2].nil? | |
begin | |
require 'yomu' | |
rescue LoadError | |
msg = '(Looks like this is you)' | |
lab = `hostname`.strip.start_with? 'cs' | |
puts <<-EOF | |
You need the 'yomu' gem to use this script. |
This file contains 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
/** | |
* Based on Ben Trengrove's example: https://gist.github.com/bentrengrove/9759a3fbb564d62e1e63f417c58a3895 | |
*/ | |
package units | |
import java.util.concurrent.TimeUnit | |
abstract class Unit(val suffix: String, val ratio: Double) { | |
internal fun convertToBaseUnit(amount: Double) = amount * ratio | |
internal fun convertFromBaseUnit(amount: Double) = amount / ratio |
This file contains 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
defmodule RegexCond do | |
defmacro match(matchable, do: matches) do | |
IO.inspect matches | |
de_sigged = matches |> Enum.map(fn | |
{:"->", context, [[lhs], code]} -> | |
lhs = de_sig matchable, lhs | |
{:"->", context, [[lhs], code]} | |
end) | |
quote do |
NewerOlder