Skip to content

Instantly share code, notes, and snippets.

// Setup
var assignments = [];
var _ = require('underscore');
function pluckUnique(arrayOfObj, key) {
var pluckedValues = {};
arrayOfObj.forEach(function(obj) {
var valAtKey = obj[key];
if (pluckedValues[valAtKey]) {
pluckedValues[valAtKey]++;

Problem

When an assignment is created on the schedule, a suggested time entry is created for each day in the assignment. The budget graphs in the sidebar are based on data from a reports endpoint that calculates future scheduled and budget. These graphs rely on the suggestions being fully created before calculations will be accurate. So, at what point can we know with certainty that the requisite data has been created before attempting to re-render the graphs?

Cost scale: 1-5. 1=low, 5=high

Solution 1: Poll assignments endpoint

Overview: When an assignment is created, determine the number of expected time entries to be created. Then poll the assignments show endpoint (e.g., /api/v1/projects/1234?with_suggestions=true). When the number of suggestions matches the expected, re-render the graphs.

export const RESULTS_POLLING = 'RESULTS_POLLING';
const setPolling = val => ({ type: RESULTS_POLLING, pollingType: val });
export const SET_POLLING_DURATION = 'SET_POLLING_DURATION';
const setPollingDuration = (val, count, dates) => (
{ type: SET_POLLING_DURATION, duration: val, count, dates }
);
export const INCREMENT_POLL_COUNT = 'INCREMENT_POLL_COUNT';
const incrementPollCount = () => ({ type: INCREMENT_POLL_COUNT });

Explain and Implement a Queue

A queue is a common data structure that is often used in computer science.

  1. In your own words (300-500 words will suffice), explain–in your own words–what a queue is, what its uses are, common properties of queues.
  2. Implement a queue in your language of choice. It should have the following methods:
  3. enqueue: place an item into the queue, return the queue
  4. dequeue: take the appropriate item off of the queue, return the queue
  5. peek: return the first item from the queue, but do not remove it
  6. size: the number of items in the queue

Find Availability Problem

Given:

  • An array of work hours [0,8,8,8,8,8,0] where the elements represent the number of work hours per day in a normal work week, starting from Sunday (day 0 of the week)
  • A list of employees like {1,Mark Virtue} with an id and name, and optionally employee-specific overrides to the normal work week

Implement:

A find_available_work_hours method with the signature find_available_work_hours(user_id, from, to) that outputs a list of available work hours for each date in the given date range from..to (inclusive).

const http = require('http');
const querystring = require('querystring');
const data = {
is_admin: true,
default_hourly_rate: 100,
email: 'foo@bar.com',
first_name: 'Nick',
last_name: 'Cox',
created_at: '2016-09-27 18:37:07',
{
"countries":[{"id":3,"iso_code":"BI","name":"Burundi","created_at":"2011-12-01T21:37:48.627Z","updated_at":"2012-04-24T13:13:34.622Z","region_id":3,"is_surveyed":false},{"id":11,"iso_code":"DJ","name":"Djibouti","created_at":"2011-12-01T21:37:49.425Z","updated_at":"2011-12-01T21:37:49.425Z","region_id":null,"is_surveyed":false},{"id":12,"iso_code":"DZ","name":"Algeria","created_at":"2011-12-01T21:37:49.526Z","updated_at":"2011-12-01T21:37:49.526Z","region_id":null,"is_surveyed":false},{"id":13,"iso_code":"EG","name":"Egypt","created_at":"2011-12-01T21:37:49.626Z","updated_at":"2011-12-01T21:37:49.626Z","region_id":null,"is_surveyed":false},{"id":14,"iso_code":"EH","name":"Western Sahara","created_at":"2011-12-01T21:37:49.725Z","updated_at":"2011-12-01T21:37:49.725Z","region_id":null,"is_surveyed":false},{"id":19,"iso_code":"GM","name":"Gambia","created_at":"2011-12-01T21:37:50.222Z","updated_at":"2011-12-01T21:37:50.222Z","region_id":null,"is_surveyed":false},{"id":26,"iso_code":"LY","name":"Libya","creat
import McFly from 'mcfly';
const Flux = new McFly();
import WeekStore from './week_store.js';
let _blocks = {};
let _persisted = {};
let _trainingModule = {};
let _editableBlockIds = [];
let _editingAddedBlock = false;
package main
import "fmt"
type Person struct {
name string
}
func mutateWithRange(people []Person) {
for _, person := range people {

Seeking a member of an underrepresented community in tech to mentor

One of my goals in 2016 is to develop a mentorship with a person from an underrepresented community in tech. To that end, I’m opening up office hours. Here’s what that will look like.

I’m looking for someone who could use a mentor in programming or software engineering. Ideally, this person would be looking to get into web development (or related technologies) or just starting their career. This relationship would ideally last from the end of January 2016 for a 4-6 month period. To this bourgeoning developer, I’ll be available – completely free of cost – for a 1-1.5 hour period each week to look over code samples, pair program, give practical programming advice, do mock interviews, or whatever they believe they need the most help with. (Ideally, this schedule would be somewhat flexible, given that I have a 10-month-old at home.)

Here are a list of ideas to get you thinking, separated by topic. This list is by no means exhaustive. If you’