Skip to content

Instantly share code, notes, and snippets.

View TravisL12's full-sized avatar
🪲
Smokes if you got'em.

Travis Lawrence TravisL12

🪲
Smokes if you got'em.
View GitHub Profile
@TravisL12
TravisL12 / application.css
Last active August 29, 2015 14:00
Strava Demo stuff
body {
font-family: Helvetica; }
.container {
margin: 20px auto;
width: auto;
background: #f00;
padding: 20px; }
.container ul {
margin: 0;
@TravisL12
TravisL12 / word_parse.rb
Created November 12, 2013 07:00
Used this to cut up every word in a CSV to count any common places where I made purchases. Such as a certain gas station or how many times at an ATM.
require 'csv'
class String
def titleize
split(/(\W)/).map(&:capitalize).join
end
end
def separate_word(word)
word.gsub(/[0-9\-\/\\\*\#()&'.]/,"").titleize.split(" ")
@TravisL12
TravisL12 / primes_sum_twoM_TRL.rb
Last active December 25, 2015 15:59
Solutions to Project Euler #10 (http://projecteuler.net/problem=10) "Find the sum of all the primes below two million"
def primesTRL(num)
ceiling = num
number_set = 2.upto(ceiling).map(&:to_i)
non_primes = {}
number_set.each do |prime|
next unless non_primes[prime].nil?
max_val = ceiling / prime
break if max_val < prime
@TravisL12
TravisL12 / menu.rb
Last active December 24, 2015 08:29
# Understanding the 'each' method
# Array Example
# When using an array you iterate with only one item at a time. Thus
# on line 7 we only need the |item| to loop over.
restaurant_menu = ["Ramen", "Dal Makhani", "Coffee"]
restaurant_menu.each do |item|
puts item
end
3;3;1 2 3 4 5 6 7 8 9
5;5; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
4; 5; a b c d e f g h i j k l m n o p q r s t
6; 4; a b c d e f g h i j k l m n o p q r s t u v w x
4; 5; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
6; 3; a b c d e f g h i j k l m n o p q r
7; 4; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
12; 3; a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J
9; 4; a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J
# Andrews' CODE
def times_table(rows) # <-- defines method and how many rows passed as argument
1.upto(rows) do |x| # <-- You start first loop with value x
line = ""
1.upto(rows) do |y| # <-- begin 2nd (nested) loop with value y
line += "#{x*y}\t" # <-- x=1 therefore 1*1, 1*2, 1*3. When done x=2 2*1, 2*2, 2*3.... (x=3, 3*1, 3*2, 3*3...)
end
puts line
end # <-- incremement to the next x value
end
//------------------------------------------------------------------------------------------------------------------
// YOUR CODE: Create your Zoo "object literal" and Animal "constructor" and "prototypes" here.
//------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------
// DRIVER CODE: Do **NOT** change anything below this point. Your task is to implement code above to make this work.
//------------------------------------------------------------------------------------------------------------------
#!/bin/sh
git filter-branch --env-filter '
an="$GIT_AUTHOR_NAME"
am="$GIT_AUTHOR_EMAIL"
cn="$GIT_COMMITTER_NAME"
cm="$GIT_COMMITTER_EMAIL"
if [ "$GIT_COMMITTER_EMAIL" = "[email protected]" ]
@TravisL12
TravisL12 / index.html
Last active December 17, 2015 16:20 — forked from dbc-challenges/index.html
DBC Phase 2 Practice Assessment Part 3
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="http://cdn.jsdelivr.net/normalize/2.1.0/normalize.css">
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato:100,900">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.0.2/css/font-awesome.min.css">
</head>
@TravisL12
TravisL12 / zoo.js
Last active December 17, 2015 16:19 — forked from dbc-challenges/zoo.js
//------------------------------------------------------------------------------------------------------------------
// YOUR CODE: Create your Zoo "object literal" and Animal "constructor" and "prototypes" here.
//------------------------------------------------------------------------------------------------------------------
var Zoo = {
bipeds: [],
quadrupeds: [],
other: [],
init: function(animals){