Skip to content

Instantly share code, notes, and snippets.

View jhampton's full-sized avatar

Jeff Hampton jhampton

View GitHub Profile
@jhampton
jhampton / machine.js
Created September 16, 2020 04:19
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@jhampton
jhampton / getDeepValues.js
Last active February 8, 2018 18:18
Deep JavaScript Object search with filtered keys and array support
/**
example:
const searchDown = getDeepValues(
['testId', 'caption', 'model', 'modelId'],
action.payload.memoizedProps,
['memoizedProps', 'props' ,'child', 'children']
);
const searchUp = getDeepValues(
['testId', 'caption', 'model'],
action.payload.return,
@jhampton
jhampton / README.md
Last active August 29, 2015 14:26 — forked from zenorocha/README.md
A template for Github READMEs (Markdown) + Sublime Snippet

Client Name - Project Name

TODO: Describe what the project is, what it does

Included Technology

  • Use bullet points to lay out languages and modules like so:
  • PHP (>=5.5.x)
  • Uses the Amazon AWS PHP library (link to library)
  • node.js (0.10.36 or higher)
@mixin linear-gradient($angle, $color-stops...) {
$_angle-with-vendor-prefix: "";
$_angle: "";
@if $angle == "to top" or $angle == "bottom" {
$_angle-with-vendor-prefix: bottom;
$_angle: to top;
} @else if $angle == "to right" or $angle == "left" {
$_angle-with-vendor-prefix: left;
$_angle: to right;
} @else if $angle == "to bottom" or $angle == "top" {
@jhampton
jhampton / gist:8361127
Last active January 2, 2016 21:08
Simple PHP Curl Wrapper
// create curl function
function curlContents($url, $method = 'GET', $data = false, $headers = false, $returnInfo = false) {
$ch = curl_init();
if($method == 'POST') {
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
if($data !== false) {
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
}
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8">
$(window).load(function(){
$().hatchShow();
});
jQuery.fn.hatchShow = function(){
$('.hsjs').css('display','inner-block').css('white-space','pre').each(function(){
var t = $(this);
t.wrap("<span class='hatchshow_temp' style='display:block'>");
var pw = t.parent().width();