Skip to content

Instantly share code, notes, and snippets.

View chronick's full-sized avatar

Nick Donohue chronick

  • StockX
  • Ferndale, MI
View GitHub Profile
import { IncomingMessage, ServerResponse } from 'http'
import tracer, { Span } from 'dd-trace'
import * as url from 'url'
const HTTP_IP = 'http.ip'
const HTTP_METHOD = 'http.method'
const HTTP_PATH = 'http.uri.path'
const HTTP_QUERY = 'http.uri.query'
const HTTP_RESPONSE_STATUS = 'http.response.status'
const USER_AGENT = 'http.useragent'
### Keybase proof
I hereby claim:
* I am chronick on github.
* I am ndonohuestockx (https://keybase.io/ndonohuestockx) on keybase.
* I have a public key whose fingerprint is 8388 F4AF E9A6 6086 06A7 B08F 6656 971C A609 BBE9
To claim this, I am signing this object:
# make all pixels outside the polygon transparent
def get_cleaned_img(img, polygon):
# convert to numpy (for convenience)
imArray = np.asarray(img)
# create mask
maskIm = Image.new('L', (imArray.shape[1], imArray.shape[0]), 0)
ImageDraw.Draw(maskIm).polygon(polygon, outline=1, fill=1)
mask = np.array(maskIm)
define(require => {
const moment = require('moment');
const d3 = require('d3');
// const parseTime = d3.timeParse('%Y%m%d');
const generateData = () => {
let data = [];
let n = 1;
let planned = 0;
const testFuzzy: Test = compare => {
// Creates a regex that allows for any number of characters between those
// passed. Similar to Sublime Text's cmd-p menu. 'i' for case insensitive.
const regex = new RegExp(compare.split("").join(".*"), "i");
return (obj, key) => regex.test(obj[key]);
};
import React from 'react';
/* Usage:
<FuzzyHighlighter query="some" text="something"/>
*/
const FuzzyHighlighter = ({ className, query = '', text = '' }) => {
let lastIdx = 0;
let tSearch = text.toLowerCase();
const indices = query.toLowerCase().split('')
"use strict";
const _ = require('lodash');
const Prismic = require('prismic.io');
const Promise = require('bluebird');
function exec() {
return new Promise((resolve, reject) => {
Prismic.api("http://farmlogs-website.prismic.io/api").then(function(api) {
return api.query('[[:d = at(document.type, "team-member")]]');

Some random stuff I was messing around with

@chronick
chronick / yep.coffee
Created July 30, 2015 16:55
Render arbitrary geoJSON on a div with d3
_setupGeometry: ->
map = @props.map
map.drawing.disable()
map.hideClus()
map.hideControls()
width = 500
height = 500
@chronick
chronick / DrawableToBitmap.java
Last active August 29, 2015 14:08
Drawable to Bitmap for Android
public static Bitmap drawableToBitmap(Drawable drawable) {
if (drawable instanceof BitmapDrawable) {
return ((BitmapDrawable) drawable).getBitmap();
}
Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(),
drawable.getIntrinsicHeight(),
Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);