Skip to content

Instantly share code, notes, and snippets.

View jdrury's full-sized avatar

James Drury jdrury

View GitHub Profile
@jdrury
jdrury / maxContig
Created May 8, 2014 19:12
maximum contiguous sum
function add (collection){
var sum = 0;
collection.forEach(function(number) {
sum += number;
});
return sum;
}
function maxContig (collection){
var sum = 0;
@jdrury
jdrury / compression
Created May 8, 2014 22:27
compress string
var compress = function(str){
var compressed = "";
var previous = "";
var count = 1;
var last = str.length - 1;
sorted = str.split('').sort();
@jdrury
jdrury / jdQuery
Last active August 29, 2015 14:01
DOM traversing element selector
var $ = function (selector) {
var tree = traverse(document.body.children);
var search = format(selector);
var labels = ['nodeName', 'className', 'id'];
var elements = [];
var match;
tree.forEach(function(node) {
match = true;
search.forEach(function(query, i) {
@jdrury
jdrury / gist:a88988940eeeb624d613d188b84e6f9e
Created September 5, 2017 15:47
bash script to show git branches by date
for k in `git branch|perl -pe s/^..//`;do echo -e `git show --pretty=format:"%Cgreen%ci %Cblue%cr%Creset" $k|head -n 1`\\t$k;done|sort -r
{
"count": 87,
"next": "https://swapi.co/api/people/?page=2",
"previous": null,
"results": [
{
"name": "Luke Skywalker",
"height": "172",
"mass": "77",
"hair_color": "blond",
@jdrury
jdrury / ws-coding-challenge.md
Last active July 2, 2018 14:35
WorkStride FE Coding Challenge

WorkStride Coding Challenge

Objective

Create a master-detail view using the Star Wars API.

Requirements