Skip to content

Instantly share code, notes, and snippets.

@typpo
typpo / no-gridlines
Last active June 14, 2019 18:51
Chart.js without gridlines
{
type: 'bar',
data: {
labels: ['January', 'February', 'March', 'April', 'May'],
datasets: [{
label: 'Dogs',
data: [ 50, 60, 70, 180, 190 ]
}, {
label: 'Cats',
data: [ 100, 200, 300, 400, 500 ]
@typpo
typpo / quickchart.json
Created June 5, 2019 10:07
QuickChart / Chart.js pie chart without data labels
{
"type": "pie",
"data": {
"labels": [
"January",
"February",
"March",
"April",
"May"
],
@typpo
typpo / orbit.js
Last active February 17, 2019 18:15
Heliocentric position of object - kepler orbit
const sin = Math.sin;
const cos = Math.cos;
/**
* Get heliocentric position of object at a given JD.
* @param {Number} jd Date value in JD.
* @return {Array.<Number>} [X, Y, Z] coordinates
*/
getPositionAtTime(jd) {
const eph = this._ephem;
alembic==0.9.5
altgraph==0.14
aniso8601==1.3.0
apipkg==1.4
area==1.1.0
argh==0.26.2
asn1crypto==0.22.0
astroid==1.4.9
atomicwrites==1.1.5
attrs==18.1.0
@typpo
typpo / async analytics.js
Created August 5, 2017 20:05
MIT License
// Create a queue to push events and stub all methods
window.analytics || (window.analytics = {});
window.analytics_queue || (window.analytics_queue = []);
(function() {
var methods = ['identify', 'track', 'trackLink', 'trackForm', 'trackClick', 'trackSubmit', 'page', 'pageview', 'ab', 'alias', 'ready', 'group', 'on', 'once', 'off'];
var factory = function(method) {
return function () {
var args = Array.prototype.slice.call(arguments);
args.unshift(method);
@typpo
typpo / .vimrc
Created August 3, 2017 17:27
macbook vimrc 2017-08-03
set nocompatible
filetype indent on
set backspace=indent,eol,start
set cul " cursor line
set cpo+=J
" Exit visual mode without delay.
set timeoutlen=1000 ttimeoutlen=0
@typpo
typpo / mailforwarding.md
Created February 6, 2017 06:14
Mail Forwarding With Mailgun and CloudFlare

Source

Mail Forwarding With Mailgun and CloudFlare

After moving my DNS from Namecheap to CloudFlare I lost the ability to use Namecheap as a mail forwarder. For anyone not sure what that is, essentially it allows you to receive email at anyname@your-domain.com and have it automatically forwarded somewhere else (like your personal Gmail account).

So, what I did is leverage a free account with [Mailgun][1] to setup the same thing.

Mailgun Setup

@typpo
typpo / gist:abc09519d8c7939ebc30762edd80e654
Last active January 8, 2017 23:57 — forked from mmcgahan/gist:9fa045d98c7c122f1c0b
Handlebars template inheritance - with a bug fix (see handlebars.loadPartial)
# Template composition with inclusion
Every template language I have seen provides some mechanism for one template to include another, thus supporting the reuse of repeated elements like headers and footers. The included templates are called partials in Mustache parlance:
```html
<!-- home.hbs -->
<html>
<body>
{{> header}}
<p> HOME </p>
{{> footer}}
set nocompatible
filetype off
set backspace=indent,eol,start
" Exit visual mode without delay.
set timeoutlen=1000 ttimeoutlen=0
set cul " cursor line
set cpo+=J
#define _ 0xBEE7
#define print(str)'='//;printf\(str\);
#include <stdio.h>
#define f(X) int
union fi {f(fi) x; char y;}i;int main() {f(10) ff=10;for (i.x=0; (long)i.x < 1+4*19*643-_+ff;){if(!i.x++ & _< ff)z:if (putchar(ff) && _)return ff;}print([x for x in set(ff)]);printf("%d", (f(.))i.x);f(1) x;sscanf("22","%d", &x);sprintf(&i.y, "%c", print(ff));printf("%c%c", putchar(print(4__2)),i.y);print(__);f(fi{for(;;)}) y;putchar('Z'-x);goto z;}