Skip to content

Instantly share code, notes, and snippets.

View DanielFGray's full-sized avatar

Daniel Gray DanielFGray

View GitHub Profile
@DanielFGray
DanielFGray / gist.js
Last active September 1, 2017 02:35
request all a user's gists
const { curry } = require('ramda')
const { Observable } = require('rxjs/Observable')
require('rxjs/add/observable/interval')
require('rxjs/add/operator/concatMap')
require('rxjs/add/operator/takeWhile')
require('rxjs/add/operator/reduce')
const request$ = curry((base, header, method, endpoint, query = {}) =>
Observable.defer(() => request(method, `${base}${endpoint}`).set(header).query(query))
.map(x => x.body))
@DanielFGray
DanielFGray / fp-curry-pa.md
Last active August 23, 2017 20:51
currying and partial application
Error in user YAML: (<unknown>): mapping values are not allowed in this context at line 2 column 30
---
layout: post
title: Functional programming: currying and partial application
category: computers
tags: [programming, javascript, fp]
date: 2017/08/23
---

An explanation of currying and partial application using JavaScript

Keybase proof

I hereby claim:

  • I am danielfgray on github.
  • I am danielfgray (https://keybase.io/danielfgray) on keybase.
  • I have a public key ASCZBK5f_xYF8vv7J8Iszrg7lNorAHLcO7_UZ3WCVk9k5go

To claim this, I am signing this object:

@DanielFGray
DanielFGray / webpack.config.js
Last active March 29, 2017 21:39
webpack.config.js
/* eslint-disable import/no-extraneous-dependencies */
const path = require('path')
const webpack = require('webpack')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const babelOpts = {
test: /\.jsx?$/,
exclude: /node_modules/,
use: [
@DanielFGray
DanielFGray / index.php
Created March 20, 2017 19:34
scratchpad thing
<!DOCTYPE html>
<html lang="en">
<head>
<title>scratchpad</title>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.min.css" media="all" />
<link type="text/css" rel="stylesheet" href="style.css" media="all" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script src="marked.min.js"></script>

Keybase proof

I hereby claim:

  • I am danielfgray on github.
  • I am danielfgray (https://keybase.io/danielfgray) on keybase.
  • I have a public key ASCGfXdCDEBGUKknNv9tGvObZXRnhwelTsPy_7dQGr5K-Ao

To claim this, I am signing this object:

#!/usr/bin/env bash
cleanup() {
tput cnorm > /dev/tty
stty "$_stty" <> /dev/tty
}
_stty=$(stty -g < /dev/tty)
trap cleanup exit SIGTERM SIGQUIT
menu() {
@DanielFGray
DanielFGray / workspaces.sh
Last active August 19, 2016 19:50
wm agnostic workspace indicator
#!/usr/bin/env bash
declare activeWorkspace="*%s"
declare inactiveWorkspace=" %s"
declare separator=" │ "
xprop -spy -root |
awk -v inactiveWorkspace="$inactiveWorkspace" \
-v activeWorkspace="$activeWorkspace" \
-v separator="$separator" -F' = ' '
module.exports = {
files: {
javascripts: {
joinTo: {
'vendor.js': /^(?!app)/,
'app.js': /^app/
}
},
stylesheets: {joinTo: 'app.css'}
},
@DanielFGray
DanielFGray / discover.vim
Last active April 19, 2016 00:04
[really] poor proof-of-concept [spac]emacs which-key port to vim | demo https://upload.teknik.io/8olPd.webm
" If you want to test this, save it somewhere, open in vim, `:so %`.
" Slowly type <leader>g andand g-commands should happen in the other buffer.
" In the demo webm above, I just slowly typed `<leader>gJ`
" I only added descriptions for a few commands but others should work
" Needs massive re-working to actually be maintainable
" WHY:
" Vim is an amazing tool, but one of it's few weaknesses is discoverability.
" While it's great to have a tool that you can continually learn new things about,
" learning those things would ideally happen sooner than later. Spacemacs ships with "which-key"