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 / curry.clj
Created April 7, 2018 23:28 — forked from sunilnandihalli/curry.clj
a macro to create fixed-arity curryable function in clojure
(defmacro def-curry-fn [name args & body]
{:pre [(not-any? #{'&} args)]}
(if (empty? args)
`(defn ~name ~args ~@body)
(let [rec-funcs (reduce (fn [l v]
`(letfn [(helper#
([] helper#)
([x#] (let [~v x#] ~l))
([x# & rest#] (let [~v x#]
(apply (helper# x#) rest#))))]
@loganpowell
loganpowell / BankItem-v1.js
Last active October 16, 2018 19:03 — forked from puppybits/BankItem-v0.js
ClojureScript & React sample code
/* next add the state to ask security questions */
render: function(){
// Now add the security challenge state
var item = null;
switch(this.state.bankState){
case "CONNECTED":
break;
case "SECURITY":
// create a new element to show questions and get answers
// good example: https://github.com/loganpowell/Flickr-Wormhole
// blog for that: https://serverless.com/blog/3rd-party-rest-api-to-graphql-serverless/
// NEXT: notes on using context: https://github.com/graphql/graphql-js/issues/953
// follow up:
// access the request object in context arg: https://medium.com/stackfame/how-to-access-the-request-object-inside-a-graphql-resolver-function-apollo-server-express-8402c1bbb097
// notes on using context: https://github.com/graphql/graphql-js/issues/953
// https://stackfame.com/graphql-req-object
// https://www.apollographql.com/docs/apollo-server/setup.html#options-function
const R = require('ramda')
const fetch = require('node-fetch')
const fetchJson = (f) => f.then(res => res.json())
const prepareGithubRequest = R.curry((accessToken, path) => fetchJson(fetch(`https://api.github.com/${path}?access_token=${accessToken}`)))
const fetchFromGithub = prepareGithubRequest(ACCESS_TOKEN)
const getReposFromOrg = org => fetchFromGithub(`orgs/${org}/repos`)
const getPopularRepos = R.compose(R.reverse, R.sortBy(R.prop('stargazers_count')), R.project(['name', 'stargazers_count', 'language']))
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]]
@loganpowell
loganpowell / graphql-args-passing.md
Last active December 25, 2024 23:14
GraphQL Passing Arguments (parent, args, context, info)
@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 / 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 / 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 / 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.