Skip to content

Instantly share code, notes, and snippets.

View jasongrout's full-sized avatar

Jason Grout jasongrout

View GitHub Profile
@jasongrout
jasongrout / esIterTest.js
Last active April 26, 2018 15:58 — forked from sccolbert/esIterTest.js
Undefined compare slow in Firefox
// Interestingly, the compare with undefined below is about ~10x slower than the typeof compare in Firefox.
// See this by running myTiming() and myTimingUndefinedCompare()
class MyArrayIterator {
constructor(source) {
this._index = 0;
this._source = source;
}

Slides

JupyterLab update

JupyterLab is a new web-based frontend that brings together many tools in an extensible, performant, open-source environment. We announced it to be ready for users about a month ago. We are calling it "beta" since the extension developer APIs for making extensions are still evolving.

JupyterLab

This is JupyterLab. Create a new tab by clicking the + button or using the File | New menu. We can then start a notebook with a specific kernel, a console, terminal, or text editor.

diff --git a/docs/source/examples/Widget Styling.ipynb b/docs/source/examples/Widget Styling.ipynb
index 0ac7a28d..70963f81 100644
--- a/docs/source/examples/Widget Styling.ipynb
+++ b/docs/source/examples/Widget Styling.ipynb
@@ -534,8 +534,7 @@
"source": [
"from ipywidgets import Layout, Button, Box\n",
"\n",
- "items_layout = Layout(flex='1 1 auto',\n",
- " width='auto') # override the default width of the button to 'auto' to let the button grow\n",
function loop_test(data, start, trials) {
const CH_DELIMITER = ','.charCodeAt(0);
const CH_LF = 10; // \n
const CH_CR = 13; // \r
let loop_char;
let loop_i;
for (let c = 0; c<trials; c++) {
loop_i = start;
while (loop_i < 1000-2) {
loop_char = data.charCodeAt(loop_i);
@jasongrout
jasongrout / index.html
Created March 3, 2018 04:54
Benchmarking loops vs regex
<html>
<head>
<meta charset="utf-8"/>
</head>
<body>
<pre id="output"></div>
<script>
const regex = new RegExp(`[,\n\r]`, 'g');
const simpletrials = 10000000;
const out = document.getElementById('output');
function parseData(data, delimiter, useRegex) {
let len = data.length;
const CH_DELIMITER = delimiter.charCodeAt(0);
const CH_QUOTE = 34; // "
const CH_LF = 10; // \n
const CH_CR = 13; // \r
let endfield = new RegExp(`[${delimiter}\n\r]`, 'g');
const ESCAPED = 1;
const ESCAPED_FIRST_QUOTE = 2;
@jasongrout
jasongrout / index.html
Last active February 27, 2018 18:52
Image orientation demo
<html>
<head>
<style>
#box {
position:absolute;
width:400px;
height:400px;
top: 100px;
left: 100px;
border: 1px solid red;
@jasongrout
jasongrout / out.py
Last active October 26, 2017 21:16
import os
from collections import OrderedDict
from IPython.display import display
import ipywidgets as widgets
from IPython.display import clear_output
import collections
class DictTable(collections.OrderedDict):
def _repr_html_(self):
html = ["<table width=100%>"]
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.