Skip to content

Instantly share code, notes, and snippets.

View xander-miller's full-sized avatar

Xander Miller xander-miller

View GitHub Profile
def add_item!(item, list)
list << item unless list.include?(item)
list
end
def remove_item!(item, list)
list.delete(item)
list
end
@xander-miller
xander-miller / 1loopy.rb
Last active August 29, 2015 14:08
1loopy.rb
class ArrayModifier
attr_reader :array
def initialize(array)
@array = array
end
def exclaim
new_array = []
class President
attr_accessor :name, :age
def initialize(name, age)
@name, @age = name, age
end
def citizenship
self.class.citizenship
end
class ArrayModifier
attr_reader :array
def initialize(array)
@array = array
end
def exclaim
new_array = []
@xander-miller
xander-miller / sublime_setup.sh
Last active August 29, 2015 14:07
Setup Sublime Text 2 to work from the command line in OSX
mkdir ~/bin
touch ~/.bash_profile
echo 'export PATH="~/bin:$PATH"' >> ~/.bash_profile
echo "export EDITOR='subl -w'" >> ~/.bash_profile
ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl
source ~/.bash_profile
def save_with_initial_vote
ActiveRecord::Base.transaction do
saved = self.save
self.create_vote
saved
end
end
@xander-miller
xander-miller / guessing_game_after_solution.py
Last active August 29, 2015 14:06
I know this is very basic, but I'm super proud of my first python program in 5 years.
import random
def show_guesses():
guesses.append(guess)
print(str(guesses) + " {} more out of 5.".format(5 - len(guesses)))
def show_help():
print("Guess a number between '1' and '10'")
print("'DONE' quits and 'HELP' displays this help.")
@xander-miller
xander-miller / next_level.html
Last active August 29, 2015 14:05
Reinventing Awesome Design!
<style type="text/css">
.html-marquee {
height:200px;
width:400px;
background-color:ffff33;
background-image:url(http://);
font-family:Cursive;
font-size:48px;
color:000000;
font-weight:bold;
@xander-miller
xander-miller / _footer.html.erb
Created August 19, 2014 14:19
DRY Social Media Links
@xander-miller
xander-miller / pareidoliax.scss
Last active August 29, 2015 14:05
PareidoliaX Brand Colors
@import url(http://fonts.googleapis.com/css?family=Cherry+Cream+Soda);
$px-bright-orange: #df7934;
$px-dark-orange: #9d331c;
$px-aqua: #349ce6;
$px-kolbolt: #283973;
$px-electric-indego: #0030aa;