View lca.py
# Definition for a binary tree node.
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
def __repr__(self):
return "TreeNode({})".format(self.val)
# see https://www.geeksforgeeks.org/lowest-common-ancestor-binary-tree-set-1/ for tips
View App.portion.js
import React, { Component } from 'react';
import { debounce } from 'lodash';
class SearchBox extends Component {
constructor(props) {
super(props);
this.state = {value: ''};
// https://stackoverflow.com/a/28046731/198348
// this.handleChange = this.handleChange.bind(this);
View App.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.diagnostics>
<trace autoflush="false" indentsize="4">
<listeners>
<remove name="Default" />
<add name="consoleListener" type="System.Diagnostics.ConsoleTraceListener"/>
</listeners>
</trace>
</system.diagnostics>
View config.cson
"*":
core:
disabledPackages: [
"spell-check"
]
telemetryConsent: "limited"
editor:
fontSize: 16
invisibles: {}
lineHeight: 1.2
View shuffle.py
import random
# import blessings
# term = blessings.Terminal()
# this looks suspiciously a lot like the fisher yates algorithm
lst = range(30)
# def colorized(lst, yellows=[]):
# result = "["
View flatten-dictionary.markdown

##Flatten a Dictionary

Given a dictionary, write a function to flatten it. Consider the following input/output scenario for better understanding:

Input:

{
  'Key1': '1',
  'Key2': {
    'a' : '2',
View app.component.ts
import { Component } from '@angular/core';
import { ROUTER_DIRECTIVES } from '@angular/router';
import { HeroService } from './hero.service';
@Component({
selector: 'my-app',
template: `
<h1>{{title}}</h1>
<a [routerLink]="['/heroes']">Heroes</a>
<router-outlet></router-outlet>
`,
View shell.session
$ clang++ -Wall --std=c++11 uninitialized.cpp -o main
$ valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes ./main
==17245== Memcheck, a memory error detector
==17245== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==17245== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==17245== Command: ./main
==17245==
==17245== Conditional jump or move depends on uninitialised value(s)
==17245== at 0x4EBFCDE: std::ostreambuf_iterator<char, std::char_traits<char> > std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::_M_insert_int<long>(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, long) const (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19)
View elevator.py
events:
- floorReached, {floor=2}
- buttonPressedInside, {floor=1}
- buttonPressedOutside, {floor=3,
direction=UP|DOWN}
def moveUp()
def moveDown()
View put.io.speedtest.txt
Default (Netherlands) 510 KB/s
Australia (Melbourne) 288 KB/s
Australia (Sydney) 290 KB/s
Brazil (São Paulo) 385 KB/s
Canada (Beauharnois, Montreal) 1436 KB/s
Canada (Toronto, Ontario) 1039 KB/s
China (Hong Kong) 293 KB/s
Czech Republic (Prague) 737 KB/s
France (Paris) 292 KB/s
France (Roubaix) 731 KB/s