Skip to content

Instantly share code, notes, and snippets.

View merge-sorted-array-inputs.txt
[0], 0
[1], 1
[1], 1
[0], 0
[1,2,3,0,0,0], 3
[4,5,6], 3
[4,5,6,0,0,0], 3
View 2019.05.04.binary.strings.js
function numToBinaryString(num, padding=8) {
const n = num.toString(2);
const paddedString = "0".repeat(padding);
return paddedString.substr(n.length) + n;
}
for (let i = 0; i < 20; i++){
console.log(i, numToBinaryString(i));
}
@shurane
shurane / .gitignore
Last active Apr 5, 2019
2019.04.04.pinterest.api
View .gitignore
*.log
package-lock.json
node_modules/
secrets.js
View related.txt
@shurane
shurane / ElasticSearchRequests.cs
Created Apr 8, 2018
Working with a dataset with ElasticSearch and C#
View ElasticSearchRequests.cs
using System;
using System.Net.Http;
using System.Web;
namespace ElasticSearchRequests
{
class Program
{
static void Main(string[] args)
{
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>
@shurane
shurane / config.cson
Last active Jan 13, 2017
Atom Editor Configs
View config.cson
"*":
core:
disabledPackages: [
"spell-check"
]
telemetryConsent: "limited"
editor:
fontSize: 16
invisibles: {}
lineHeight: 1.2