Skip to content

Instantly share code, notes, and snippets.

package main
import (
"net/http"
"net/url"
)
func main() {
values := url.Values{
"phone": {"5555555"},
@typpo
typpo / textbelt-example.js
Created September 10, 2019 15:16
Textbelt node example
var request = require('request');
request.post('https://textbelt.com/text', {
form: {
phone: '5555555555',
message: 'Hello world',
key: 'textbelt',
},
}, function(err, httpResponse, body) {
if (err) {
@typpo
typpo / sqlite2pg.sh
Last active July 31, 2019 14:20 — forked from eclubb/sqlite2pg.sh
#!/bin/sh
# This script will migrate schema and data from a SQLite3 database to PostgreSQL.
# Schema translation based on http://stackoverflow.com/a/4581921/1303625.
# Some column types are not handled (e.g blobs).
if [ $# -lt 3 ]; then
echo "usage: sqlite2pg.sh sqlite_db_path pg_db_name pg_user_name";
exit 1
fi
@typpo
typpo / gist:79bf3e82d81f886d01f14c872b755057
Created July 4, 2019 17:32
QuickChart/Chart.js transparent radar chart
{
type: 'radar',
data: {
labels: ['Jan', 'Feb', 'March', 'April', 'May'],
datasets: [{
data: [ 50, 60, 70, 80, 90 ],
backgroundColor: 'transparent',
borderColor: 'red',
}]
},
@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 / .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 / 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}}