Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
@ me if no response in issues/PRs 👍

Dan Flettre Flet

💭
@ me if no response in issues/PRs 👍
View GitHub Profile
@dannguyen
dannguyen / cpsc-recalls-json-getter.md
Last active May 29, 2016
Download and aggregate by year the number of consumer product recalls initiated by the Consumer Product Safety Commission (Python 3.x)
View cpsc-recalls-json-getter.md

The homepage for the CPSC API can be found at: http://www.cpsc.gov/en/Recalls/CPSC-Recalls-Application-Program-Interface-API-Information/

There's even a programmer's manual: http://www.cpsc.gov/Global/info/Recall/CPSC-Recalls-Retrieval-Web-Services-Programmers-Guide_3-25-2015.pdf

And here's a stashed version of the 2016 data (as of April):

http://stash.compjour.org/samples/cpsc/recalls201604.json

However, a bare call of the endpoint -- http://www.saferproducts.gov/RestWebServices/Recall?format=json -- with no parameters beyond specifying JSON as the format seems to yield the entire collection: ~6,700 records at around 20MB.

View npm-issues.md

npm issues

npm had a security meltdown, what can we do?

This is a hard problem to solve, because it all comes down to trust. npm will probably try and solve parts of this (they have to now), but we should also be taking action on our end.

Immediate actions

View cli.js
#!/usr/bin/env node
const cliclopts = require('cliclopts')
const minimist = require('minimist')
const fs = require('fs')
const quickStub = require('./')
const opts = cliclopts([
{
@beaugunderson
beaugunderson / cool-modules.md
Last active Aug 29, 2016
cool modules from nodeconf
View cool-modules.md

from streams session

  • end-of-stream - specify a callback to be called when a stream ends (which is surpsingly hard to get right)
  • duplexify - compose a Duplex stream from a Readable and a Writable stream
  • pump - pipe streams together and close all of them if one of them closes
  • pumpify - combine an array of streams into a single duplex stream using pump and duplexify
  • through2 - tools for making Transform streams
  • from2 - tools for making Readable streams

from "participatory modules" session

@mattdesl
mattdesl / about.md
Last active Aug 29, 2015
thoughts / proof of concept
View about.md

The coolest thing about electron is that it blurs the line between "Node" and "Browser." Here is a Node.js module that typically doesn't work in the browser, but runs as expected in Electron:

var natural = require('natural')
console.log(natural.LevenshteinDistance('one', 'one'))

Example output:

image

@nodebotanist
nodebotanist / gist:0b976847f4c68eb389f8
Last active Jun 16, 2016
On "Real Coding," history, and what it means to be a programmer.
View gist:0b976847f4c68eb389f8

I'm sitting here, on a rainy Sunday morning in June 2015, in front of my MacBook Air, flipping switches on my Android, staring at the computer. A light bulb in my living room flickers from blue, to orange, to some weird green color. I'm tracking Bluetooth LE Characteristics. I have a Bluetooth light bulb, and they don't have a javascript API yet, so I'm using noble and node to write one.

I'm sitting there, a few miles away, in I want to say August 1999. I'm staring at a CRT monitor, and plugged into a USB port on my family's windows tower is a GameBoy GameShark that I took on a lot of chores and time to earn. plugged into that is some Harvest Moon game or another. I want to say I needed more tomato seeds. My child-brain decided that instead of figuring out a way to earn the in-game currency, I would alter the universe.

I wasn't the most straightforward-thinking kid.

Since then I've learned I could've just used Yahoo (or even Ask Jeeves!) for the codes. Instead I looked up how to make them: I found profanit

@bcomnes
bcomnes / jsfmt.sublime-settings
Created Feb 17, 2015
jsfmt.sublime-settings
View jsfmt.sublime-settings
{
// autoformat on save
"autoformat": true,
// array of extensions for autoformat
"extensions": ["js", "sublime-settings"],
// options for jsfmt
"options": {
"preset": "default",
View vim-quickstart.sh
#!/usr/bin/env bash
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
cat >>~/.vimrc <<EOL
set nocompatible
call plug#begin()
Plug 'tpope/vim-sensible'
View Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
View essential-javascript-links.md
You can’t perform that action at this time.