Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
<style id="jsbin-css">
#container {
width: 100%;
margin: 0 auto;
padding: 20px;
font-size: 12px;
@franvarney
franvarney / matching-braces.js
Last active June 6, 2016 00:45
Matching Braces (JavaScript)
var braces = '{()[()]}';
// var braces = '{()()]}';
// var braces = '(';
(function matchingBraces() {
if (braces.length === 1) return console.log(false);
if (!braces) return console.log(true);
var leftBraces = ['{', '(', '['];
var rightBraces = ['}', ')', ']'];
<!doctype html>
<html>
<head>
<style>
.red {
background-color: #FF0000;
}
.yellow {
background-color: #FFFF00;
<!doctype html>
<html>
<head>
<style>
.colors, #preview {
height: 50px;
width: 50px;
}
.colors:hover {
cursor: pointer;
@franvarney
franvarney / peak.js
Created May 12, 2016 19:45
getPeakUserCount
function swap (array, a, b) {
var temp = array[a]
array[b] = (array[a] = array[b], temp)
}
function makeSortedArray(x, y) {
var sorted = []
for (var i = x; i < y; ++i) sorted.push(i)
return sorted
}
//reverseVowels
//"whiteboard"
//"whatobeird"
const VOWELS = ['a','e','i','o','u'];
function isVowel(char) {
return VOWELS.indexOf(char) >= 0;
}
// Francesca
// REVERSE A STRING
const assert = require('assert');
function reverse(str) {
let output = '';
@franvarney
franvarney / task.js
Created September 21, 2017 19:49
webtask-color-describe
var TinyColor = require('tinycolor2');
var NEUTRALS = [
['BLACK', 'black', -0.01, .11],
['NEARBLACK', 'near black', .11, .2],
['GREY', 'grey', 0.2, 0.95],
['NEARWHITE', 'near white', 0.95, .99],
['WHITE', 'white', .99, 1]
];
function getInput() {
return [
['name', 'tags'],
['john',' hungry,likes_pizza'],
['maggie', 'thirsty, productmanager,likes_pizza'],
['sally', 'hungry,thirsty, somethingelse'],
['tim', 'productmanager']
];
}
/**
* Resolve an arithmetic equation.
*
* Ex. '1+3*4/22^4-11'
*
* @param {String} equation - string representation of arithmetic equation
* @return {Number} - resolved number
*/
/**