Skip to content

Instantly share code, notes, and snippets.

View david-gang's full-sized avatar

David Gang david-gang

  • Lightricks
  • Jerusalem, Israel
View GitHub Profile
@callumlocke
callumlocke / README.md
Created October 26, 2015 14:38
Importing individual lodash-es functions
import chunk from 'lodash-es/array/chunk';
import zipObject from 'lodash-es/array/zipObject';

console.log(zipObject(chunk(['a', 'b', 'c', 'd'], 2)));
$ rollup -f=iife demo.js > output.js
@staltz
staltz / introrx.md
Last active July 19, 2024 22:21
The introduction to Reactive Programming you've been missing
@joyrexus
joyrexus / README.md
Last active June 27, 2024 15:39
Node.js streams demystified

A quick overview of the node.js streams interface with basic examples.

This is based on @brycebaril's presentation, Node.js Streams2 Demystified

Overview

Streams are a first-class construct in Node.js for handling data.

Think of them as as lazy evaluation applied to data.

@wilsonwc
wilsonwc / stateMock.js
Created January 10, 2014 17:24
Angular Mock for properly resolving ui-router $state in Karma unit tests
angular.module('stateMock',[]);
angular.module('stateMock').service("$state", function($q){
this.expectedTransitions = [];
this.transitionTo = function(stateName){
if(this.expectedTransitions.length > 0){
var expectedState = this.expectedTransitions.shift();
if(expectedState !== stateName){
throw Error("Expected transition to state: " + expectedState + " but transitioned to " + stateName );
}
}else{
@mgodave
mgodave / gist:7646319
Last active April 3, 2019 08:41
Create a single value Observable from a Guava ListenableFuture.
public static <T> Observable<T> create(ListenableFuture<T> future, Executor executor) {
AsyncSubject<T> subject = AsyncSubject.create();
future.addListener(() -> {
try {
T value = future.get();
subject.onNext(value);
subject.onCompleted();
} catch (Exception e) {
subject.onError(e);
}

Moved

Now located at https://github.com/JeffPaine/beautiful_idiomatic_python.

Why it was moved

Github gists don't support Pull Requests or any notifications, which made it impossible for me to maintain this (surprisingly popular) gist with fixes, respond to comments and so on. In the interest of maintaining the quality of this resource for others, I've moved it to a proper repo. Cheers!

@bradmontgomery
bradmontgomery / dummy-web-server.py
Last active June 11, 2024 08:36
a minimal http server in python. Responds to GET, HEAD, POST requests, but will fail on anything else.
#!/usr/bin/env python
"""
Very simple HTTP server in python (Updated for Python 3.7)
Usage:
./dummy-web-server.py -h
./dummy-web-server.py -l localhost -p 8000
Send a GET request: