A complete list of RxJS 5 operators with easy to understand explanations and runnable examples.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void eqish(f1, f2) { | |
| static float e = 1.0e-nf; // where n is the precision | |
| return abs((f1 - f2) < e); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def sort(s): | |
| for i in range(len(s) - 1): | |
| j = len(s) - 1 | |
| while j > i: | |
| if s[i] > s[j]: | |
| s[i], s[j] = s[j], s[i] | |
| j -= 1 | |
| return s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env node | |
| const fs = require("fs"); | |
| const path = process.argv.pop(); | |
| const code = fs.readFileSync(path, "utf8"); | |
| const lines = code.split("\n"); | |
| const ret = JSON.stringify(lines, null, 2); | |
| process.stdout.write(ret); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function findClosest(haystack, needle, comp, lo, hi) { | |
| var mid, cmp; | |
| lo = lo || 0; | |
| hi = hi || haystack.length - 1; | |
| while(lo <= hi) { | |
| mid = lo + (hi - lo>>1); | |
| cmp = comp(haystack[mid], needle); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from binascii import a2b_base64 as b64decode, b2a_base64 as b64encode | |
| a, b = 13, 7 | |
| PUB = 5 | |
| PRIV = 29 | |
| MAX = a * b | |
| def cycleBit(v, c, m): | |
| v2 = v | |
| for i in range(c - 1): |
I hereby claim:
- I am en0 on github.
- I am irlaird (https://keybase.io/irlaird) on keybase.
- I have a public key ASCzVEanCrduuo0vHWY1xnGAneMkHGIkA5UdakQnwzvsuQo
To claim this, I am signing this object:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| ### BEGIN INIT INFO | |
| # Provides: etcd | |
| # Required-Start: $local_fs $remote_fs $network $syslog | |
| # Required-Stop: $local_fs $remote_fs $network $syslog | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 | |
| # Short-Description: Init for etcd | |
| # Description: etcd 2.0 distributed key-value store | |
| ### END INIT INFO |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Look for existing instances | |
| CID=$(docker ps -a -f name=$CNAME -q) | |
| if [ ! -z "${CID}" ] | |
| then | |
| # Determin if the instance is already running | |
| IS_RUNNING=$(docker inspect --format='{{.State.Running}}' $CID) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/usr/env python2 | |
| from scapy.all import * | |
| from argparse import ArgumentParser | |
| from sys import argv | |
| from time import time | |
| # shut up scapy | |
| conf.verb=0 |