Skip to content

Instantly share code, notes, and snippets.

@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;
/**
@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 / 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 / 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 / Main.purs
Last active September 14, 2017 22:33
SQL query row types
module Main where
import Prelude
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Console (logShow, CONSOLE)
import Data.Foldable (class Foldable, foldl, intercalate)
import Data.Maybe (Maybe(..), maybe)
import Data.Monoid (class Monoid, mempty)
import Data.StrMap (StrMap, lookup)
@chexxor
chexxor / WithPipeline.purs
Created April 20, 2018 18:19
WithPipeline
newtype WithPipeline a = WithPipeline (NEL.NonEmptyList (a -> a)) a
-- or --
newtype WithPipeline a = WithPipeline (a -> a)) a
instance profunctorWithPipeline :: Profunctor (WithPipeline a) where
dimap :: forall a b c d. (a -> b) -> (c -> d) -> p b c -> p a d
dimap a2b c2d (WithPipeline f a) = WithPipeline (a2b >>> f >>> c2d) a
instance contraWithPipeline :: Contravariant (WithPipeline a) where
cmap :: forall a b. (b -> a) -> f a -> f b
@chexxor
chexxor / Main.purs
Created April 25, 2018 21:34
HomoHKTRow.purs
module Main where
import Prelude
import Control.Monad.Eff.Console (log)
import TryPureScript (render, withConsole)
import Type.Row
class HomoHKTRow (rs :: RowList) (f :: Type -> Type)
module Main where
import Prelude
import Control.Monad.Eff.Console (log, logShow)
import TryPureScript (render, withConsole)
import Control.Lazy (fix)
-- From https://github.com/awkure/purescript-birds/blob/v1.0.4/src/Aviary/Birds.purs#L38-L38
fixB :: forall a. (a -> a) -> a
@chexxor
chexxor / Feature_Architecture.md
Last active July 11, 2018 23:55
WIP: Thoughts on concerns and design of a software system's features (subsystem).

Following is how I would like to define feature development. I hope that by exploring the nature of feature development and its concerns, we can better choose productive constraints to impose on it and better design features such that they can be easily evolved and minimize disruptions to other features.

Feature Architecture

The following are attributes I would like features to have:

A feature in a data management system should be a simple workflow which provides value to a client. A feature's interface should never break active clients, if it has them. A feature can be deployed alongside other features in the same executable, but should be able to be trivially moved out and into a separate executable.

@chexxor
chexxor / meetup.hs
Created April 18, 2019 14:16
Haskell Exercism at Haskell Meetup
module Meetup (Weekday(..), Schedule(..), meetupDay) where
import Data.Time.Calendar --(Day, dayOfWeek, fromGregorian, gregorianMonthLength)
--import qualified Data.Time.Calendar as Cal
import Data.List
data Weekday = Monday
| Tuesday
| Wednesday