Skip to content

Instantly share code, notes, and snippets.

osroca / index.html
Last active Sep 19, 2017
Testing BigML ( modeling and predictions with JQuery
View index.html
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>BigML Prediction Test</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<script src="" type="text/javascript"></script>
View quickSort.js
//JS QuickSort
Array.prototype.quickSort = function() {
var r = this;
if(this.length <= 1) {
return this;
var less = [], greater = [];
devknoll / gist:8b274f1c5d05230bfade
Last active Feb 19, 2019
Basic GraphQL example using the GitHub API
View gist:8b274f1c5d05230bfade
import { graphql, GraphQLString, GraphQLInt } from 'graphql';
import { objectType, enumType, schemaFrom, listOf } from 'graphql-schema';
import request from 'promisingagent';
const repositorySortEnum = enumType('RepositorySort')
.value('CREATED', 'created')
.value('UPDATED', 'updated')
.value('PUSHED', 'pushed')
.value('FULL_NAME', 'full_name')

VS Code shortcuts

  • Search text through all files at once

    • Mac: Command + Shift + f
    • Windows: Ctrl + Shift + f
  • Re-open a closed editor When you have multiple open files and accidentally close one or more of them, finding them, and re-opening can be time-consuming and a little frustrating. This is an undo feature exclusively for tabs:

    • Mac: Command + Shift + t
View web-scraper_scrape.js
import axios from 'axios';
import cherrio from 'cheerio';
async function getHTML(productURL) {
const { data: html } = await axios.get(productURL, {
headers: {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36'
.catch(function (error) {
learncodeacademy /
Last active Feb 26, 2021
Deploy HTML site with Flightplan


Install flightplan globally

npm install -g flightplan

Install flightplan in your project folder

xxxxlr / React-Native-WebView-Cookies.js
Created Jul 27, 2017 — forked from kanzitelli/React-Native-WebView-Cookies.js
React Native Trick: Get Cookies of WebView without using any native modules such as react-native-cookies. Might be helpful for getting JWT while making OAuth2 👽
View React-Native-WebView-Cookies.js
// @flow
import React, { Component } from 'react';
import {
} from 'react-native';
class LoginScreen extends Component {
state = {
cookies : {},
tleen / marvel-api-client.js
Created Mar 12, 2016
Example call to the Marvel API from js client (w/ JQuery)
View marvel-api-client.js
// you will also have to setup the referring domains on your marvel developer portal
var PRIV_KEY = "this-should-be-a-long-hash";
var PUBLIC_KEY = "so-should-this";
function getMarvelResponse() {
// you need a new ts every request
var ts = new Date().getTime();
var hash = CryptoJS.MD5(ts + PRIV_KEY + PUBLIC_KEY).toString();
zapthedingbat / logeverything.js
Created Aug 19, 2014
Log every function call to the console
View logeverything.js
(function() {
var call =; = function() {
console.log(this, arguments);
return call.apply(this, arguments);
jpopesculian /
Created Jan 25, 2016
Large Scale WebRTC Broadcast

Large Scale WebRTC Broadcast

The Problem

WebRTC is a protocol that has been standardized in recent years among major browsers like Chrome, Firefox, Opera and the Android Browsers. Plugins/Native Implementations are available on IE/Edge/Safari and iOS/Android basically providing a relatively global protocol for real time media streams. However WebRTC is a P2P protocol which means that if a user wishes to broadcast his/her video to multiple users he/she needs to individually send that broadcast to each participant. This works on a small scale, but degrades quickly on a large scale due to bandwidth deterioration.

The Solution

One possible solution is to let the user stream his/her media to a server and the server in turn splits the media streams to the subscribers. There are two technical ways to do this. A Selective Forwarding Unit (SFU) which simply forwards streams, and a Multipoint Control Unit (MCU) which essentially does the same thing but lowers bandwidth usage by packaging streams together.