Skip to content

Instantly share code, notes, and snippets.

@achisholm
achisholm / JS: Hello World
Created February 17, 2014 21:30
The most basic of JavaScript programs.
var i = 0;
while (i < 999) {
console.log("Hello World!");
i++;
}
@achisholm
achisholm / _reset.scss
Last active August 29, 2015 13:56
The littlest reset
// My Super Minimal CSS Reset | Credit due to Eric Meyer + Nicolas Gallagher | http://meyerweb.com/eric/tools/css/reset/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
$(window).scroll(function() {
var scroll = $(window).scrollTop();
if (scroll >= 80) {
$(".nav").addClass("is-scrolled");
} else {
$(".nav").removeClass("is-scrolled");
}
});
@achisholm
achisholm / gist:10975113
Created April 17, 2014 11:18
Fixing Google Maps borked controls
img{
max-width:100%;
height:auto;
}
.map_canvas img {
max-width: none;
}
@achisholm
achisholm / gist:11184118
Created April 22, 2014 15:42
CSS truncating one-line text headings
%truncate {
width: 100px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
// Write a function that adds from two invocations.
function addf(x){
return function(y){
return x + y;
}
}
console.log(addf(3) (4));
// Write a function that takes a binary function, and makes it callable with two invocations.
function mul(x, y){
return x * y;
}
function applyf(binary){
return function (x) {
return function (y) {
return binary(x, y);
// Write a function that takes a function and an argument, and returns a function that can supply a second argument.
function add(x,y){
return x + y;
}
function mul(x,y){
return x * y;
}
function curry(a,b){
@achisholm
achisholm / gist:6ccdd02478ad2e46e02d
Created May 13, 2014 07:31
Exercise in summing
// http://www.codewars.com/kata/52cd0d600707d0abcd0003eb/train/javascript
// Test Failed: maximumSum with n>values.length not working as expected
var values = [5, 4, 3, 2, 1];
function minimumSum(values, n){
values.sort();
var total = 0;
for (var i = 0; i < n; i++) {
total += values[i];
ZE2 9AW - Perrie Beanie's, Skaw, Shetland
M1 5AN - Manchester
W13 8DL - The Duke of Kent, London