Skip to content

Instantly share code, notes, and snippets.

View theverything's full-sized avatar
🙂
Writing code

Jeffrey Horn theverything

🙂
Writing code
View GitHub Profile
@theverything
theverything / gist:5737286
Created June 9, 2013 01:50
reverse an array
array = []
100.times { |i| array << i }
def my_reverse(array = [])
size = array.size
b = array.dup
b.reverse_each do |i|
b << i
end
b.drop(size)
@theverything
theverything / states.rb
Last active December 18, 2015 12:58 — forked from dblandin/states.rb
states = Array[ ["AK", "Alaska"],
["AL", "Alabama"],
["AR", "Arkansas"],
["AZ", "Arizona"],
["CA", "California"],
["CO", "Colorado"],
["CT", "Connecticut"],
["DC", "District of Columbia"],
["DE", "Delaware"],
["FL", "Florida"],
@theverything
theverything / gist:6513013
Created September 10, 2013 17:51
United States SVG
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="959" height="593">
<style type="text/css">
.state {
fill:#d3d3d3;
stroke:#fff;
stroke-width:0.75;
stroke-opacity:1;
}
@theverything
theverything / money_to_string.js
Last active January 4, 2016 13:09
JavaScript Module to convert a decimal dollar amount to its english string equivalent
var moneyToString = (function () {
var doubleDigits = {
"2": "twenty",
"3": "thirty",
"4": "fourty",
"5": "fifty",
"6": "sixty",
"7": "seventy",
"8": "eighty",
"9": "ninty"
//Prepare greeting
var today = new Date();
if (today.getDay()==0) day="Sunday";
if (today.getDay()==1) day="Monday";
if (today.getDay()==2) day="Tuesday";
if (today.getDay()==3) day="Wednesday";
if (today.getDay()==4) day="Thursday";
if (today.getDay()==5) day="Friday";
if (today.getDay()==6) day="Saturday";
if (today.getMonth()==0) month="January";
@theverything
theverything / grid.css
Last active August 29, 2015 14:04
12 Column Super Simple Grid
*, *:before, *:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box; }
.container {
position: relative;
width: 1100px;
padding-right: 15px;
padding-left: 15px;
var lastScroll = 0;
function onScroll(e) {
lastScroll = window.pageYOffset;
}
window.addEventListener('scroll', onScroll, false);
function NoClickDelay(el) {
if ('ontouchstart' in window) {
this.element = typeof el === "object" ? el : document.getElementById(el);
this.element.addEventListener('touchstart', this, false);
@theverything
theverything / fig_install.sh
Last active August 29, 2015 14:05
install fig
# Install fig
apt-get update
apt-get install -y python-pip
pip install -U fig
# Configure Docker
echo "\nDOCKER_OPTS=\"-H tcp://127.0.0.1:4243 -H unix:///var/run/docker.sock\"" >> /etc/default/docker
echo "\nexport DOCKER_HOST=tcp://localhost:4243" >> ~/.bashrc
source ~/.bashrc
@theverything
theverything / objEdit.js
Created January 20, 2015 01:17
object edit
function edit(obj, key, value) {
if (!key) return obj;
var keys = key.split('.');
return keys.reduce(function (prev, next, i) {
if (keys.length === i + 1 && value !== undefined) {
prev[next] = value;
return obj;
} else {
@theverything
theverything / ad.js
Last active August 29, 2015 14:17
ad
// MIT License
var $ad = jQuery("<div>", {id: "ad"});
$ad.css('border', 'solid').css('height', '100px');
jQuery($ad).insertAfter("p:nth-child(3)");