Skip to content

Instantly share code, notes, and snippets.

@chrisnolet
chrisnolet / .zshrc
Last active April 13, 2024 06:13
Color-coded git branch for zsh prompt
autoload -Uz compinit && compinit
autoload -Uz add-zsh-hook
autoload -Uz vcs_info
add-zsh-hook precmd vcs_info
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:*' formats " %F{cyan}%c%u(%b)%f"
zstyle ':vcs_info:*' actionformats " %F{cyan}%c%u(%b)%f %a"
zstyle ':vcs_info:*' stagedstr "%F{green}"

env vars:

SLACK_WEBHOOK_URL
CRAIGSLIST_SEARCH_URL=https://sfbay.craigslist.org/search/sfc/apa?query=glen+park&hasPic=1&postedToday=1&availabilityMode=0&sale_date=all+dates
SLACK_ICON_URL
@mafintosh
mafintosh / README.md
Last active August 21, 2022 21:12
Using shared-structs with workers <3

Using shared-structs with Workers <3

This showcases how you can use shared-structs over an SharedArrayBuffer, to share complex data structures between worker_threads in Node.js

The main.js example starts a worker and passes a shared struct to it.

The worker will periodically update the struct with an incrementing tick and a random number

@staltz
staltz / migration-guide.md
Last active December 19, 2023 22:14
How to show migration guides in GitHub Markdown

How to show migration guides in GitHub Markdown

Use the diff code highlighting tag.

  ```diff
  - foo
  + bar

Example:

@chantastic
chantastic / on-jsx.markdown
Last active March 20, 2024 01:03
JSX, a year in

Hi Nicholas,

I saw you tweet about JSX yesterday. It seemed like the discussion devolved pretty quickly but I wanted to share our experience over the last year. I understand your concerns. I've made similar remarks about JSX. When we started using it Planning Center, I led the charge to write React without it. I don't imagine I'd have much to say that you haven't considered but, if it's helpful, here's a pattern that changed my opinion:

The idea that "React is the V in MVC" is disingenuous. It's a good pitch but, for many of us, it feels like in invitation to repeat our history of coupled views. In practice, React is the V and the C. Dan Abramov describes the division as Smart and Dumb Components. At our office, we call them stateless and container components (view-controllers if we're Flux). The idea is pretty simple: components can't

@hekike
hekike / server.js
Created January 11, 2015 13:25
Highland server with mongoose
var http = require('http');
var _ = require('highland');
var mongoose = require('mongoose');
var httpServer = http.createServer();
var server = _('request', httpServer, ['req', 'res']);
mongoose.connect('mongodb://localhost/test');
var UserSchema = new mongoose.Schema({
@ericelliott
ericelliott / essential-javascript-links.md
Last active May 7, 2024 01:25
Essential JavaScript Links
@mikeal
mikeal / gist:86920c314a9dd66db86b
Last active August 29, 2015 14:05
ONE-SHOT by NodeConf

ONE-SHOT is a "forkable conference" initially created by the organizer of NodeConf.

The main NodeConf events around the world are rather large productions and require a big commitment of time and financial risk. ONE-SHOT was created as a much simpler single day speaker series event that people around the world can pick up and run without a huge time commitment or considerable financial risk.

That first ONE-SHOT was run in London and events are now planned for Budapest, Brussels, and Oakland.

Ping @mikeal if you'd like to run an event, he'll give you instructions on how to fork the repository which includes the website, CFP instructions, and the Issue tracker can be used to accept talk proposals. Mikeal will also point "your city".nodeconf.com at the property gh-pages CNAME.

@rwaldron
rwaldron / calibrate-servo.js
Last active August 29, 2015 14:02
Calibrating a continuous servo and external power warning
var five = require("johnny-five");
var board = new five.Board();
board.on("ready", function() {
/*
Assuming a continuous servo is attached to pin 9,
this program can be called as:
node calibrate-servo.js
@oroce
oroce / elasticsearch-template.json
Created June 3, 2014 07:34
elastic-search.template
{
"template": "logstash-*",
"settings" : {
"index" : {
"store" : { "compress" : { "stored" : true, "tv": true } }
}
},
"mappings": {
"_default_": {
"_all": { "enabled": false },