Skip to content

Instantly share code, notes, and snippets.

function retry ( promiseToRetry, maxRetries ) {
return new Promise( function ( resolve, reject ) {
promiseToRetry.then( function ( resolve ) {
resolve( result );
} ).catch( function ( e ) {
if ( maxRetries > 0 ) {
return retry( promiseToRetry, maxRetries - 1 );
} else {
reject( e )
}
@wayspurrchen
wayspurrchen / The Technical Interview Cheat Sheet.md
Last active August 29, 2015 14:28 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@wayspurrchen
wayspurrchen / git patterns.md
Last active January 18, 2023 21:38
Useful Git Techniques

History

Show file at certain commit

git show <hash>:<file>

Show history of a file

git log -p <filename>

@wayspurrchen
wayspurrchen / injector.js
Last active January 9, 2016 05:37
demo code showing how AngularJS 1.6 injectors (probably) magically inject services by name
/**
* This gist shows how you can inject other functions/variables
* into a function only by name. I imagine this is probably something
* like how AngularJS 1.6 does it, but Angular relies on an internal
* list of registered modules instead of just whatever's floating
* around the namespace, which is dangerous.
**/
// Things to inject
function LoggerOne () {
var categories = [
{
id: 0,
name: 'Shoes',
imageUrl: 'alkfaekfja0-43i'
},
{
id: 1,
name: 'Clothing',
imageUrl: 'someshit'
@wayspurrchen
wayspurrchen / npm-f3-install.sh
Created September 2, 2016 18:15 — forked from SuperPaintman/npm-f3-install.sh
NPM install for low RAM machins. And "npm install ... killed" problem
#!/bin/bash
#
# Author: SuperPaintman <SuperPaintmanDeveloper@gmail.com>
#
###
# Constants
###
RETVAL=0
@wayspurrchen
wayspurrchen / iifestrip.js
Created September 15, 2016 15:30
Strip IIFEs from files in a directory. You'll need minimist and recursive-readdir. Doesn't work on IIFEs that have args passed in
var fs = require('fs');
var path = require('path');
var recursive = require('recursive-readdir');
var argv = require('minimist')(process.argv.slice(2));
var iifepath = path.resolve(process.cwd(), argv.path);
function isIIFEStart (string) {
// whatever you don't know my life
return string === '(function () {' ||
NOTE duplicate id 1545839157538981467
https://api-staging.realmassive.com/leases?sort=-updated&page[limit]=10&page[offset]=10
{
"meta":{
"count":125317
},
"data":[
{
"relationships":{