Skip to content

Instantly share code, notes, and snippets.

View sophiabrandt's full-sized avatar

Sophia Brandt sophiabrandt

View GitHub Profile
function sumAll(arr) {
var min = Math.min.apply(null, arr),
max = Math.max.apply(null, arr),
newArr = [],
i;
for (i = min; i <= max; i++) {
newArr.push(i);
}
return newArr.reduce(function (a,b) {
return a+b;
@sophiabrandt
sophiabrandt / fcc_caesars_cipher_2.js
Last active March 29, 2016 10:29
Free Code Camp Basic Algorithms
function rot13(str) {
return str.split('').map(shiftLetters).join('');
function shiftLetters(letter) {
var charCode = letter.charCodeAt(0);
var shift13 = charCode + 13;
var over90 = 64 + (shift13 - 90);
return String.fromCharCode(charCode <= 64 ? charCode : shift13 > 90 ? over90: shift13);
}
@sophiabrandt
sophiabrandt / fcc_caesars_cipher_1.js
Last active March 29, 2016 10:31
Free Code Camp Basic Algorithms
function rot13(str) {
var map = Array.prototype.map;
var a = map.call(str, function(x) {
return x.charCodeAt(0);
});
var b = a.map(function(y) {
if (y > 64) {
var z = y + 13;
if (z > 90) {
return z - 26;
##! /bin/bash
# modified script for streaming on Linux via ffmpeg.
# Original see here: https://gist.github.com/oseparovic/2db2aaa737cd37e7c068
# see http://ubuntuguide.org/wiki/Screencasts for full documentation
# see http://www.thegameengine.org/miscellaneous/streaming-twitch-tv-ubuntu/
# for instructions on how to use this gist
if [ ! -f ~/.twitch_key ]; then
echo "Error: Could not find file: ~/.twitch_key"