Skip to content

Instantly share code, notes, and snippets.

View dropofwill's full-sized avatar

Will Paul dropofwill

View GitHub Profile
@dropofwill
dropofwill / sass_rem_px_backup
Last active August 29, 2015 13:57
Sass mixin to use rem with px backup for older browsers.
// Set this to your root element's px size
$base_px_size: 16;
@function strip-unit($num) {
@if unitless( $num ) != true {
@return $num / ($num * 0 + 1);
}
@else {
@return $num;
@dropofwill
dropofwill / sass_scale_aspect_ratio
Created April 2, 2014 19:04
Sass mixin for scaling elements to an aspect ratio, useful for responsive background images
@function strip-unit($num) {
@if unitless( $num ) != true {
@return $num / ($num * 0 + 1);
}
@else {
@return $num;
}
}
// Shortcut for scaling elements to an aspect ratio, useful for responsive background images
/* IE 6> */
.cf {
*zoom: 1;
&:before,
&:after {
content: "";
display: table;
}
@dropofwill
dropofwill / README.md
Last active August 29, 2015 14:06
US Home Value Index

This chart uses data from Zillow Real Estate Research that combines data on home valuations and sales to get an accurate view of housing cost overtime. In this particular example I'm visualizing the top 10 most populated metro areas and the United States average.

The data from Zillow had the dates as columns, this made creating the D3 data objects a little bit more awkward than I wanted to deal with, so I wrote a simple ruby script to transpose the data to a more convenient form. I've included the original, transposed, and script for posterities sake.

Default label is on the United States average, hover over the other lines to see what cities they represent.

  • d3.csv to parse the data
  • d3.time.format to parse dates
  • d3.time.scale for the x-axis
  • d3.scale.linear for the y-axis
@dropofwill
dropofwill / serve
Last active August 29, 2015 14:06
Shell Function for Serving pwd on 0.0.0.0
# usage default port: $ serve
# custom port: $ serve 4000
function serve {
port="${1:-3000}"
ruby -run -e httpd . -p $port
}
@dropofwill
dropofwill / build_data
Last active August 29, 2015 14:06
Reported Flourishing Behaviors in Children Related to Poverty Level
require 'CSV'
require 'json'
require 'pp'
require 'descriptive_statistics'
# get the data into memory
def parse_csv
i = 0
parse = []
question_row = []
@dropofwill
dropofwill / LICENSE.txt
Last active August 29, 2015 14:15
Arduino LED Matrix Code
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.
In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRAC
@dropofwill
dropofwill / sharkcpp-0.1-1.x86_64.rpm
Last active November 23, 2023 21:20
RPM Packaging C++ program
@dropofwill
dropofwill / custom.service
Last active August 29, 2015 14:20
A sample Upstart and System.d script
[Unit]
Description=Custom Start Up Service
[Service]
ExecStartPre=/bin/mkdir -p /var/log/customprocess
ExecStartPre=/bin/touch /var/log/customprocess/custom.log
ExecStart=/var/custom_service/our_service.sh
[Install]
WantedBy=multi-user.target
upstream app_party_penguin {
server 0.0.0.0:3000;
}
server {
listen 80;
server_name penguinparty.rit.edu;
location / {
proxy_pass http://app_party_penguin;