Skip to content

Instantly share code, notes, and snippets.

🎯
Working on a super-secret, top-notch project

Isaac Whitfield whitfin

🎯
Working on a super-secret, top-notch project
Block or report user

Report or block whitfin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@whitfin
whitfin / Cargo.toml
Last active Mar 1, 2019
Example of piping request body to a file in Gotham
View Cargo.toml
[package]
name = "gotham_request_pipe"
version = "0.1.0"
authors = ["Isaac Whitfield <iw@whitfin.io>"]
edition = "2018"
[dependencies]
gotham = "0.3"
hyper = "0.12"
tokio = "0.1"
View package.py
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Libimobiledevice(AutotoolsPackage):
"""Library to communicate with iOS devices natively."""
View keybase.md

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

View broadcaster.java
package com.appcelerator.binding;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class Broadcaster {
private static final Map<String, List<Listener>> LISTENERS = new ConcurrentHashMap<>();
View promises_for_noopkat.js
client
.refresh()
.then(function () {
return client.get(); // return your promise
})
.then(function (result) {
// result is the return of client.get()
})
.catch(function (err) {
// common handler for any broken promise now
@whitfin
whitfin / poor_persons_with.exs
Last active Sep 6, 2016
If you're working against Elixir v1.1, here's a simple (single tier) with statement
View poor_persons_with.exs
defmodule MyModule do
defmacro exec_with(left, right, do: fun) do
quote do
case unquote(right) do
unquote(left) ->
unquote(fun)
v -> v
end
end
end
View elasticsearch.js
module.exports = {
image: 'elasticsearch',
binds: [
'$DOCKSERV_DATA/elasticsearch/data:/usr/share/elasticsearch/data'
],
ports: [
'9200',
'9300'
]
};
View center_mdown.js
exports.parse = function parse(mdown) {
console.log('<p align="center" style="margin: 2em auto auto auto; width:70%;">');
mdown.match(/\[\!.*?\)\].*?\)/g).forEach(function (badge) {
var segments = badge.match(/\[!\[(.*?)\]\((.*?)\)\]\((.*?)\)/);
var altText = segments[1];
var svgPath = segments[2];
var urlHref = segments[3];
console.log(` <a href="${urlHref}">`);
@whitfin
whitfin / ArrayNodeCollector.java
Created Sep 19, 2015
Collecting to a Jackson ArrayNode from a Java 8 Stream.
View ArrayNodeCollector.java
package com.zackehh.example;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import java.util.EnumSet;
import java.util.Set;
import java.util.function.BiConsumer;
import java.util.function.BinaryOperator;
@whitfin
whitfin / DirectedStream.java
Created May 10, 2014
A simple Thread extension to control a redirection of an InputStream to an OutputStream.
View DirectedStream.java
package com.zackehh.example;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
/**
* A Thread extension dedicated to redirecting InputStreams
* to given OutputStreams. Feeds into the given OutputStream
* during the lifetime of this Thread.
You can’t perform that action at this time.