This file contains hidden or 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 FiberedChain | |
| def initialize(&blk) | |
| @chain = EMChain.new | |
| f = Fiber.current | |
| @chain.on_complete do | |
| @completed = true | |
| f.resume if @yielded | |
| end | |
| blk.call self if blk | |
| end |
This file contains hidden or 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
| # encoding: utf-8 | |
| module BeepsScope | |
| class Beep | |
| class UndefinedSignal < StandardError; end | |
| attr_accessor :name, :connections | |
| def initialize(scope, name) | |
| @name = name | |
| @connections = {} | |
| @scope = scope |
This file contains hidden or 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 'minitest/spec' | |
| require 'minitest/autorun' | |
| module Helpers | |
| module Let | |
| def let(name, &blk) | |
| define_method name do | |
| @let_assigments ||= {} | |
| @let_assigments[name] ||= send(:"original_#{name}") |
This file contains hidden or 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
| # A sample Gemfile | |
| source "http://rubygems.org" | |
| gem "em-synchrony", git: "https://github.com/igrigorik/em-synchrony.git" | |
| gem "mysql2", ["= 0.3.11"] | |
| gem "activerecord" |
This file contains hidden or 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
| (deftest match-t | |
| (let [v {:foo 1 :bar 100}] | |
| (is (match? v {:foo 1 :bar (_ :guard integer?)})))) | |
| (import | |
| '[java.util Date]) | |
| (defn timestamp | |
| [] | |
| (-> (Date.) |
This file contains hidden or 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
| import subprocess, urllib, json, sys | |
| from subprocess import Popen, PIPE, STDOUT | |
| def pbcopy(txt): | |
| p = Popen(['pbcopy'], stdout=PIPE, stdin=PIPE, stderr=STDOUT) | |
| p.communicate(txt)[0] | |
| my_env = {} | |
| my_env['LANG'] = 'en_US.UTF-8' | |
| username = "*****" |
This file contains hidden or 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
| type state = Init | Started | Stopped | |
| type init_event = InitStart | InitStop | |
| type started_event = StartedStop | |
| type stopped_event = StoppedStart | |
| let init_event () = |
This file contains hidden or 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
| enum State { | |
| Init, Started, Stopped | |
| } | |
| enum InitEvent { | |
| Start, Stop | |
| } | |
| enum StartedEvent { | |
| Stop |
This file contains hidden or 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
| (ns navimize.style | |
| (:require [garden.core :as garden] | |
| [garden.arithmetic :refer [+ - * /]] | |
| [garden.units :as u :refer [px pt]] | |
| [garden.selectors :as s] | |
| [garden.stylesheet :refer [at-media]]) | |
| (:refer-clojure :exclude [+ - * /])) | |
| (def leftest-width (px 50)) |
This file contains hidden or 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
| (ns navimize.style | |
| (:require [garden.core :as garden] | |
| [garden.arithmetic :refer [+ - * /]] | |
| [garden.units :as u :refer [px pt]] | |
| [garden.selectors :as s] | |
| [garden.color :as color] | |
| [garden.stylesheet :refer [at-media]]) | |
| (:refer-clojure :exclude [+ - * /])) | |
| (def leftest-width (px 50)) |