Skip to content

Instantly share code, notes, and snippets.

View Flet's full-sized avatar
💭
Feel free to @ me if I missed a notification

Dan Flettre Flet

💭
Feel free to @ me if I missed a notification
View GitHub Profile
@max-mapper
max-mapper / readme.md
Last active August 29, 2015 14:07
Node >= 0.10 Streams2 protips

@mafintosh said most of this, I just wrote it down

how to destroy/end streams in node >= 0.10

  • usually you call .destroy() if it has .destroy
  • if it doesnt have .destroy you are out of luck and the stream should upgrade to use e.g. newer through2
  • in request you call .abort() (this should get fixed to use .destroy())
  • .end() tries to end the stream gracefully

what about close

#!/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'
@bcomnes
bcomnes / jsfmt.sublime-settings
Created February 17, 2015 03:44
jsfmt.sublime-settings
{
// autoformat on save
"autoformat": true,
// array of extensions for autoformat
"extensions": ["js", "sublime-settings"],
// options for jsfmt
"options": {
"preset": "default",
@mattdesl
mattdesl / about.md
Last active August 29, 2015 14:23
thoughts / proof of concept

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

#!/usr/bin/env node
const cliclopts = require('cliclopts')
const minimist = require('minimist')
const fs = require('fs')
const quickStub = require('./')
const opts = cliclopts([
{

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

@gabebw
gabebw / git-push-git-paid.bash
Created March 17, 2014 03:12
GIT PUSH GIT PAID dot com
#!/bin/bash
# Run this inside a git repo.
# Change name of `origin` remote to `git`
sed -i '' 's/remote "origin"/remote "git"/' .git/config
# Pushing to `paid` means pushing to `master`
# http://stackoverflow.com/questions/549920/is-it-possible-to-alias-a-branch-in-git
git symbolic-ref refs/heads/paid refs/heads/master
@dannguyen
dannguyen / cpsc-recalls-json-getter.md
Last active May 29, 2016 03:31
Download and aggregate by year the number of consumer product recalls initiated by the Consumer Product Safety Commission (Python 3.x)

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.

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

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

@airportyh
airportyh / jsconf_slides_codes_and_notes.md
Last active June 19, 2017 20:51
JSConf 2014 Slides, Codes and Notes.

JSConf Slides, Codes and Notes

These are all the JSConf 2014 slides, codes, and notes I was able to cull together from twitter. Thanks to the speakers who posted them and thanks to @chantastic for posting his wonderful notes.

Modular frontend with NPM - Jake Verbaten (@Raynos)