Skip to content

Instantly share code, notes, and snippets.

View gilbert's full-sized avatar
🪐
Security in space

Gilbert gilbert

🪐
Security in space
View GitHub Profile
@gilbert
gilbert / data-deps.js
Last active February 7, 2018 23:39
React GET Data Dependencies helper
//
// Our main data fetching tool.
// This fetches an object of promise makers ONLY ON THE CLIENT SIDE,
// and manages loading and data states for each key.
//
import React from 'react'
import http from './http'
export default (promisesMakers, options={}) => Component =>
class FetchHOC extends React.Component {
@gilbert
gilbert / keybase.md
Last active September 29, 2017 18:12

Keybase proof

I hereby claim:

  • I am gilbert on github.
  • I am mindeavor (https://keybase.io/mindeavor) on keybase.
  • I have a public key whose fingerprint is 7DB8 DF5F 0720 815C 104C 416A F8BA C5DA 9D8C 1B56

To claim this, I am signing this object:

@gilbert
gilbert / actual.js
Last active September 29, 2017 04:50
Pipeline op code
var inc = (x) => x + 1;
var double = (x) => x * 2;
var x = 10 |> inc |> double;
var y = 10 |> inc;
@gilbert
gilbert / index.html
Created January 16, 2015 16:22
Quizzy Part 1 MVC w/ Mithril.js
<html>
<head>Quizzy Part 1 MVC</head>
<body>
<div id="app"></div>
<script src="vendor/mithril.js" type="text/javascript"></script>
<script src="quiz.js" type="text/javascript"></script>
<script type="text/javascript">
Quiz.vm.questions([
@gilbert
gilbert / logs.txt
Created June 5, 2017 03:27
Reason build error logs
Configuring for host x86_64-apple-darwin16.6.0 ...
Configuring for target x86_64-apple-darwin16.6.0 ...
Using compiler gcc.
The C compiler is ANSI-compliant.
Checking the sizes of integers and pointers...
Wow! A 64 bit architecture!
This is a little-endian architecture.
Doubles can be word-aligned.
64-bit integers can be word-aligned.
Native division and modulus have round-towards-zero semantics, will use them.
@gilbert
gilbert / gist:0cfa65ce832ce35a278e
Last active March 27, 2017 09:06
Global AJAX loading indicator for Mithril.js
(function () {
//
// Global ajax loaders
//
// This is useful for showing a loading animation, yet still taking
// advantage of the default behavior of m.request, which is to wait
// for all requests to complete before rendering the view.
//
// The loader is assumed to already be on the page
var loader = document.querySelector('.ajax-loader')
@gilbert
gilbert / index.html
Created March 7, 2017 19:37
Minimal Mithril 1.0 boilerplate
<!doctype html><title>Minimal Mithril</title>
<div id="app"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mithril/1.0.1/mithril.min.js"></script>
<script>
var AppComponent = {
view: function (vnode) {
return m('h1', "Hello World!")
@gilbert
gilbert / DefaultKeyBinding.dict
Created February 17, 2017 05:14
Enable terminal text navigation keyboard shortcuts across entire OS X operating system
/* Create a new file at ~/Library/KeyBindings/DefaultKeyBinding.dict */
/* and copy/paste this into it. */
{
"~f"="moveWordForward:";
"~b"="moveWordBackward:";
"~<"="moveToBeginningOfDocument:";
"~>"="moveToEndOfDocument:";
"~v"="pageUp:";
"~d"="deleteWordForward:";
"~^h"="deleteWordBackward:";
@gilbert
gilbert / functions.js
Last active September 20, 2016 15:09
JavaScript Function Extensions
// Partially apply arguments to a function. Useful for binding
// specific data to an event handler.
// Example:
//
// var add = function (x,y) { return x + y }
// var add5 = add.papp(5)
// add5(7) //=> 12
//
Function.prototype.papp = function () {
var slice = Array.prototype.slice
@gilbert
gilbert / example-use.js
Last active August 18, 2016 13:44
Back-button & forward-button compatible Redux-like state management for Mithril.js
var BlogComments = {}
BlogComments.controller = function (options) {
App.state.fetch('blogComments', `/api/blog-post/${ options.blog_id }/comments`)
}
BlogComments.view = function (ctrl, options) {
var comments = App.state.blogComments
return m('.blog-comments-component', [