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 / guardian-top-100.md
Last active February 27, 2023 21:28
The Guardian's 100 greatest novels of all time: The list

Top 100 Novels

1. Don Quixote Miguel De Cervantes

The story of the gentle knight and his servant Sancho Panza has entranced readers for centuries.

2. Pilgrim's Progress John Bunyan

The one with the Slough of Despond and Vanity Fair.

3. Robinson Crusoe Daniel Defoe

The first English novel.

@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];