Skip to content

Instantly share code, notes, and snippets.

/**
* Johannes Zweng <john@zweng.at>, 2017
*
* This simple script just loads the 2 bancor contracts (Crowdsale and BNT Token)
* into the geth client and then provides a single status function which you
* can call on the geth console to query the current status of the crowdsale.
*
* Usage:
* ------
* 1) Start geth instance
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>homebrew.mxcl.mysql</string>
<key>ProgramArguments</key>
<array>
class Window
SCALE = 100
class Collapsed < ArgumentError; end
attr_reader :low, :mid, :high, :max
def set(window)
# p "setting window to #{window}"
@low, @mid, @high = window
class NumberNotFoundError < ArgumentError; end
def render(points, length)
puts "_" * length
display = " " * length
markers = %w[\\ | /]
points.each_with_index do |p, idx|
display[p] = markers[idx]
end
puts "%#{length + 5}s %3s : %3s : %3s" % [display, *points]
@rbishop
rbishop / carl_hewitt_actor_model.md
Last active April 3, 2024 06:58
Notes from Carl Hewitt on the Actor Model

Carl Hewitt on Actors

Actor - Fundamental unit of computation, a computation model - not just a form of concurrency

An Actor has three essential elements:

  • 1 - Processing - you have to get something done
  • 2 - Storage - you have to be able to remember things
  • 3 - Communication

Virtual DOM and diffing algorithm

There was a [great article][1] about how react implements it's virtual DOM. There are some really interesting ideas in there but they are deeply buried in the implementation of the React framework.

However, it's possible to implement just the virtual DOM and diff algorithm on it's own as a set of independent modules.

@Beengie
Beengie / show_env
Last active December 28, 2015 08:29
Environment data
# Sinatra environment
# Make sure that the link to the "bootstrap.min.js" file is correct in your layout.erb (shown below):
<script src="/vendor/bootstrap/js/bootstrap.min.js"></script>
# Put this in your .erb
<%= show_env %>
# Place constant inside of your main.rb
SHOW_ENVIRONMENT = true
@bbugh
bbugh / gist:3909614
Created October 18, 2012 02:52
Ruby 1.9 passing arguments to define_method blocks
@mildmojo
mildmojo / left_join_arel_example.rb
Last active April 5, 2024 16:00
LEFT JOIN in ARel for ActiveRecord in Ruby on Rails
# Here's a contrived example of a LEFT JOIN using ARel. This is an example of
# the mechanics, not a real-world use case.
# NOTE: In the gist comments, @ozydingo linked their general-purpose ActiveRecord
# extension that works for any named association. That's what I really wanted!
# Go use that! Go: https://gist.github.com/ozydingo/70de96ad57ab69003446
# == DEFINITIONS
# - A Taxi is a car for hire. A taxi has_many :passengers.
# - A Passenger records one person riding in one taxi one time. It belongs_to :taxi.
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active October 26, 2025 17:44
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname