Skip to content

Instantly share code, notes, and snippets.

@lxe
lxe / semver.sh
Last active September 18, 2022 22:16
Semver range validator in bash (using sed, grep, and bc)
#!/bin/bash
# set -x
# Stupid Simple Semver range validator
# (no build metadata and no prereleases, and no multiple ranges (||))
# Prints a list of versions that match a semver range
# ./semver.sh "range" version version version...
@mikaelbr
mikaelbr / destructuring.js
Last active April 25, 2024 13:21
Complete collection of JavaScript destructuring. Runnable demos and slides about the same topic: http://git.mikaelb.net/presentations/bartjs/destructuring
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => [1, 2, 3];
@erichonorez
erichonorez / rest_api.js
Created February 10, 2013 19:09
A simple REST API with Node.js and Express
/**
* TaskRepository class deals with task persistence
*/
function TaskRepository() {
this.tasks = [];
this.nextId = 1;
}
/**
* Find a task by id
* Param: id of the task to find
@ndarville
ndarville / business-models.md
Last active January 13, 2024 17:27
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google