Skip to content

Instantly share code, notes, and snippets.

View loganpowell's full-sized avatar

Logan Powell loganpowell

  • Metro DC
View GitHub Profile
@loganpowell
loganpowell / i-o-x-form-helpers.md
Last active September 26, 2018 12:35
Helper Functions for Core.async and Clojure Transducers

Adapters

core.async

link to "the node way"

Basic I/O API function (example)

Create async functions with this - most flexible - API contract/signature. This is good for coordinating numerous asynchronous operations (e.g., networking effects/propogation, streaming events, etc.).

@loganpowell
loganpowell / pseudo.md
Created September 11, 2018 20:05
Pseudo code for geo-json merger GraphQL server + NPM libraries

Keys

< : Publish to NPM

_ : wildcard < < : Publish to NPM and sub-component of wildcard

^ : Sub-component of function above

PseudoCode

@loganpowell
loganpowell / blocking.clj
Last active September 4, 2018 13:36 — forked from martintrojer/blocking.clj
Dealing with errors and other core.async issues
;; ------------------------
(defn- log-time [{:keys [ns name line]} f & args]
(let [start (System/nanoTime)
res (apply f args)
elapsed (quot (- (System/nanoTime) start) 1000)]
(log/debug (format "%s/%s:%s %dus" ns name line elapsed))
res))
(defn enable-timing [var]
@loganpowell
loganpowell / git-commands.md
Last active August 24, 2018 14:57
Git commands

How to discard local commits in Git

git reset --hard origin/master

will remove all commits (and work) not in origin/master where origin is the repo name and master is the name of the branch.

Delete the most recent commit, keeping the work you've done:

git reset --soft HEAD~1

@loganpowell
loganpowell / PowerShell Customization.md
Created August 22, 2018 19:43 — forked from jchandra74/PowerShell Customization.md
PowerShell, Cmder / ConEmu, Posh-Git, Oh-My-Posh, Powerline Customization

Pimping Up Your PowerShell & Cmder with Posh-Git, Oh-My-Posh, & Powerline Fonts

Backstory (TLDR)

I work as a full-stack developer at work. We are a Windows & Azure shop, so we are using Windows as our development platform, hence this customization.

For my console needs, I am using Cmder which is based on ConEmu with PowerShell as my shell of choice.

Yes, yes, I know nowadays you can use the Linux subsystem on Windows 10 which allow you to run Ubuntu on Windows. If you are looking for customization of the Ubuntu bash shell, check out this article by Scott Hanselman.

@loganpowell
loganpowell / censusJSON2Standard.js
Created July 30, 2018 19:57
Convert Census JSON (terse) to Standard JSON (verbose)
let standardJSON =
<async fetch stats returns promise>
.then(data => {
let labels = data[0].map(datum => datum.toUpperCase());
let rows = data.slice(1);
let objArray = rows.map(row => {
return Object.assign(
{},
...labels.map( (key, idx) => ({ [key]: row[idx] }) )
);
@loganpowell
loganpowell / deep-merge.cljs
Created June 21, 2018 12:19
Deep Merge (clj/s)
(defn deep-merge [v & vs]
(letfn [(rec-merge [v1 v2]
(if (and (map? v1) (map? v2))
(merge-with deep-merge v1 v2)
v2))]
(if (some identity vs)
(reduce #(rec-merge %1 %2) v vs)
v)))
@loganpowell
loganpowell / gh-pages-deploy.md
Created June 8, 2018 19:21 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@loganpowell
loganpowell / graphql-args-passing.md
Last active December 25, 2024 23:14
GraphQL Passing Arguments (parent, args, context, info)
var fetch = require("node-fetch");
var WKT = require("terraformer-wkt-parser");
var ramda = require("ramda");
require("dotenv").load();
var testWKT = WKT.convert({
type: "Polygon",
coordinates: [
[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]],
[[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]