Skip to content

Instantly share code, notes, and snippets.

View barnes7td's full-sized avatar

Timothy Barnes barnes7td

  • CleanSlate
  • Indianapolis, IN
View GitHub Profile
@barnes7td
barnes7td / print_grid.rb
Last active December 16, 2015 16:39
Print Grid Solutions
# This is a conglomeration of solution possibilites, collected and put together by Ryan Matthews - reposted here by Timothy
def print_grid(x=5,y=5)
size = 4
0.upto(size) do |a|
0.upto(size) do |b|
if b == x && a == y
print "X"
else
print "0"
@barnes7td
barnes7td / gist:5827791
Last active December 18, 2015 18:40
.bashrc File
alias subl='"/c/Program Files/Sublime Text 2/sublime_text.exe"'
alias irb='ruby -S irb'
alias open='start $@'
export EDITOR='subl -w'
@barnes7td
barnes7td / module_class.rb
Created July 31, 2013 22:49
This is an example of how to include both class methods and instance variables by including a module into a class.
require 'active_support/concern'
module Testable
extend ActiveSupport::Concern
def instance_puts
puts "This is an instance method"
end
# def self.included(base)
@barnes7td
barnes7td / cupidicon_routes.md
Last active December 20, 2015 22:49
routes layout for Cupidicon

All users will start at (root):

/user/dashboard (show)

User will create a new writting request:

/assignment/new
@barnes7td
barnes7td / golf-problem-2.rb
Created August 15, 2013 00:14
Indyrb Golf Problem 2
# def problem_2(s, t)
# a = 0; s.split.each_with_index { |c, i| a += 1 if t[i] != c }; a
# end
def problem_2(s, t)
(s.split("") & t.split("")).size
end
s = "AAABab"
t = "AAAAaa"
class Playlist
attr_reader :song_list, :history
def create_playlist(list)
@song_list = list
@song_index = 0
@history = [current_song]
end
@barnes7td
barnes7td / gist:7243661
Created October 31, 2013 02:43
Modified Gemfile
group :assets do
gem 'sass-rails', '3.2.6'
gem 'coffee-rails', '~> 3.2.1'
gem 'bootstrap-sass', '~> 2.3.1.0'
gem 'sass', '3.2.10'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
@barnes7td
barnes7td / show.html.erb
Created November 10, 2013 04:16
promotions show view
<br>
<div class="row">
<div class="col-lg-12">
<div class="col-lg-8 image_container"><%= image_tag(@promotion.image_url, class: "img-rounded") if @promotion.image? %>
</div>
<div class="col-lg-3 thumbnail">
<h4 align="center">Summary</h4>
<br>
<p align="center">Price: $<%= @promotion.price %></p>
<br>
@barnes7td
barnes7td / application.js
Created November 22, 2013 20:15
bitcoin js test
$(document).ready(function(){
function canvas() {
window.requestAnimationFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame||function(f){window.setTimeout(f,40/60);
};};}
var canvas1;
var canvas2;
var canvas3;
var canvas4;
var canvas5;
[user]
name = Timothy Barnes
email = barnes7td@gmail.com
[alias]
co = checkout
st = status
[color]
diff = auto
status = auto
branch = auto