Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@chendrix
chendrix / build-and-test.yml
Created Jun 21, 2017
How to use docker-image-resource to build custom docker images used as inputs for later tasks
View build-and-test.yml
jobs:
- name: build-and-test
plan:
- task: build-image
privileged: true
config:
platform: linux
image_resource:
type: docker-image
source:
@chendrix
chendrix / RandomMatrix.elm
Last active Aug 29, 2015
Random Matrix in Elm
View RandomMatrix.elm
import Random exposing (list, int)
import Array exposing (fromList)
import Maybe
type alias Matrix a = Array.Array (Array.Array a)
type alias Location = (Int, Int)
row : Location -> Int
row = fst
col : Location -> Int
col = snd
View TodoMe.elm
module TodoMe where
{-| TodoMVC implemented in Elm, using plain HTML and CSS for rendering.
This application is broken up into four distinct parts:
1. Model - a full definition of the application's state
2. Update - a way to step the application state forward
3. View - a way to visualize our application state with HTML
4. Inputs - the signals necessary to manage events
@chendrix
chendrix / minefield.rb
Last active Aug 29, 2015
Multiple constructors
View minefield.rb
class Minefield
def initialize(map)
@map = map
end
def self.initialize_with_random_mines(size: , mine_count:)
map = Array.new(size) { Array.new(size) { Cell.new } }
mine_count.times do |_|
row = rand(size)
@chendrix
chendrix / prelude.hs
Created Sep 18, 2014
"Policy" implementation in haskell
View prelude.hs
module Policy where
import Data.List
type Reason = String
type Reasons = [Reason]
data Policy = Invalid Reasons | Valid
instance Show Policy where
show Valid = "Valid"
show (Invalid reasons) = "Invalid: " ++ (intercalate ". " reasons) -- intercalate == Ruby's join
@chendrix
chendrix / Gemfile
Last active Aug 29, 2015
Namecheap API
View Gemfile
# ... rest of gemfile
gem 'httparty'
gem 'nokogiri'
@chendrix
chendrix / post_demo.php
Created May 16, 2011
Displaying data sent via a node curl call in PHP
View post_demo.php
$ node test.js
stringified post: your=post&data=goes%20here
curl -d "your=post&data=goes%20here" -s "http://localhost:8888/post_demo.php"
stdout: post goes here
stderr: