Skip to content

Instantly share code, notes, and snippets.

View ryanSN's full-sized avatar
🎧

Ryan Chatterton ryanSN

🎧
View GitHub Profile
module.exports = pivot
function pivot(recordSet) {
/*
recordSet is an array of records:
[{foo: 1311, bar: "cat", zzz: 124.31},
{foo: 41, bar: 11},
{foo: 159, bar: 41, aaa: 12, zzz: 55}]
The goal is to pivot this structure:
@ryanSN
ryanSN / almostIncreasingSequence.js
Created April 15, 2017 19:55
Javascript almost increasing sequence
function almostIncreasingSequence(sequence) {
var found = false;
for (var i=0;i<sequence.length;i++) {
if(sequence[i] <= sequence[i-1]) {
if(found) {
return false;
}
found = true;
if(i === 1 || i + 1 === sequence.length) {
@ryanSN
ryanSN / create-atom-shortcut-createfile.md
Created March 25, 2017 20:08
Atom Shortcut to create file from treeview

Atom Shortcut

use tree-view add file to shortcut as it also creates folders

'atom-workspace':
  'ctrl-n': 'tree-view:add-file'
@ryanSN
ryanSN / iterm2-cheet-sheet.md
Created February 15, 2017 14:58
iterm2-cmd-cheats

Tabs and Windows

Function Shortcut
Previous Tab + Left Arrow
Next Tab + Right Arrow
Go to Tab + Number
Go to Window + Option + Number
Go to Split Pane by Direction + Option + Arrow
Go to Split Pane by Order of Use + ] , + [
@ryanSN
ryanSN / authorApi.js
Created October 15, 2016 18:51 — forked from coryhouse/authorApi.js
Mock Author API for "Building Applications with React and Flux" on Pluralsight
"use strict";
//This file is mocking a web API by hitting hard coded data.
var authors = require('./authorData').authors;
var _ = require('lodash');
//This would be performed on the server in a real app. Just stubbing in.
var _generateId = function(author) {
return author.firstName.toLowerCase() + '-' + author.lastName.toLowerCase();
};
@ryanSN
ryanSN / backup-5-15-2017.json
Last active May 15, 2017 14:57
atom setup
{"version":1.02,"files":[{"file":".DS_Store","content":{"type":"Buffer","data":[0,0,0,1,66,117,100,49,0,0,16,0,0,0,8,0,0,0,16,0,0,0,0,135,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,2,0,0,0,1,0,0,16,0,0,97,0,103,0,101,0,115,118,83,114,110,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,8,0,112,0,97,0,99,0,107,0,97,0,103,0,101,0,115,118,83,114,110,108,111,110,103,0,0,0,1,0,0,0,7,0,115,0,116,0,111,0,114,0,97,0,103,0,101,118,83,114,110,108,111,110,103,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

Keybase proof

I hereby claim:

  • I am ryansn on github.
  • I am rchatterton (https://keybase.io/rchatterton) on keybase.
  • I have a public key whose fingerprint is CA84 5F4E 4F9A CE02 2FA3 7489 23BF 6811 F26D E4E3

To claim this, I am signing this object: