Skip to content

Instantly share code, notes, and snippets.

View kitlangton's full-sized avatar
🤠

Kit Langton kitlangton

🤠
View GitHub Profile
require 'rainbow'
class NumberSpiral
attr_reader :cursor, :total_diags
def initialize(opts = {})
@total_diags = 0
@largest_digit = "1"
@grid = {}
.frog {
color: #444EEE;
}
module Main
class BoxesController < Volt::ModelController
model :store
def create_box
boxes << Box.new(width: 100, height: 100)
end
def delete_boxes
boxes.reverse.map(&:destroy)
@kitlangton
kitlangton / diagonals.rb
Last active January 7, 2016 06:04
Bending a two-dimensional array to the left and right to get every diagonal path.
def diagonal_coords(size)
left_array = push_array(size, :left)
right_array = push_array(size, :right)
[left_array, right_array].flatten(1)
end
def push_array(size, direction)
array = Array.new(size) { |x| Array.new(size) { |y| [x,y] }}
size.times do |i|
case direction
require 'timers'
timers = Timers::Group.new
@count = 10
def message_slack_test
`curl --data ":pomodoro: #{@count}" $'https://vikingcodeschool.slack.com/services/hooks/slackbot?token=bii9bJoHe1mbns9bBm5lTpb6&channel=%23test'`
@count -= 1
end
require 'daemons'
Daemons.run('test.rb')
require './app'
run Sinatra::Application
web: bundle exec rackup config.ru -p $PORT
def perm(string)
array = []
until array.length == factorial(string)
array << string.chars.shuffle.join
array.uniq!
end
array.sort
end
def factorial(string)
def find_missing(array)
(0..100).inject(:+) - array.inject(:+)
end