Skip to content

Instantly share code, notes, and snippets.

View ungoldman's full-sized avatar
🤔
💭

Nate Goldman ungoldman

🤔
💭
View GitHub Profile
@ungoldman
ungoldman / rim-fire.json
Last active December 21, 2015 15:48
active fire data from EOSDIS in GeoJSON
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ungoldman
ungoldman / sum.js
Last active December 23, 2015 10:09
sums in node
var usage = 'Usage: node sum.js val1 val2 [other_vals]';
var nums = process.argv.slice(2);
var sum = 0;
// as a simple program
console.log(nums);
if (nums.length < 2) {
console.log(usage);
@ungoldman
ungoldman / config.rb
Last active December 25, 2015 05:29
middleman instance variables that are collections of pages
# ...
def get_pages
# get an array of pages whose source filename contains .html
@pages = sitemap.resources.find_all { |page| page.source_file.match(/\.html/) }
# sort them by an arbitrary YAML frontmatter property called 'order'
@pages.sort! { |a,b| a.data['order'].to_i <=> b.data['order'].to_i }
end
@ungoldman
ungoldman / r_notes.md
Created October 20, 2013 20:06
R Notes
@ungoldman
ungoldman / dokku_setup.md
Last active November 28, 2023 12:35
Deploy your own PaaS: Setting up Dokku with DigitalOcean and Namecheap

Deploy your own PaaS!

Setting up Dokku with DigitalOcean and Namecheap

..or how I made my own heroku in a few hours for $3.98.


This write-up is several years out of date! You probably shouldn't use it.

@ungoldman
ungoldman / findLocalItems.js
Last active November 20, 2020 04:05
how to filter keys from localStorage with a regex
// returns an array of localStorage items in key/value pairs based on a query parameter
// returns all localStorage items if query isn't specified
// query can be a string or a RegExp object
function findLocalItems (query) {
var i, results = [];
for (i in localStorage) {
if (localStorage.hasOwnProperty(i)) {
if (i.match(query) || (!query && typeof i === 'string')) {
value = JSON.parse(localStorage.getItem(i));
@ungoldman
ungoldman / js_package_release.md
Last active December 28, 2015 19:59
Release You A Package

JS Release Steps

build

  1. lint, test
  2. bump versions in all relevant places
    • package.json, bower.json, banners, docs
  3. build

github release

@ungoldman
ungoldman / rad_tricks.md
Created February 21, 2014 08:52
Rad tricks from a past life

rad tricks

MySQL

Raddest db since like forever (not)

just dump it

@ungoldman
ungoldman / index.js
Created February 28, 2014 21:31
requirebin sketch
var Terraformer = require('terraformer')
var point = new Terraformer.Point({
type: 'Point',
coordinates: [-122.677425, 45.521637]
})
var res = point.toMercator()
document.documentElement.innerHTML = res.coordinates