Skip to content

Instantly share code, notes, and snippets.

View joonassandell's full-sized avatar

Joonas Sandell joonassandell

View GitHub Profile
@joonassandell
joonassandell / SassMeister-input.scss
Last active September 14, 2015 12:50 — forked from pascalduez/SassMeister-input.scss
Some Sass string functions: capitalize, ucwords, camelize, ...
// ----
// Sass (v3.3.4)
// Compass (v1.0.0.alpha.18)
// ----
// Capitalize string
// --------------------------------------------------------------------------------
// @param [string] $string
// --------------------------------------------------------------------------------
// @return [string]
@joonassandell
joonassandell / JS: Closest number
Last active September 13, 2016 14:38 — forked from vipickering/closestNumberArray.js
Find closest number in ES6
const closestNumber = (array, num) => {
const i = 0;
let minDiff = 1000;
let ans;
for (i in array){
const m = Math.abs(num - array[i]);
if (m < minDiff) {
minDiff = m;