Skip to content

Instantly share code, notes, and snippets.

@jameslockwood
jameslockwood / gist:38982732a90df71dcd5841c231842a45
Last active June 10, 2018 08:54
telephone screen interview questions
A few simple question I like to ask during initial telephone screen
interviews, over a codesharing website (e.g. codeshare.io, codebunk.com)
The aim is to get an idea of how they approach and solve problems,
and if they have a good grasp of the language. So...
- it's collaborative. they can ask for help at any time.
- ask the candidate to explain their thought processes as
they code, if possible
- it's not important that the code is perfect (i.e. it wont be tested)
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@jameslockwood
jameslockwood / redux-thunk-poll.js
Last active August 24, 2023 20:38
thunk poller - easily poll redux thunk functions
// createPollingAction() returns a thunk which continually polls, once invoked.
// subsequent invocations will cancel the previous poll queue.
const createPoller = (interval, initialDelay) => {
let timeoutId = null;
let poller = () => {};
return fn => {
window.clearTimeout(timeoutId);
poller = () => {
timeoutId = window.setTimeout(poller, interval);
@jameslockwood
jameslockwood / binary-search-tree.js
Last active May 14, 2021 02:23
Binary Search Tree algorithms
function searchBinaryTree(tree, targetValue){
if(tree === null){
return null;
}
if(tree.value === targetValue){
return tree;
}
if(targetValue < tree.value){
return searchBinaryTree(tree.left, targetValue);
} else {
@jameslockwood
jameslockwood / quicksort.js
Created November 10, 2016 18:01
Quicksort implementation using JavaScript
function quickSort(arr = []) {
if (arr.length <= 1) {
return arr;
}
let left = [], right = [], same = [];
let mid = arr[Math.floor((arr.length - 1) / 2)];
for (let value of arr) {
if (value === mid) {
same.push(value);
} else if (value < mid) {