Skip to content

Instantly share code, notes, and snippets.

View jessitron's full-sized avatar
🚀
"I'm in"

Jessica Kerr jessitron

🚀
"I'm in"
View GitHub Profile
@jessitron
jessitron / haskellyte.md
Created August 1, 2014 16:12
Gershom's Letter to a Young Haskell Enthusiast, condensed. I removed a lot of words, kept the themes, moved a few around a bit.

Letter to a Young Haskell Enthusiast, by Gershom Bazerman.

Condensed from: http://comonad.com/reader/2014/letter-to-a-young-haskell-enthusiast/

The following letter is about tendencies that come with the flush of excitement of learning any new thing. It is written specifically, because if we don't talk specifics, the generalities make no sense. It is a letter full of things I want to remember.

You’ve entered the world of strongly typed functional programming, and it is great. You want to share the great things you’ve learned, and you want to slay all the false statements in the world.

@jessitron
jessitron / gist:8777503
Created February 3, 2014 01:09
The magic of blocking { ... } in Scala's global ExecutionContext: it leads to the creation of more threads, so the CPUs don't get bored
val des = scala.concurrent.ExecutionContext.global
import scala.concurrent._
import duration._
def ct = Thread.currentThread.getName
val n = Runtime.getRuntime.availableProcessors
def hogThread(sec:Int) = future {
@jessitron
jessitron / stayingDead.scala
Created March 19, 2014 15:23
Akka testing: it's a good idea to tell your actor system to leave a dead top-level actor dead. See: http://blog.jessitron.com/2014/03/testing-in-akka-sneaky-automatic.html
// In real life, it's great that stuff gets restarted when it fails.
// In testing, we'd rather know that it failed.
import akka.actor._
class DyingActor extends Actor {
def receive = { case "die" => throw new Exception("poo") }
}
// Default config, everything restarts automatically
val system = ActorSystem("ordinary")
@jessitron
jessitron / gist:e1a3fc188b63b5baf0817114731ea8cf
Created March 7, 2018 13:35
Atomist command to find out who is reviewing
import { commandHandlerFrom } from "@atomist/automation-client/onCommand";
import { HandleCommand } from "@atomist/automation-client";
import { Parameters } from "@atomist/automation-client/decorators";
import * as _ from "lodash"
@Parameters()
export class WhoIsBusyParameters {
}
function readConfig(): Promise<DeletionCriteria> {
return promisify(fs.readFile)("config/deletionCriteria.json", { encoding: "utf8" })
.then(configFileContent =>
JSON.parse(configFileContent));
}
@jessitron
jessitron / Condensed Letter to a Haskellyte
Last active January 31, 2017 06:24
Gershom's Letter to a Young Haskell Enthusiast, summarized. I removed a lot of words, kept the themes, moved a few around a bit.
# Letter to a Young Haskell Enthusiast, by Gershom Bazerman.
Condensed from: http://comonad.com/reader/2014/letter-to-a-young-haskell-enthusiast/
The following letter is about tendencies that come with the flush of excitement of learning any new thing.
It is written specifically, because if we don't talk specifics, the generalities make no sense.
It is a letter full of things I want to remember.
You’ve entered the world of strongly typed functional programming, and it is great.
You want to share the great things you’ve learned, and you want to slay all the false statements in the world.
@jessitron
jessitron / Properties.elm
Created April 17, 2016 00:04
An Elm program using elm-check that is compatible with elm-test (the Node module)
module Main (..) where
import ElmTest
import Check exposing (Evidence, Claim, that, is, for)
import Check.Test
import Check.Producer as Producer
import List
import Signal exposing (Signal)
import Console exposing (IO)
import Task

Writing jQuery Plugins for Fun and (non)Profit

We all love jQuery - it's easy, efficient, and there's tons of information online. But with that mass of information comes confusion: When you want to abstract some of your code into a plugin, how do you structure it? How do you take in options, and how can you be sure you haven't broken the way jQuery works? And when you're done, where do you put it and how do distribute it to the masses?

This talk will run through some of the basics and guide you in the right direction. In particular, we'll cover:

  • structuring your plugin code
  • making your code testable - and testing it!
  • tracking your code on github
  • getting your plugin on the jQuery site
@jessitron
jessitron / ExplicitErrorReturning
Created June 15, 2013 17:58
This is in response to a giant twitter thread. Thanks to @CraigBuchek, @brianbuttonxp, @adkron, @heathborders, and @marioaquino for the discussion. Post is at blog.jessitron.com, titled "What's dirtier than comments? Exceptions!"
case class Error(message:String)
case class AuthLevel(value: Int)
object AuthLevel {
val GUEST = AuthLevel(0)
}
class SettingGetter {
def get_setting(settingName: String): Either[Error, String] = Right("Fred")
@jessitron
jessitron / gem_cleaner.rb
Last active December 17, 2015 05:09 — forked from kgrz/gem_cleaner.rb
require 'bundler'
# Required for Bundler::LockfileParser. This can be empty though.
`touch Gemfile` unless File.exists?("Gemfile")
# Add the paths to the Gemfile.lock files, the gems in which
# need to be protected