Skip to content

Instantly share code, notes, and snippets.

View ddd1600's full-sized avatar

David Douglas ddd1600

  • Murrells Inlet, SC
View GitHub Profile
@ddd1600
ddd1600 / fix_homebrew.rb
Created May 5, 2012 08:17 — forked from rpavlik/fix_homebrew.rb
Fix permissions on /usr/local for Homebrew
#!/usr/bin/ruby
#
# This script fixes /usr/local only.
#
# 6th January 2010:
# Modified the script to just fix, rather than install. - rpavlik
#
# 30th March 2010:
# Added a check to make sure user is in the staff group. This was a problem
# for me, and I think it was due to me migrating my account over several
@ddd1600
ddd1600 / rps.rb
Created June 7, 2012 01:37
rock paper scissors hw
class RockPaperScissors
HAND = { :rock => 1, :paper => 3, :scissors => 4 }
def play(param1, param2)
determinant = HAND[param1] + HAND[param2]
if(determinant==2)
puts "tie"
@ddd1600
ddd1600 / twitterapigrackle.rb
Created June 8, 2012 17:18
Twitter API program ---tweet or get tweets using Grackle
require 'grackle'
require 'json'
require 'highline/import'
$client = Grackle::Client.new(:auth=>{
:type => :oauth,
:consumer_key => 'YOUR_CONSUMER_KEY', :consumer_secret => 'YOUR_CONSUMER_SECRET',
:token => 'YOUR_ACCCESS_TOKEN', :token_secret => 'YOUR_ACCESS_TOKEN_SECRET'
})
@ddd1600
ddd1600 / rpsconsole_human_vs_human.rb
Created June 11, 2012 17:43
rps console -- human vs human
require("./rps.rb")
class DoGame
def promptuser
loop do
$stdout.write("Player 1: ")
param1 = $stdin.gets.chomp
param1 = param1.to_sym
break if param1 == :quit
@ddd1600
ddd1600 / rpsconsole_human_versus_comp.rb
Created June 11, 2012 19:43
rps console -- human versus computer
require("./rps.rb")
HAND = { :rock => 1, :paper => 3, :scissors => 4 }
class DoAIGame
def promptuser
loop do
$stdout.write("Player 1: ")
param1 = $stdin.gets.chomp
param1 = param1.to_sym
@ddd1600
ddd1600 / compvscomp.rb
Created June 11, 2012 23:26
rps console -- computer versus computer
require './rps.rb'
HAND = { :rock => 1, :paper => 3, :scissors => 4 }
class ComputerVersusComputer
def doTenTimes
i=0
10.times do
i += 1
@ddd1600
ddd1600 / beastie.rb
Created June 13, 2012 18:10
wednesday homework beastie boys
require 'highline/import'
beastie = {
"1986" => "Licensed to Ill", "1989" => "Paul", "1992" => "Check Your Head",
"1993" => "Ill Communication", "1998" => "Hello Nasty",
"2004" => "To the 5 Boroughs", "2007" => "The Mix-Up",
"2011" => "Hot Sauce Committee Part Two", "1994" => "Some Old Bullshit",
"1996" => "The In Sound From Way Out!", "1999" => "Beastie Boys Anthology: The Sounds of Science",
"2005" => "Solid Gold Hits"
}
@ddd1600
ddd1600 / disco.rb
Created June 18, 2012 22:40
beastie.rb homework
require 'highline/import'
class Discography
def initialize
@disco = {
"1986" => "Licensed to Ill", "1989" => "Paul", "1992" => "Check Your Head",
"1993" => "Ill Communication", "1998" => "Hello Nasty",
"2004" => "To the 5 Boroughs", "2007" => "The Mix-Up",
"2011" => "Hot Sauce Committee Part Two", "1994" => "Some Old Bullshit",
@ddd1600
ddd1600 / draggable.html
Created July 12, 2012 01:28
Draggable html example
<!DOCTYPE html>
<head>
<title>Draggable</title>
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="jquery-ui-1.8.21.custom.min.js"></script>
<link href='index.css' rel='stylesheet' type='text/css'>
</head>
<h1>Draggable</h1>
<form id="form1">
@ddd1600
ddd1600 / PHP Countries Array
Created July 24, 2012 08:14 — forked from DHS/PHP Countries Array
PHP array of all country names
<?php
$countries = array("Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegowina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo", "Congo, the Democratic Republic of the", "Cook Islands", "Costa Rica", "Cote d'Ivoire", "Croatia (Hrvatska)", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "East Timor", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Island