Skip to content

Instantly share code, notes, and snippets.

View ItsJonQ's full-sized avatar
🦄
Hai!

Q ItsJonQ

🦄
Hai!
View GitHub Profile
@ItsJonQ
ItsJonQ / interpolate.js
Last active August 19, 2020 21:51
interpolate.js
/**
* Modified from:
* https://github.com/react-spring/react-spring/blob/master/src/animated/createInterpolator.ts
*/
function clamp(value, min, max) {
return Math.max(min, Math.min(max, value));
}
export function findRange(input, inputRange) {
@alisdair
alisdair / intensify.sh
Created May 21, 2019 23:44
intensifies Slack emoji creator
#!/bin/bash
# Generate a `:something-intensifies:` Slack emoji, given a reasonable image
# input. I recommend grabbing an emoji from https://emojipedia.org/
set -euo pipefail
# Number of frames of shaking
count=10
# Max pixels to move while shaking
@ItsJonQ
ItsJonQ / get.js
Last active December 1, 2018 23:46
A tiny implementation of lodash.get
/**
* Retrieves a (deeply) nested value from an object.
* A tiny implementation of lodash.get.
*
* Tests:
* https://codesandbox.io/s/48052km1q7
*
* Perf tests:
* https://jsperf.com/get-try-catch-vs-reduce-vs-lodash-get
*
@celsogg
celsogg / astar.js
Last active December 31, 2018 19:39
A * (A Star) Algorithm written in javascript, and a test
/*
example:
var map = [ [0,0,0,0,0,1,1,0],
[0,0,0,0,1,0,0,0],
[0,1,1,0,1,0,0,0],
[0,0,0,0,1,0,1,0],
[0,1,1,0,0,0,1,0],
[0,0,0,0,0,0,1,0] ];
var start = {x:0, y:0};
var goal = {x:7, y:4};
@ItsJonQ
ItsJonQ / index.html
Last active August 29, 2015 14:00
HTML 5 - Blank - Starter (Based on HTML 5 Boilerplate)
<!doctype html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="public/css/main.css">
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten
@cobyism
cobyism / gh-pages-deploy.md
Last active April 18, 2024 13:44
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@Potherca
Potherca / README.md
Last active November 27, 2023 17:44
Create a branch on Github without access to a local git repo using http://hurl.eu/

Ever had the need to create a branch in a repo on Github without wanting (or being able) to access a local repo?

With the aid of [the Github API][1] and any online request app this is a piece of cake!

Just follow these steps:

  1. Open an online request app (like apirequest.io, hurl.it pipedream.com, reqbin.com, or webhook.site)
  2. Find the revision you want to branch from. Either on Github itself or by doing a GET request from Hurl: https://api.github.com/repos/<AUTHOR>/<REPO>/git/refs/heads
  3. Copy the revision hash
  4. Do a POST request from Hurl to https://api.github.com/repos/<AUTHOR>/<REPO>/git/refs with the following as the POST body :
@liamcurry
liamcurry / gist:2597326
Created May 4, 2012 19:56
Vanilla JS vs jQuery

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name: