Skip to content

Instantly share code, notes, and snippets.

@chexxor
chexxor / Main.purs
Last active February 17, 2016 01:25
Basic Example of Rock-Paper-Scissors in PureScript
module Main where
import Prelude
import Control.Monad.Eff.Console (log)
-- Define the types of data used by the game.
-- `Rock`, a data type, is better than `"Rock"`, a String,
-- because the compiler can help us. The number of possible
-- values of a String is huuuuuge, but the number of possible
-- values of a RpsChoice is only three. Well-defined choices
@chexxor
chexxor / DishwasherAlgo.java
Created March 18, 2013 18:00
An algorithm for our company's dishwasher. Because people need instructions.
public class Dishwasher {
public enum StatusCode { READY_TO_WASH, WASHING, READY_TO_EMPTY }
public enum Reason { OK, FULL, MUST_REMOVE_DISHES, MUST_EXECUTE_WASH_CYCLE }
public Integer capacity {get; set;} // 0 - 100
public StatusCode status {get; set;}
public hasSoap {get; set;}
public Dishwasher() {
@chexxor
chexxor / DF12SessionOpenSeats.js
Created August 30, 2012 02:24
Show Open Seats for DF12 Sessions Scriptlet
/*
Curious about how many people are attending your session?
Use this JS scriptlet to find out how many people will be attending your session!
Open the DF12 Agenda Builder web app. Open the developer tools for your browser,
copy this entire gist into the JS command line, and run it.
A list of all sessions for which you are registered will be shown with
@chexxor
chexxor / ServiceRequestTrigger.java
Created June 4, 2012 00:08
pcon Trigger Template - automated VSC insertion
public class ServiceRequestTrigger {
private final Map<Id, Service_Request__c> oldMap;
private final Map<Id, Service_Request__c> newMap;
private final List<Service_Request__c> newObjs;
private final Boolean isInsert;
private final Boolean isUpdate;
private final Boolean isDelete;
private final Boolean isBulk;
/**