Skip to content

Instantly share code, notes, and snippets.

@kevin-bruton
kevin-bruton / one-way-binding.js
Last active February 23, 2020 19:36
One way binding in native javascript
// data binding in native javascript:
// https://stackblitz.com/edit/databinding-native-js
// Example html:
// <span id="labelEl">default</span>: <span id="nameEl">default</span>
const setupBindings = bindings =>
bindings.reduce((acc, cur) =>
Object.defineProperty(acc, cur.bindingName, {
set: val => (cur.element[cur.attribute] = val)
const http = require('http');
const url = require('url');
const fs = require('fs');
const path = require('path');
const port = process.argv[2] || 9000;
http.createServer(function (req, res) {
console.log(`${req.method} ${req.url}`);
// parse URL
const deepCopy = aObject => {
if (!aObject) { return aObject; }
const bObject = Array.isArray(aObject) ? [] : {};
// tslint:disable-next-line: forin
for (const k in aObject) {
bObject[k] = aObject[k] === null ? null : (typeof aObject[k] === 'object') ? deepCopy(aObject[k]) : aObject[k];
}
return bObject;
};
@kevin-bruton
kevin-bruton / server.js
Created June 8, 2020 09:36 — forked from ryanoglesby08/server.js
A node.js SPA server that serves static files and an index.html file for all other routes.
/*
Incredibly simple Node.js and Express application server for serving static assets.
Given as an example from the React Router documentation (along with examples
using nginx and Apache):
- https://github.com/ReactTraining/react-router/blob/master/docs/guides/Histories.md#browserhistory
*/
const express = require('express');
const path = require('path');
@kevin-bruton
kevin-bruton / Quantopian_Lectures.md
Last active November 8, 2020 19:57 — forked from ih2502mk/list.md
Quantopian Lectures Saved
@kevin-bruton
kevin-bruton / jupyter-as-a-desktop-app.md
Created March 24, 2021 11:19 — forked from xiaolai/jupyter-as-a-desktop-app.md
Run Jupterlab as an desktop app

How to run Jupyterlab as a desktop app on Mac OSX

Tired of opening terminal to launch Jupyterlab, and having to leave it opened all the time? Try to run Jupyterlab as a desktop app:

nativefier-jupyterlab

One of a benefits is avoiding the annoying accident: "closed Jupyterlab when quitting the browser".

1. Install Anaconda for mac

Run in Terminal

@kevin-bruton
kevin-bruton / iterm2-solarized.md
Created September 22, 2021 07:50 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k