Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:

Patrick Hildreth colonelrascals

:shipit:
View GitHub Profile
View identicon.ex
defmodule Identicon do
@moduledoc """
Documentation for Identicon.
"""
@doc """
Hello world.
## Examples
View itallfeelswrong.clj
(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
View bleh.clj
(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))))
View ugh.clj
(defn- click-vol-down
[evt]
(let [new-vol (- evt 1)]
(swap! *app-state assoc :volume new-vol)))
View gist:ac2c9fe55320c10d641485a1f728af7c
# 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 Jun 28, 2018
JavaScripts map function deconstructed
View jsMap.js
//--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 Jun 28, 2018
Data Class example python 3.7 release
View deck-of-cards.py
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)
View hobbit.clj
(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}