Skip to content

Instantly share code, notes, and snippets.

View leehambley's full-sized avatar

Lee Hambley leehambley

View GitHub Profile
@leehambley
leehambley / mentionable_trix.js.coffee
Created July 13, 2017 13:51 — forked from lawso017/mentionable_trix.js.coffee
@mentions with trix-editor and selectize.js
window.addEventListener "trix-initialize", (e) =>
Utility.TrixMentions.prepare($(e.target))
@leehambley
leehambley / memory.rb
Last active November 30, 2016 19:04 — forked from kylewelsby/memory.rb
require 'byebug'
require 'active_support/inflector'
module Sequares
module Store
class Memory < Base
class << self
def cache_key_for(klass, id)
inst = klass.with_history(id, [])
"#{inst.uri}|#{histories}"
end
@leehambley
leehambley / foo.rb
Last active November 16, 2016 08:38 — forked from anonymous/foo.rb
class Foo
attr_accessor :age
def initialize(age)
self.age = age if age < 100
end
end
a = Foo.new(10) # b.age defined
b = Foo.new(200) # no b.age defined

Types

A type is a collection of possible values. An integer can have values 0, 1, 2, 3, etc.; a boolean can have values true and false. We can imagine any type we like: for example, a HighFive type that allows the values "hi" or 5, but nothing else. It's not a string and it's not an integer; it's its own, separate type.

Statically typed languages constrain variables' types: the programming language might know, for example, that x is an Integer. In that case, the programmer isn't allowed to say x = true; that would be an invalid program. The compiler will refuse to compile it, so we can't even run it.

@leehambley
leehambley / company-ownership.md
Created July 5, 2016 19:22 — forked from jdmaturen/company-ownership.md
Who pays when startup employees keep their equity?

Who pays when startup employees keep their equity?

JD Maturen, 2016/07/05, San Francisco, CA

As has been much discussed, stock options as used today are not a practical or reliable way of compensating employees of fast growing startups. With an often high strike price, a large tax burden on execution due to AMT, and a 90 day execution window after leaving the company many share options are left unexecuted.

There have been a variety of proposed modifications to how equity is distributed to address these issues for individual employees. However, there hasn't been much discussion of how these modifications will change overall ownership dynamics of startups. In this post we'll dive into the situation as it stands today where there is very near 100% equity loss when employees leave companies pre-exit and then we'll look at what would happen if there were instead a 0% loss rate.

What we'll see is that employees gain nearly 3-fold, while both founders and investors – particularly early investors – get dilute

@leehambley
leehambley / avahi.go
Created November 9, 2015 12:26 — forked from lemenkov/avahi.go
How to register service with Avahi using golang and dbus
package main
import (
"github.com/guelfey/go.dbus"
"log"
"bufio"
"os"
)
func main() {
@leehambley
leehambley / go_scp.go
Last active August 29, 2015 14:23 — forked from jedy/go_scp.go
// https://blogs.oracle.com/janp/entry/how_the_scp_protocol_works
package main
import (
"fmt"
"golang.org/x/crypto/ssh"
)
const privateKey = `content of id_rsa`
@leehambley
leehambley / cheryl.rb
Last active August 29, 2015 14:21 — forked from seanhandley/cheryl.rb
DATES = [
"May 15", "May 16", "May 19",
"June 17", "June 18",
"July 14", "July 16",
"August 14", "August 15", "August 17"
]
def month(date); date.split[0]; end
def day(date); date.split[1]; end
@leehambley
leehambley / Readme.md
Last active August 29, 2015 14:16 — forked from sente/Readme.md

To define the function, paste the following code into your shell:

curlstats ()
{
    ( echo "url_effective\t%{url_effective}\n";
    echo "http_code\t%{http_code}\n";
    echo "content_type\t%{content_type}\n";
    echo "http_connect\t%{http_connect}\n";
 echo "time_total\t%{time_total}\n";

the plumbing commands

  • rev-parse [something]

    • show the SHA of any weird git phrase
  • hash-object -w [file]

    • take any file or stdin and return a blob sha
  • ls-tree (-r) [sha]

  • show the entries of a git tree in the db