Skip to content

Instantly share code, notes, and snippets.

View StoneCypher's full-sized avatar

John Haugeland StoneCypher

View GitHub Profile
@zaphar
zaphar / date_util.erl
Created May 1, 2009 06:07
set of utility functions that wrap the calendar module and erlangs now() date() and time() functions
-module(date_util).
-compile(export_all).
epoch() ->
now_to_seconds(now())
.
epoch_hires() ->
now_to_seconds_hires(now())
.
@coolaj86
coolaj86 / how-to-publish-to-npm.md
Last active June 9, 2024 23:19
How to publish packages to NPM

Getting Started with NPM (as a developer)

As easy as 1, 2, 3!

Updated:

  • Aug, 08, 2022 update config docs for npm 8+
  • Jul 27, 2021 add private scopes
  • Jul 22, 2021 add dist tags
  • Jun 20, 2021 update for --access=public
  • Sep 07, 2020 update docs for npm version
@carlosmcevilly
carlosmcevilly / gist:2221249
Created March 27, 2012 22:55
fix git commit with wrong email address in git config, before pushing
If:
- you add and commit with the wrong email address in git, and
- your remote has a hook set up to prevent you from pushing with the bad address
Then you need to amend the author of your commit before push can succeed:
1. fix your email address in git config:
$ git config user.name "Your Name"
@vinoski
vinoski / sws.erl
Last active January 12, 2024 14:59
An example of a very simple HTTP 1.0 web server in Erlang.
%% Simple web server.
-module(sws).
-author('Steve Vinoski <vinoski@ieee.org>').
-export([start/1, start/2]).
%% start/1 takes a handler function and starts the web server on port 8000.
%% start/2 takes a handler function and a port number. The handler function
%% takes two arguments: a TCP socket and request data. The request data is
%% a property list indicating the invoked HTTP method, the target URI, the
@jefffriesen
jefffriesen / README.md
Last active May 2, 2024 15:11
US Zip Codes

This is a d3.js visualization of US zip codes.

Original zip code dataset from Geocommons.

5MB shapefile with properties such as zipcode, state, name, population, area, more.

http://geocommons.com/overlays/54893 (Thank you Bill Greer)

This converts it nicely:

@fitnr
fitnr / d3.geo.voronoi.js
Last active June 10, 2017 05:41
US Urban Areas Voronoi
(function() {
var π = Math.PI,
degrees = 180 / π,
radians = π / 180,
ε = 1e-15,
circle = d3.geo.circle().angle(90);
d3.geo.voronoi = function(points, triangles) {
if (arguments.length < 2) triangles = d3.geo.delaunay(points);
@StoneCypher
StoneCypher / PonterPointerClone.js
Last active August 29, 2015 14:05
PointerPointer Clone for Reddit (untried / untested, probably buggy)
// usage: var PPC = new PointerPointerClone();
// you need to actually put images in; i haven't
// fill in at least one for each quadrant, starting at line 24
// use the centers of each quadrant: (0.25,0.25), (0.25,0.75), (0.75,0.25), (0.75),(0.75)
// then you'll be able to see it working
function PointerPointerClone(Target, MoveThreshhold, MinTimeThreshhold) {
var counter = 0,
repaint = () => React.render(document.body, <Spinner data={counter}/>),
inc = () => { counter += 1, repaint() },
dec = () => { counter -= 1, repaint() },
Spinner = React.createClass({
render: function() {
@mondain
mondain / public-stun-list.txt
Last active July 22, 2024 14:09
Public STUN server list
23.21.150.121:3478
iphone-stun.strato-iphone.de:3478
numb.viagenie.ca:3478
s1.taraba.net:3478
s2.taraba.net:3478
stun.12connect.com:3478
stun.12voip.com:3478
stun.1und1.de:3478
stun.2talk.co.nz:3478
stun.2talk.com:3478
// this is the react app. it knows nothing of the vanilla app, other than that the information
// will come in in props, and that it should call this hook when this button is pressed, or etc
var Spinner = (props) =>
<div>
{this.props.data}
<button value="↑" onclick={this.props.hooks.inc}/>
<button value="↓" onclick={this.props.hooks.dec}/>
</div>;