Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@chendrix
chendrix / Gemfile
Last active April 12, 2023 00:35
Namecheap API
# ... rest of gemfile
gem 'httparty'
gem 'nokogiri'

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 June 21, 2017 22:53
How to use docker-image-resource to build custom docker images used as inputs for later tasks
jobs:
- name: build-and-test
plan:
- task: build-image
privileged: true
config:
platform: linux
image_resource:
type: docker-image
source:
@chendrix
chendrix / post_demo.php
Created May 16, 2011 08:29
Displaying data sent via a node curl call in 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:
@chendrix
chendrix / RandomMatrix.elm
Last active August 29, 2015 14:26
Random Matrix in 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
@chendrix
chendrix / TodoMe.elm
Created May 17, 2015 17:37
Bug somewhere?
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 August 29, 2015 14:14
Multiple constructors
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 September 18, 2014 06:00
"Policy" implementation in haskell
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