Skip to content

Instantly share code, notes, and snippets.

@Rich-Harris
Rich-Harris / http-apis.md
Last active November 3, 2022 09:02
Next-gen Node HTTP APIs

I saw this poll on Twitter earlier and was surprised at the result, which at the time of writing overwhelmingly favours option 1:

Screen Shot 2020-09-10 at 10 19 22 AM

I've always been of the opinion that the (req, res, next) => {} API is the worst of all possible worlds, so one of two things is happening:

  • I'm an idiot with bad opinions (very possibly!)
  • People like familiarity
@gilbarbara
gilbarbara / gitsubmodules.sh
Last active October 18, 2022 23:45
Install git submodules from a .gitmodules file
#!/bin/sh
set -e
git config -f .gitmodules --get-regexp '^submodule\..*\.path$' |
while read path_key path
do
url_key=$(echo $path_key | sed 's/\.path/.url/')
url=$(git config -f .gitmodules --get "$url_key")
git submodule add $url $path
@max-mapper
max-mapper / readme.md
Last active May 14, 2022 09:12
list of interdisciplinary open source conferences

Interdisciplinary Open Source Community Conferences

Criteria

  • Must be an event that someone involved in open source would be interested in attending
  • Must be a community oriented event (no corporate owned for-profit events here please)
  • Can't be about a specific language/framework.

Leave suggestions in the comments below

@jnothman
jnothman / fromisoformat.py
Created May 30, 2019 00:28
datetime.fromisoformat backported from Python 3.7
"""datetime.fromisoformat backported from Python 3.7
PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
--------------------------------------------
1. This LICENSE AGREEMENT is between the Python Software Foundation
("PSF"), and the Individual or Organization ("Licensee") accessing and
otherwise using this software ("Python") in source or binary form and
its associated documentation.
@timothycrosley
timothycrosley / versioning.py
Created March 11, 2016 07:00
A simple example of a hug API call with versioning
"""A simple example of a hug API call with versioning"""
import hug
@hug.get('/echo', versions=1)
def echo(text):
return text
@samatjain
samatjain / Meetup-past-events.py
Last active January 4, 2022 16:01
Dump all the previous events for a Meetup.com group. See http://blog.samat.org/2015/10/23/Getting-All-Past-Meetup-Events/
#!/usr/bin/env python3
import collections
import datetime
import pprint
import click
import jinja2
import requests
@mystal
mystal / odds.rs
Created December 22, 2021 18:19
Print odd number arguments
use std::env;
fn main() {
let odds: Vec<_> = env::args()
.skip(1)
.map(|s| s.parse::<i32>().unwrap())
.filter(|&n| n % 2 != 0)
.collect();
println!("odd numbers: {:?}", odds);
}
@thenbrent
thenbrent / _subscriptions.md
Last active November 22, 2021 05:31 — forked from mattallan/_subscriptions.md
WooCommerce Subscriptions REST API Endpoint Documentation (fork of https://gist.github.com/mattallan/fd52629eae293540c6d8)

Subscriptions

This section lists all API that can be used to create, edit or otherwise manipulate subscriptions.

Subscription Properties

Attribute Type Description
id integer Subscription ID (post ID) read-only
order_number integer Order number read-only
@scarpent
scarpent / better-twitter
Last active September 13, 2021 14:49
Better Twitter: Greasemonkey/Tampermonkey script to hide stuff you don't want to see
// ==UserScript==
// @name Better Twitter
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Remove unwanted stuff (promoted, other people's likes, ...)
// @author Scott Carpenter
// @match https://twitter.com/
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @require https://gist.githubusercontent.com/scarpent/ba8e369f1187fa990b98d1f58b2c013d/raw/9c97aa67ff9c5d56be34a55ad6c18a314e5eb548/waitForKeyElements.js
// @grant none
# http://www.gravityhelp.com/documentation/page/Web_API#Security
import time
import base64
import urllib
import requests
import json
import hmac
from hashlib import sha1