This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
states = Array[ ["AK", "Alaska"], | |
["AL", "Alabama"], | |
["AR", "Arkansas"], | |
["AZ", "Arizona"], | |
["CA", "California"], | |
["CO", "Colorado"], | |
["CT", "Connecticut"], | |
["DC", "District of Columbia"], | |
["DE", "Delaware"], | |
["FL", "Florida"], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var moneyToString = (function () { | |
var doubleDigits = { | |
"2": "twenty", | |
"3": "thirty", | |
"4": "fourty", | |
"5": "fifty", | |
"6": "sixty", | |
"7": "seventy", | |
"8": "eighty", | |
"9": "ninty" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*, *: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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MIT License | |
var $ad = jQuery("<div>", {id: "ad"}); | |
$ad.css('border', 'solid').css('height', '100px'); | |
jQuery($ad).insertAfter("p:nth-child(3)"); |
OlderNewer