Skip to content

Instantly share code, notes, and snippets.

@easyrider
easyrider / package-lock.json
Created May 1, 2018 13:26 — forked from fcecagno/package-lock.json
kurento_pipelines
{
"name": "kurento-hello-world",
"version": "6.6.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"bower": {
"version": "1.8.2",
"resolved": "https://registry.npmjs.org/bower/-/bower-1.8.2.tgz",
"integrity": "sha1-rfU1KcjUrwLvJPuNU0HBQZ0z4vc=",
@easyrider
easyrider / vanilla-js-cheatsheet.md
Created April 21, 2018 19:23 — forked from thegitfather/vanilla-js-cheatsheet.md
Vanilla JavaScript Quick Reference / Cheatsheet
@easyrider
easyrider / filterArraysRamda.md
Created April 12, 2018 12:01 — forked from cezarneaga/filterArraysRamda.md
Filter array of objects by nested values using ramda: Sometimes you dont have access to backend and you want to filter the response from an endpoint based on certain criteria. While trivial on flat arrays, this gets a bit tricky if the property you want to query is deeply nested. This is where Ramda shines.

Say we have a prop.users of the shape:

const users = [
    {username: 'bob', age: 30, tags: [{name: 'work', id: 1}, {name: 'boring', id: 2}]},
    {username: 'jim', age: 25, tags: [{name: 'home', id: 3}, {name: 'fun', id: 4}]},
    {username: 'jane', age: 30, tags: [{name: 'vacation', id: 5}, {name: 'fun', id: 4}]}
];
@easyrider
easyrider / app.js
Created March 5, 2018 13:54 — forked from pgasiorowski/app.js
Kurento Player to WebRTC pipeline
var kurento = require('kurento-client');
var express = require('express');
var app = express();
var path = require('path');
var wsm = require('ws');
app.set('port', process.env.PORT || 8080);
/*
* Definition of constants
@easyrider
easyrider / Rinkeby.md
Created January 30, 2018 17:42 — forked from learner-long-life/Rinkeby.md
How to get on Rinkeby Testnet in less than 10 minutes

How to get on Rinkeby Testnet in less than 10 minutes

Following instructions from the excellent https://www.rinkeby.io/

Synchronizing a Full Node

A full node lets you access all state. There is a light node (state-on-demand) and wallet-only (no state) instructions as well,

import requests
import sys
import json
def waybackurls(host, with_subs):
if with_subs:
url = 'http://web.archive.org/cdx/search/cdx?url=*.%s/*&output=json&fl=original&collapse=urlkey' % host
else:
url = 'http://web.archive.org/cdx/search/cdx?url=%s/*&output=json&fl=original&collapse=urlkey' % host
import requests
import re
import sys
from multiprocessing.dummy import Pool
def robots(host):
r = requests.get(
'https://web.archive.org/cdx/search/cdx\
?url=%s/robots.txt&output=json&fl=timestamp,original&filter=statuscode:200&collapse=digest' % host)
import sys
def to_octets(ip):
return [int(i) for i in ip.split('.')]
def dotless_decimal(ip):
octets = to_octets(ip)
result = octets[0] * 16777216 + octets[1] * \
@easyrider
easyrider / bfs.js
Created August 24, 2017 13:07 — forked from Dammmien/bfs.js
Breadth First Search (BFS) Graph Traversal in Javascript
var nodes = [
{
links: [ 1 ], // node 0 is linked to node 1
visited: false
}, {
links: [ 0, 2 ], // node 1 is linked to node 0 and 2
path: [],
visited: false
},
...
@easyrider
easyrider / binary-search.js
Created August 24, 2017 09:28 — forked from kidGodzilla/binary-search.js
Fast Binary Search in JavaScript, unminified
function(array, value) {
var j = 0, length = array.length;
// A for loop was used to save space. More easily understood as a while loop. Exits if our pointer moves out of range.
while (j < length) {
var i = (length + j - 1) >> 1; // move the pointer to the median value using a shift in place of Math.floor() (to save characters)
// If the value we're searching for is greater than the median, move our lower-bound past the median
if (value > a[i])
j = i + 1;
// Otherwise, if the value we're searching for is less than the median, move our upper-bound to the median value
else if (value < array[i])