Skip to content

Instantly share code, notes, and snippets.

@amadden80
amadden80 / gist:27042d82d9c3a8bab229
Last active August 29, 2015 14:17
Messing with NYT
function randomColor() {
red = Math.floor(Math.random()*255);
green = Math.floor(Math.random()*255);
blue = Math.floor(Math.random()*255);
return 'rgb('+red+','+green+','+blue+')';
}
function messingWithArticles(){
var articles = document.body.getElementsByTagName('article');
for (var i=0; i<articles.length; i++){
@amadden80
amadden80 / gist:9f2c2e88332be53653f3
Created March 26, 2015 17:24
Swappin The Images
var pics = document.getElementsByTagName('img');
for (var i=0; i<pics.length; i++){
pics[i].src = 'http://wdi-woodstock.com/sass.jpg';
}
while true; do clear; tree; sleep 1; done
@amadden80
amadden80 / SinatraSignUp.sh
Last active August 29, 2015 14:21
Quick Sinatra... SignUp App
model_Name="Rainbow"
model_name="rainbow"
db_name="i_am_a_rainbow"
table_name="rainbows"
# ONLY EDIT ABOVE HERE...
# Styles
mkdir public
@amadden80
amadden80 / installfest.sh
Last active August 29, 2015 14:24
Dev-Environment
#!/usr/bin/env bash
while getopts "vf" FLAG; do
case $FLAG in
f ) FORCE=true;;
v ) VERBOSE=true;;
? ) exit 2;;
esac
done
@amadden80
amadden80 / gist:1890f950f6b5a4dc9799
Last active September 6, 2015 18:00
Installing Fixes
#rbenv install ruby with yosemite ruby build error: Using clang rbenv install
CONFIGURE_OPTS=--with-gcc=clang rbenv install 2.2.2
#Nokogiri
brew update
brew install libiconv
brew link libiconv
brew install libxml2
brew link libxml2 --force
function isPrime(n){
for(var i=2; i<n; i++){
if(n%i===0){
return false;
}
}
return true;
}
// 1. Write a function that changes the background color of a website
function changeBackground(){
// 2. Write an array of color strings
var colors = ['red', 'green', 'orange', 'purple', 'blue'];
// 3. Have your color change function randomly select one of the colors from that array
var colorChoice = colors[ Math.floor( Math.random() * colors.length ) ];
# awesome print
begin
require "awesome_print"
AwesomePrint.pry!
rescue LoadError => e
puts "ap gem not found."
if ( ENV['RAILS_ENV'] || defined? Rails )
puts "Try adding awesome_print to your Gemfile"
else
puts "Try typing 'gem install awesome_print' to get super-fancy output."
echo "export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.4/bin" >> ~/.bash_profile