Skip to content

Instantly share code, notes, and snippets.

@mapsam
mapsam / stickyTest
Created March 18, 2013 05:54
testing stickys and gists
$(document).ready(function(){
var fixed = false;
var topHeight = $('#header').height();
var navHeight = $('#nav').height();
var sectionHeaderHeight = $('.title').height();
var sec0 = $('#section0').height() + topHeight + navHeight;
var sec1 = $('#section1').height() + sec0 + sectionHeaderHeight;
var sec2 = $('#section2').height() + sec1 + sectionHeaderHeight;
var sec3 = $('#section3').height() + sec2 + sectionHeaderHeight;
var sec4 = $('#section4').height() + sec3 + sectionHeaderHeight;
@mapsam
mapsam / yolo_1.js
Last active December 19, 2015 19:08
yolo.js pseudo
var code,
function yolo(e) { //gets the character code of whatever the user presses, this function will be run on any keyboard press, regardless of what we want specifically
code = String.fromCharCode(e.charCode);
if (code == "35") {
specificEgg();
}
}
function specificEgg() {
@mapsam
mapsam / minmax.js
Last active December 20, 2015 04:49
Get min max of array
length = stadia.features.length;
var caps = [];
for (var mug=0; mug<length; mug++) {
var cap = stadia.features[mug].properties.capacity
caps.push(Number(cap));
}
var min = Math.min.apply(Math, caps);
var max = Math.max.apply(Math, caps);
@mapsam
mapsam / boxShadowFade.js
Last active December 20, 2015 05:18
css box-shadow fading
function init() {
$(window).scroll(function() {
top = $(window).scrollTop();
if ( top < 15 ) {
$("nav").fadeOut("fast", function() {
$(this).css('box-shadow', 'none');
});
}
else {
$("nav").fadeIn("fast", function() {
@mapsam
mapsam / README.md
Last active December 20, 2015 05:49
D3: Basemap With Topojson
@mapsam
mapsam / README.md
Last active December 20, 2015 06:09
D3: Interacting With Topojson Properties

How to access secondary information within a topojson file and render it on the webpage.

@mapsam
mapsam / README.md
Last active June 18, 2023 20:20
D3: Queue.js

A look at Queue.js and how you can load multiple files before running the rest of the code. Simple visualization of populated places in the USA. Files loaded:

  • US States - topojson
  • Populated Places - geojson
@mapsam
mapsam / README.md
Last active December 20, 2015 07:08
D3: Geographic Point Labels

Adding labels to points from a geojson

@mapsam
mapsam / README.md
Last active December 20, 2015 07:19
D3: Proportional Symbols

Proportional symbol map based on secondary data. This map shows proportional symbols based on the city populations minimum and maximum values.

@mapsam
mapsam / index.html
Last active December 20, 2015 11:29
JS Countdown Timer
<!DOCTYPE html>
<head>
<style>
body {
text-align:center;
}
#clock {
font-family:arial;
font-size:2em;
font-weight:bold;