Skip to content

Instantly share code, notes, and snippets.

View 5nyper's full-sized avatar
☪️
Focusing

Snyper 5nyper

☪️
Focusing
View GitHub Profile
@mkhl
mkhl / Makefile
Created July 31, 2009 21:44
Small and generic Makefile skeleton
PROJECT=foo
SOURCES=bar.c baz.c
LIBRARY=nope
INCPATHS=../some_other_project/
LIBPATHS=../yet_another_project/
LDFLAGS=-ldosomething
CFLAGS=-c -Wall
CC=gcc
# ------------ MAGIC BEGINS HERE -------------
@mitsuoka
mitsuoka / MIME.dart
Last active November 11, 2022 12:43
Dart WebSocket chat server and client samples
library MIME;
// get MIME type (returns null if there is no such extension)
String mimeType(String extension) => _mimeMaps[extension];
// default MIME type mappings
Map _mimeMaps = const {
'abs': 'audio/x-mpeg',
'ai': 'application/postscript',
'aif': 'audio/x-aiff',
@joepie91
joepie91 / .js
Created July 19, 2015 03:35
Promise flattening
Promise.try(function(){
return outerThingOne();
}).then(function(value){
return Promise.try(function(){
return innerThingOne();
}).then(function(subValue){
return innerThingTwo(subValue);
});
}).then(function(result){
return outerThingThree(result);
@joepie91
joepie91 / promises-reading-list.md
Last active June 25, 2023 09:12
Promises (Bluebird) reading list

Promises reading list

This is a list of examples and articles, in roughly the order you should follow them, to show and explain how promises work and why you should use them. I'll probably add more things to this list over time.

This list primarily focuses on Bluebird, but the basic functionality should also work in ES6 Promises, and some examples are included on how to replicate Bluebird functionality with ES6 promises. You should still use Bluebird where possible, though - they are faster, less error-prone, and have more utilities.

I'm available for tutoring and code review :)

You may reuse all gists for any purpose under the WTFPL / CC0 (whichever you prefer).

@vasanthk
vasanthk / System Design.md
Last active July 30, 2024 00:17
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?