Skip to content

Instantly share code, notes, and snippets.

View togakangaroo's full-sized avatar

George Mauer togakangaroo

View GitHub Profile
import { expect } from 'chai'
describe(`Given a stopwatch`, () => {
let sw
beforeEach(() => sw = createStopWatch())
it(`shows nothing on main display`, () => expect(sw.displays.main).to.equal(null))
it(`shows no laps`, () => expect(sw.displays.laps).to.deep.equal([]))
})

Greatest Common Divisor of Strings

From the Operation Code Slack

Problem statement:

For strings S and T, we say “T divides S” if and only if S = T + ... + T  (T concatenated with itself 1 or more times)
Return the largest string X such that X divides str1 and X divides str2.
```
Input: str1 = "ABCABC", str2 = "ABC"
@togakangaroo
togakangaroo / daily programmer gcd of strings.html
Created October 14, 2019 17:32
an example of doing an op-code #daily-programmer challenge with literate coding
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2019-10-14 Mon 12:29 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>&lrm;</title>
<meta name="generator" content="Org mode" />
<style id="jsbin-css">
ul {
list-style-type: none;
padding: 0;
display: inline-flex;
font-size: 50px;
outline: 1px solid red;
width: 5em;
overflow: hidden;
}
https://lists.w3.org/Archives/Public/www-talk/
http://1997.webhistory.org/www.lists/www-talk.1993q1/
https://eager.io/blog/the-languages-which-almost-were-css/
https://eager.io/blog/to-what-extent-did-marc-andreessen-invent-the-internet/
https://www.w3.org/Style/LieBos2e/history/
https://www.w3.org/People/Raggett/book4/ch02.html
http://alistapart.com/article/a-brief-history-of-markup
http://www.wired.com/2008/09/history_of_img_and_embed_tags/
http://home.snafu.de/tilman/mozilla/stomps.html
http://www.snee.com/bobdc.blog/2012/01/a-brief-opinionated-history-of.html
<style id="jsbin-css">
section {
overflow: hidden;
background-color: teal;
height: calc(5 * 2.6ex);
line-height: 2.6ex;
}
section p {
float: right;
margin: 0;
const CompactOrder = (props) => (
<section class="order" onclick={() => props.select(props.item) }>
<p>{props.item.name}</p>
</section>
)
class OrderList {
_constructor () {
window.console = skewer
var createCounter = (startVal = 0) => {
let state = startVal
return {
next: () => {
if(state < (10 + startVal))
return {value: state+=1}
return {done: true}
}
var createCounter = (startVal = 0) => {
let state = startVal
return {
next: () => {
if(state < (10 + startVal))
return {value: state+=1}
return {done: true}
}
}
}
var createCounter = (startVal = 0) => {
let state = startVal
return {
next: () => {
if(state < (10 + startVal))
return {value: state+=1}
return {done: true}
}
}
}