Skip to content

Instantly share code, notes, and snippets.

@hankyates
hankyates / stringDelimiter.js
Created April 9, 2014 06:10
Javascript implementation of a string delimiter
// Write a function that takes in a string seperated by a seperator, and will return an array
// of strings in between the seperators.
var sampleInput = 'asdf$lskd1234$asdo';
stringDelemiter(sampleInput, '$');
// -> ['asdf', 'lskd1234', 'asdo']
// Implement a decorator function that takes
// a function as an argument and will track
// how many times the passed function was called.
function Add(x, y) {
return x + y;
}
var Add = countDecorator(Add);
// Given the following data structure
// implement a oldestLivingFather method
// that will return the name of the oldest
// living father.
var people = [
{
name: 'Hank',
age: 29,
father: 'Don'
@hankyates
hankyates / xor.js
Last active August 29, 2015 13:57
Code Fellows XOR
// Implement an exclusive OR function called `preferredName` that has the following interface:
var FirstName,
LastName;
preferredName(FirstName, LastName);
// -> false
FirstName = 'Hank';
<% _.forEach(projects, function (project) {%>
.<%= project.name %> {
background-img: url('img/projects/<%= project.img %>');
<% }); %>