Skip to content

Instantly share code, notes, and snippets.

View 256BitChris's full-sized avatar

Chris Shellenbarger 256BitChris

View GitHub Profile
(defn-spec eligible-to-create-subscription? boolean?
"Is the subscription eligible for creating a new one?"
[subscription (s/keys :req [::subscription-status])]
(case (-> ::subscription-status subscription)
(::expired ::canceled ::free-trial ::free-trial-expired) true
false))
(s/exercise-fn `eligible-to-create-subscription?)
=>
([(#:io.cloudrepo.payments{:subscription-status :io.cloudrepo.payments/free-trial-expired}) true]
@256BitChris
256BitChris / fn-calls.clj
Created February 20, 2018 17:32
Function Pipeline
(-> (function-1 data) function-2 function-3)
@256BitChris
256BitChris / glue.java
Last active February 20, 2018 16:15
Java Glue Code Between Functions
class FooResult {
private int a;
private boolean d;
public FooResult(int a, boolean d) { this.a = a + 1 ; this.d = !d; }
public int getA() { return a; }
public boolean getD() { return b; }
}
@256BitChris
256BitChris / fns-taking-maps.clj
Last active February 20, 2018 16:11
Functions taking and returning maps
(defn foo
([a b c] (foo {:a a :b b :c c})) ; If you don't have a map
([{:keys [a b c] :as input)}] ; destructuring syntax
(assoc input :d false)) ; return a map
(defn bar [{:keys [a d] :as input}]
(merge input {:a (inc a) :d d}))
(defn baz [{:keys [a d] :as input}]
(merge input {:a (inc a) :d (not d)}))
@256BitChris
256BitChris / artifact-request.clj
Created February 20, 2018 15:38
Artifact Request Example
(defn artifact-request [{:keys [:token :uri] :as input}]
(let [data (-> (process-token input)
process-uri
retrieve-permissions)]
(if (has-permissions? data)
(retrieve-file data)
(unauthorized))))
@256BitChris
256BitChris / README.md
Created January 9, 2018 18:57 — forked from bsodmike/README.md
OC Nvidia GTX1070s in Ubuntu 16.04LTS for Ethereum mining

Following mining and findings performed on EVGA GeForce GTX 1070 SC GAMING Black Edition Graphics Card cards.

First run nvidia-xconfig --enable-all-gpus then set about editing the xorg.conf file to correctly set the Coolbits option.

# /etc/X11/xorg.conf
Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
@256BitChris
256BitChris / README.md
Created October 31, 2016 23:19 — forked from ismell/README.md
Ubuntu Upstart Script for Team City

Ubuntu Upstart Script for Team City

  1. Install TeamCity.conf and TeamCityAgent.conf in /etc/init/

  2. Create TeamCity in /etc/default/TeamCity

  3. Make sure TEAMCITY_DATA_PATH and TEAMCITY_SERVER_PATH are owned by www-data

  4. Start TeamCity

     sudo service TeamCity start
    
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="[email protected]"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="[email protected]"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
@256BitChris
256BitChris / JavaScriptTestingWithGruntMochaAndChai.md
Last active August 29, 2015 14:27
JavaScript Testing with Grunt, Mocha and Chai

JavaScript Testing with Grunt, Mocha and Chai

In the following post I would like to introduce one way how you can setup your testing workflow for JavaScript development. The central components in the testing environment are Grunt, Mocha and Chai that I will cover from the introduction and installation of each component to the cooperation of all components for the execution of tests.

If you are already an experienced Grunt user and just look for the Gruntfile.js and the Mocha / Chai setup just skip the central components section and skip to the installing components part.

You can find the sample project with all code at GitHub on: https://github.com/maicki/sample-js-testing-grunt-mocha-chai

Central Components

"I think of response time, for example, as part of the passionate about the customer bucket, not the passionate about the product bucket. Slow response times can reduce new customer growth and give existing customers reason to try out a competitive offering."