This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rainbow' | |
class NumberSpiral | |
attr_reader :cursor, :total_diags | |
def initialize(opts = {}) | |
@total_diags = 0 | |
@largest_digit = "1" | |
@grid = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.frog { | |
color: #444EEE; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'daemons' | |
Daemons.run('test.rb') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require './app' | |
run Sinatra::Application |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
web: bundle exec rackup config.ru -p $PORT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def perm(string) | |
array = [] | |
until array.length == factorial(string) | |
array << string.chars.shuffle.join | |
array.uniq! | |
end | |
array.sort | |
end | |
def factorial(string) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def find_missing(array) | |
(0..100).inject(:+) - array.inject(:+) | |
end |
OlderNewer