Skip to content

Instantly share code, notes, and snippets.

View colonelrascals's full-sized avatar
:shipit:

Patrick Hildreth colonelrascals

:shipit:
View GitHub Profile
defmodule Identicon do
@moduledoc """
Documentation for Identicon.
"""
@doc """
Hello world.
## Examples
(defn- pos-volume
[num]
(if (pos? num) num 0))
(defn- click-volume-down-btn
"Turn it down you kids!"
[js-evt]
(let [new-volume (- js-evt 1)]
(swap! *app-state assoc :volume (pos-volume new-volume))))
;; TODO: write me
(defn- pos-volume
[num]
(if (pos? num) num 0))
(defn- click-volume-down-btn
"Turn it down you kids!"
[js-evt]
(let [new-volume (- js-evt 1)]
(swap! *app-state assoc :volume (pos-volume new-volume))))
(defn- click-vol-down
[evt]
(let [new-vol (- evt 1)]
(swap! *app-state assoc :volume new-vol)))
# Table of Contents
- [Table of Contents](#table-of-contents)
- [Louise](#louise)
- [All contracts over 150k](#all-contracts-over-150k)
- [10 Longest running contracts](#10-longest-running-contracts)
- [Quarterly](#quarterly)
- [Funded Contracts](#funded-contracts)
- [How long was contract in each stage](#how-long-was-contract-in-each-stage)
@colonelrascals
colonelrascals / jsMap.js
Created June 28, 2018 16:43
JavaScripts map function deconstructed
//--Write your own map() function
//
//--Input: array, callback funtion
//
//--Output: new array where every element is transformed by the callback function
const map = (array, callback) => {
let newArr = [];
for (var i = 0; i < array.length; i++) {
newArr[i] = callback(array[i], i)
@colonelrascals
colonelrascals / deck-of-cards.py
Created June 28, 2018 14:43
Data Class example python 3.7 release
from dataclass import dataclass, field
from typing import List
RANKS = '2 3 4 5 6 7 8 9 10 J Q K A'.split()
SUITS = '♣ ♢ ♡ ♠'.split()
def make_french_deck():
return [PlayingCard(r,s) for s in SUITS for r in RANKS]
@dataclass(order=True)
(ns hobbit)
(defn asym-hobbit-body-parts [{:name "head" :size 3}
{:name "left-eye" :size 1}
{:name "left-ear" :size 1}
{:name "mouth" :size 1}
{:name "nose" :size 1}
{:name "neck" :size 2}
{:name "left-shoulder" :size 3}
{:name "left-upper-arm" :size 3}