Skip to content

Instantly share code, notes, and snippets.

James Lockwood jameslockwood

View GitHub Profile
@jameslockwood
jameslockwood / gist:38982732a90df71dcd5841c231842a45
Last active Jun 10, 2018
telephone screen interview questions
View gist:38982732a90df71dcd5841c231842a45
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)
View init.coffee
# 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 Mar 26, 2020
thunk poller - easily poll redux thunk functions
View redux-thunk-poll.js
// 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 Nov 12, 2016
Binary Search Tree algorithms
View binary-search-tree.js
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 Nov 10, 2016
Quicksort implementation using JavaScript
View quicksort.js
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) {
You can’t perform that action at this time.