Skip to content

Instantly share code, notes, and snippets.

View sleepynate's full-sized avatar

Nathan Dotz sleepynate

View GitHub Profile

Keybase proof

I hereby claim:

  • I am sleepynate on github.
  • I am sleepynate (https://keybase.io/sleepynate) on keybase.
  • I have a public key ASBr71i5eTmJ3MGg4lWqR90_nfdkKEu5ersykbrT5scMWgo

To claim this, I am signing this object:

@sleepynate
sleepynate / AnimalDemo.java
Created February 9, 2018 23:11 — forked from rtoal/AnimalDemo.java
An example of inheritance and polymorphism in Java
abstract class Animal {
private String name;
public Animal(String name) {
this.name = name;
}
public String speak() {
return name + " says " + sound();
}
public abstract String sound();
}
@sleepynate
sleepynate / Main.scala
Created February 18, 2016 14:03 — forked from anonymous/Main.scala
Scala.js Bouncing Taco
import Math._
object ScalaJSExample extends js.JSApp{
class HTMLImageElement extends dom.raw.HTMLImageElement {
var onload: js.Function1[dom.Event, _] = ???
}
def newUnit() = 2 * Math.random
def newMutPlus() = {
module PrimeFactors (primeFactors) where
primeFactors :: Integer -> [Integer]
primeFactors 1 = []
primeFactors x = primeFactors' x 2
where primeFactors' x n
| x < n = []
| x `mod` n == 0 && x > n = [n] ++ primeFactors' (x `div` n, n + 1)
| otherwise = [x]
-----BEGIN PGP PUBLIC KEY BLOCK-----
Comment: GPGTools - https://gpgtools.org
mQINBFVshvUBEADE3XJLjYAQhAXRhUd3/ghzBqWEQ+gvGWLlQP14A7W6gcvu8h/n
abeyswyl1fSSYZt73H6CvdO0EcMcD2m4V1FpxAgkrQoAc+XfZetLprxNqfiqfOE+
STTK0XueKlr1o/g5yBzQm2qnkaRA4Tk4yjps+xP4qy/F30/eR5/CnFyCRcf1Uc0/
RQucePtLxuOr5UGju64mdqHcukOu6m7aNJ7m5w9lHJrR2JHYLcXp0KxHx2KpOBrX
yHzEK8TtJ14XfBf9F+AbigaIMc+NJ5trKtbudHsA6FlUSDAvrrbNAlSFQmKnanNh
rjNJCo0E+00xKGWdZNSzGomDxB0MRvwep8RzXgqK2wLxIEY5XKWo+YGcfl2W6tAs
SVuJHPizUop8xqt+iAFfWmbKM57DXps/CTozB04jSVmKCHe1wfUbEtdv6wswRTEB
# == WHAT
# Simple script for irssi to trigger Mac OS X 10.8's Notification Center
#
# == WHO
# Patrick Kontschak 2012
#
# Forked from Nate Murray's irssi-growl: https://github.com/jashmenn/irssi-growl
#
# == CONFIG
# /SET notifier_on_regex [regex]
[error] app/models/Job.scala:22: ambiguous implicit values:
[error] both object IntReads in trait DefaultReads of type play.api.libs.json.Reads.IntReads.type
[error] and object LongReads in trait DefaultReads of type play.api.libs.json.Reads.LongReads.type
[error] match expected type play.api.libs.json.Reads[T]
[error] case Some(bs) => bs.map(Json.fromJson(_))
@sleepynate
sleepynate / androids_under_the_stairs.md
Last active November 8, 2016 12:08
Androids Under the Stairs: Mobile Scala

Blurb

Scala is a sometimes-intimidating programming language that is Object-Oriented, functional, statically typed and wicked badass. It comes batteries-included, featuring a rich collections API, Type inference, and dead-simple concurrency. Perhaps most poignantly though, it's also a 30MB JVM library that can compile to dalvik.

Come take a heads first dive into crafting an APK with glorious, nutritionally

@sleepynate
sleepynate / rps.hs
Last active December 14, 2015 19:58
import Control.Monad
data Gesture = Rock | Paper | Scissors deriving (Eq, Show, Read)
instance Ord Gesture where
a `compare` b
| a == b = EQ
Rock `compare` Scissors = GT
Paper `compare` Rock = GT
Scissors `compare` Paper = GT

Map git branches to each of your web service instances

When I have multiple server instances deployed from the same repo, I prefer to keep track of them with local branches, especially when using multiple clouds services like heroku and openshift. This makes it really easy to merge features branches into a particular instance's deploy without ever bringing it into master, but still allow the inclusion of those commits into other instances after it folds into master.

The usual feature-branching

So, I have master, which stays as the primary place to put new commits. I then split features branches off of master and then merged in when they are accepted.

% git checkout -b wicked-sweet-login-page
% vim static/teh_loginz.html