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 / TRLscript.js
Created September 22, 2012 00:13
An attempt at JS
var blogs = [
{"Title" : "Rebuilding shit",
"Post" : "I think progress has been made\. I think progress has been made\. I think progress has been made\. I think progress has been made\. I think progress has been made\. I think progress has been made\. I think progress has been made\. I think progress has been made\. ",
"Footer" : "September 3rd 2012"
},
{"Title" : "Second post containting stuff",
"Post" : "Practice makes perfect\. Practice makes perfect\. Practice makes perfect\. Practice makes perfect\. Practice makes perfect\. Practice makes perfect\. " ,
"Footer" : "October 2nd 2012"
@TravisL12
TravisL12 / gist:5332269
Last active December 15, 2015 22:19
Calculate the sum of prime numbers below a maximum number of integers (max_prime). This is in response to the Project Euler Problem 10: http://projecteuler.net/problem=10 This problem states to find the sum of all prime numbers less than 2,000,000.
max_prime = 51
array = Array.new(max_prime) { |i| i }
not_primes = []
primes = []
array.each do |i|
if i > 1 && i <= (max_prime ** 0.5)
0.upto(max_prime) do |j|
sieve = i**2 + (j * i) # Sieve_of_Eratosthenes algorithm to find non-primes
$(document).ready(function(){
$('form').on('submit',function(e){
e.preventDefault();
$.ajax({
type:'post',
url:'/rolls'
}).done(function(data){
$('#die').html('<img src=' + data + ".png>");
@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){
@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>
#!/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]" ]
//------------------------------------------------------------------------------------------------------------------
// 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.
//------------------------------------------------------------------------------------------------------------------
# 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
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
@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