Skip to content

Instantly share code, notes, and snippets.

View jubishop's full-sized avatar
🎼
Making a podcast app.

Justin Bishop jubishop

🎼
Making a podcast app.
View GitHub Profile
def Dollar(val)
Dollar.createRoundedDollar(val.kind_of?(Dollar) ? val.raw : val)
end
def getDollar
input = gets.chomp
return nil if (input.empty?)
Dollar.createRoundedDollar(input)
end
{
"editor.fontFamily": "Consolas",
"editor.tabSize": 2,
"editor.fontSize": 16,
"editor.wordWrap": "wordWrapColumn",
"editor.copyWithSyntaxHighlighting": false,
"editor.find.autoFindInSelection": true,
"editor.quickSuggestions": false,
"files.trimTrailingWhitespace": true,
"files.trimFinalNewlines": true,
def fact(n)
return n if (n < 3)
ans = 1
n.downto(2) { |x|
ans *= x
}
return ans
end
require 'set'
def build_board(n, queens)
board = Array.new(n) { "." * n }
queens.each { |spot|
board[spot / n][spot % n] = "Q"
}
return board
end
require 'set'
def build_board(n, queens)
board = Array.new(n) { "." * n }
queens.each { |spot|
board[spot / n][spot % n] = "Q"
}
return board
end
# @param {Integer} n
# @return {String[][]}
def build_board(n, placed_queens)
board = Array.new
0.upto(n-1) { |row|
row_str = ""
0.upto(n-1) { |col|
if (placed_queens.include?(row*n + col))
row_str += "Q"
else
require 'test/unit'
def minByColumn(data, column_name, multiple = false)
found_rows = []
data.each { |row|
next unless row.has_key?(column_name)
if (found_rows.empty? or row[column_name] < found_rows.first[column_name])
found_rows = [row]
elsif (row[column_name] == found_rows.first[column_name])
found_rows.push(row)
class Integer
BASE = 95
def convert_to_string
num = self
answer = ""
while (num > 0)
num -= 1
digit = num % BASE
num /= BASE
class Point
attr_accessor :x, :y
def initialize(x, y)
@x = x
@y = y
end
def ==(point)
return (@x == point.x and @y == point.y)
end
@jubishop
jubishop / analysis.rb
Last active February 23, 2019 22:05
RL Replay Analysis
require 'json'
require 'PP'
class Player
attr_accessor :name, :assists, :goals, :saves, :score, :shots, :teamID
def initialize(stats)
@name = stats['Name']['value']['str']
@assists = stats['Assists']['value']['int']
@goals = stats['Goals']['value']['int']
@saves = stats['Saves']['value']['int']