This file contains hidden or 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
class DistanceProblem | |
def initialize | |
@num_calls = 0 | |
@num_times_in_loop = 0 | |
@already_computed = {} | |
end | |
def compute x | |
@num_calls = @num_calls + 1 | |
(1..x).each do |i| |
This file contains hidden or 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
class DistanceProblem | |
def initialize | |
@num_calls = 0 | |
@num_times_in_loop = 0 | |
@already_computed = {} | |
end | |
def compute x | |
@num_calls = @num_calls + 1 | |
(1..x).each do |i| |
This file contains hidden or 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
# https://www.youtube.com/watch?v=dp127U0EJoI | |
require './volcano_choir' | |
include Byegone | |
DayDeadByegone. | |
laying near: :the_lights, | |
of: the_knights. | |
of(:the_northern_lodges) |
This file contains hidden or 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 'net/http' | |
require 'json' | |
def main() | |
uri = URI("http://letsrevolutionizetesting.com/challenge.json?id=47526821") | |
while true | |
response = Net::HTTP.get_response(uri) | |
str = JSON.parse(response.body)['follow'] | |
str = str.gsub "challenge", "challenge.json" | |
uri = URI(str) |
This file contains hidden or 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 'set' | |
# out of order should return just one | |
def pairs arr, n | |
pairs = Set.new | |
arr.each_with_index do |left, i| | |
arr.each_with_index do |right, j| | |
if left + right == n and i != j | |
pair = [left, right].sort | |
if !pairs.include? pair |
This file contains hidden or 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 'set' | |
def pairs arr, n | |
pairs = Set.new | |
arr.each_with_index do |left, i| | |
arr.each_with_index do |right, j| | |
if left + right == n and i != j | |
pair = [left, right].sort | |
if !pairs.include? pair | |
pairs << pair |
This file contains hidden or 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
Peer-to-peer poker application | |
This file contains hidden or 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
private void GameOfLove(Visitable you) { | |
while (true) { | |
try { | |
break; | |
} catch (Exception fuck) { | |
System.err.println("S.O.S"); | |
} | |
try { | |
self.find(new Object()); | |
} catch (Exception you) { |
This file contains hidden or 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
import java.beans.IntrospectionException; | |
import java.util.Observable; | |
import java.awt.Choice; | |
class Cycles { | |
private void Love(Observable you) throws IntrospectionException { | |
while (true) { | |
try { | |
throw new IntrospectionException("S.O.S"); |
This file contains hidden or 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 'securerandom' | |
class ScreenCapture | |
attr_reader :date_created, :file_name | |
def initialize args | |
@date_created = args[:time] | |
@file_name = "#{args[:time].to_s.delete(' ')}#{args[:name]}.png" | |
`screencapture -x #{@file_name}` |