Skip to content

Instantly share code, notes, and snippets.

View Stanback's full-sized avatar

Brian Stanback Stanback

  • Demand.io
  • Los Angeles, California
View GitHub Profile
@Stanback
Stanback / phantom_test.js
Last active August 29, 2015 14:00
PhantomJS test of the XContentReady event
/*
* Simple test of PhantomJS and the XContentReady event.
*
* This is the basic pattern used for the ember-prerender project: https://github.com/zipfworks/ember-prerender
* More info on the XContentReady event: https://github.com/n-fuse/the-XContentReady-Event/
*
* Usage: phantomjs phantom_test.js
*/
var page = require('webpage').create();
@cronnelly
cronnelly / gist:98345100afe21840267270da3283b371
Created April 5, 2016 18:00
lxcbr0 is being replaced by lxdbr0
┌─────────────────────────────────────────────────────────┤ Configuring lxd ├──────────────────────────────────────────────────────────┐
│ │
│ lxcbr0 is being replaced by lxdbr0 │
│ │
│ With this package upgrade LXD is moving away from the LXC provided lxcbr0 bridge and moving to its own lxdbr0 bridge. │
│ │
│ The reason for this switch is:
@Stanback
Stanback / Dockerfile
Created March 28, 2015 01:21
PhantomJS 2.0 Dockerfile
#
# Example Dockerfile that builds PhantomJS 2.0
#
# Build with:
# docker build --rm --tag=phantom2.0:latest .
#
# Run with:
# docker run --name=phantom2.0 phantom2.0
#
# Copy the executable to your host machine for distribution:
@robbypelssers
robbypelssers / gist:5186812
Last active March 23, 2017 11:39
Unicode Normalization
import java.text.Normalizer
/**
* Problem: Characters with accents or other adornments can be encoded in several different ways in Unicode
* However, from a user point of view if they logically mean the same, text search should make no distinction
* between the different notations. So it's important to store text in normalized unicode form. Code below shows
* how to check if text is normalized and how you can normalize it.
**/
object NormalizationTest {
@Stanback
Stanback / preactDomRenderer.js
Last active June 28, 2017 21:39
Preact DOM render using undom
// src/app/preactDomRenderer.js
import { h, render } from 'preact';
import undom from 'undom';
const VOID_ELEMENTS = [
'area',
'base',
'br',
'col',
@tgecho
tgecho / Directional React Animations.markdown
Last active April 16, 2018 12:40
Directional React Animations

Directional React Animations

This is a demo of dynamic directional transitions using React's CSSTransitionGroup.

A Pen by tgecho on CodePen.

License.

import matplotlib.pyplot as plt
import matplotlib.patches as patches
from PIL import Image
import numpy as np
input_test_img = '/your/path/Utah_AGRC-HRO_15.0cm_12TVK220980-CROP.0.0.jpg'
im = np.array(Image.open(input_test_img), dtype=np.uint8)
# Create figure and axes
fig,ax = plt.subplots(figsize=(10, 10))
with detection_graph.as_default():
with tf.Session(graph=detection_graph) as sess:
image_tensor = detection_graph.get_tensor_by_name('image_tensor:0')
detection_boxes = detection_graph.get_tensor_by_name('detection_boxes:0')
detection_scores = detection_graph.get_tensor_by_name('detection_scores:0')
detection_classes = detection_graph.get_tensor_by_name('detection_classes:0')
num_detections = detection_graph.get_tensor_by_name('num_detections:0')
for image_path in TEST_IMAGE_PATHS:
image = Image.open(image_path)
image_np = load_image_into_numpy_array(image)
@xmlking
xmlking / Enum.es6.js
Last active June 25, 2019 18:09
JavaScript Enums with ES6, Type Checking and Immutability
export class EnumSymbol {
sym = Symbol.for(name);
value: number;
description: string;
constructor(name: string, {value, description}) {
if(!Object.is(value, undefined)) this.value = value;
if(description) this.description = description;
import React from 'react'
function defaultGetWidth () {
return window.innerWidth;
}
function defaultGetHeight () {
return window.innerHeight;
}