Skip to content

Instantly share code, notes, and snippets.

View arronhunt's full-sized avatar
🏴
HTTPSTER

Arron Hunt arronhunt

🏴
HTTPSTER
View GitHub Profile
/**
* Truncate a list of names at return a human friendly sentence fragment.
* @param {string[]} list A list of name strings to format
* @param {number} max The maximum number of names to show before appending a count
* @example
* // returns "Abi, Jeri and Zoi"
* truncate(["Abi, Jeri, Zoi"])
* @example
* // Returns "Abi and 2 others"
* truncate(["Abi, Jeri, Zoi"], 1)
@arronhunt
arronhunt / sitemapindex.xml
Last active June 7, 2021 21:34
Site map index
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>hhttps://gretel.ai/sitemap.xml</loc>
</sitemap>
<sitemap>
<loc>https://docs.gretel.ai/sitemap.xml</loc>
</sitemap>
<sitemap>
<loc>https://docs.gretel.ai/sitemap.xml</loc>
@arronhunt
arronhunt / houdini-test.js
Last active June 1, 2021 18:13
Houdini test
import perlin from "https://cdn.jsdelivr.net/npm/perlin-noise@0.0.1/index.min.js"
(() => {
// node_modules/@georgedoescode/generative-utils/src/spline.js
function formatPoints(points, close) {
points = [...points];
if (!Array.isArray(points[0])) {
points = points.map(({ x, y }) => [x, y]);
}
if (close) {
const lastPoint = points[points.length - 1];
@arronhunt
arronhunt / entity_stream.py
Created September 8, 2020 18:01
Gretel entity stream example
from gretel_client import get_cloud_client
client = get_cloud_client('api', 'your_api_key')
project = client.get_project(name='your_project_name')
stream = project.iter_records(entity_stream="location")
@arronhunt
arronhunt / gretel_get_started_example.py
Last active August 27, 2020 19:58
Send data to a Gretel project
from gretel_client import get_cloud_client
client = get_cloud_client('api', 'your_api_key')
project = client.get_project(name='your_project_name')
project.send({'message':'Hello Gretel!'})
@arronhunt
arronhunt / social_distancing.css
Created March 19, 2020 17:11
Keep your HTML safe and bug free
*,
*::before,
*::after {
margin: 72in; /* 6 ft */
}
@arronhunt
arronhunt / keysToQueryString.js
Created November 27, 2017 03:01
Javascript keys to query string
export const keysToQueryString = (keys) => (
encodeURI(Object.keys(keys).reduce((string, key, index) => (
`${string}${!index?'?':'&'}${key}=${keys[key]}`
), ''))
);
@arronhunt
arronhunt / modulate.swift
Created February 17, 2017 21:48
Modulation function in Swift
// let value = Modulate(1, from: [0, 10], to: [0, 20], true);
// print(value);
// Returns 2
func Modulate(_ input: Float, from: [Float], to: [Float], limit: Bool) -> Float {
let result = to[0] + (((input - from[0]) / (from[1] - from[0])) * (to[1] - to[0]));
if (limit) {
if (to[0] < to[1]) {
if (result < to[0]) { return to[0] }
@arronhunt
arronhunt / fetti.coffee
Created October 8, 2015 22:57
Confetti module for FramerJS
colors = ["#f23f3f", "#ff7f3b", "#f2c83f", "#3ac95c", "#4a95ff", "#ac59ff", "#ff8aed", "#3bbdca"]
fetti_bag = []
exports.kaboom = () ->
unless fetti_bag.length > 1
for i in [0..100]
fetti = new Layer
width: 20, height: 20
scale: Utils.randomNumber(0.75, 1.25)

Keybase proof

I hereby claim:

  • I am arronhunt on github.
  • I am arronhunt (https://keybase.io/arronhunt) on keybase.
  • I have a public key whose fingerprint is 53C8 672C D009 7AB2 BE3C 753C 212A BAD1 E30C 83CA

To claim this, I am signing this object: