Skip to content

Instantly share code, notes, and snippets.

@thomasjslone
thomasjslone / d.rb
Created November 6, 2021 21:40
schedual progress estimate display
require 'win32/sound'
include Win32
Time.class.class.class_eval{
def parse_seconds(s)
s = s.to_s.to_f
if s.to_f < 60.0
[0,0,s.to_i]
@thomasjslone
thomasjslone / schedual_display.2.rb
Created November 20, 2021 20:53
schedual display rev 1
require 'win32/sound'
include Win32
Time.class.class.class_eval{
def parse_seconds(s) ## get an array for timer displays of number of seconds [days:hours:minutes:seconds]
s = s.to_s.to_f
if s.to_f < 60.0
[0,0,s.to_i]
@thomasjslone
thomasjslone / Number Surname
Last active May 3, 2022 20:00
get st nd rd and th after numbers
def surname
int=self.to_s
if int.to_s=="0";int="0"
elsif int[-2..-1]=="11" or int[-2..-1] =="12" or int[-2..-1] =="13"
int<<"th"
elsif int[-1]=="1";int<<"st"
elsif int[-1]=="2";int<<"nd"
elsif int[-1]=="3";int<<"rd"
else;int<<"th"
end
@thomasjslone
thomasjslone / main.rb
Created April 11, 2022 14:23
Ruby 2d Demo featuring a movable square with multikey listeners and a main background thread.
require 'ruby2d'
#window config
set width: 300, height: 200
set title: ""
set background: 'black'
#set fullscreen: true
@square = Square.new(x: 10, y: 20, size: 25, color: 'blue')
@thomasjslone
thomasjslone / install rubin2.0.7.3--i2.rb
Last active January 9, 2023 18:01
one file installer for rubin
#begin
puts "Welcome to the rubin system installer, your system is being checked..."
launch_directory=Dir.getwd
launch_time=Time.now
puts "Launching from the installer files directory location."
puts ""
puts "Dir: "+launch_directory.to_s
@thomasjslone
thomasjslone / rubin installer 2.0.3.7.rb
Created January 9, 2023 21:04
rubin system installer script
#begin
puts "Welcome to the rubin system installer, your system is being checked..."
launch_directory=Dir.getwd
launch_time=Time.now
puts "Launching from the installer files directory location."
puts ""
puts "Dir: "+launch_directory.to_s
@thomasjslone
thomasjslone / fizzbuzz.rb
Last active January 21, 2025 18:23
So I guess I'm finally doing fizzbuzz, wow that was easy.
c=0 ; s=nil ; 100.times{ c+=1 ; print c.to_s + " "
if c % 3 == 0 ; print "FIZZ"; s=true; end
if c % 5 == 0 ; print "BUZZ "; s=false; end
if s; print " "; s=false; end }
@thomasjslone
thomasjslone / definitons.rb
Created February 26, 2023 21:14
ossy8 final version
#self.rb#5#;#6#;#9#;#9#;#4#;#5#;#6#;#7#;#9#;#6#;#4### self.rb
## CHARACTERS
CHARS = [] ; c = 0 ; 256.times{ CHARS << c.chr.to_s ; c += 1 }
## every 8 bit binary number in cardinal order
BINARY = [] ; c = 0 ; 256.times { b = c.to_s(2) ; until b.to_s.length == 8 ; b = "0" + b.to_s ; end ; BINARY << b ; c += 1 }
## every hexicdeimal number in order
HEX = [] ; c = 0 ; 256.times { h = c.to_s(16) ; if h.length == 1 ; h = "0" + h.to_s ; end ; HEX << h ; c += 1 }
## a list of all 8 bit byte codes for the ascii characters
#BYTES = [] ; HEX.each do |h| ; BYTES << "\\x" + h ; end
##system/region termonology
a=1 ; b=2 ; 100.times{ puts (a+b).to_s ; a+=1; b+=1 }
@thomasjslone
thomasjslone / scan_splicer.rb
Created March 14, 2023 22:31
wanted to build html/script parser, this is the vverymost basic form of the parse loop with no numeric stack value
def scan_splicer(s,b,e) # i.e.: "<tag>", "</tag>"
if s.to_s == "" or b.to_s == "" or e.to_s == ""; raise "Invalid arguements passed."; end
if s.length<=(b.to_s.length+e.to_s.length); raise "Input string is too small."; end
pos=0; stack = false; list=[]
if b.length > e.length ; buffer_length = b.length; else; buffer_length = e.length; end
buffer = []; buffer_length.times{ buffer << "" }
empty_buffer=[]; buffer_length.times{ empty_buffer << "" }
empty_buffer2=[]; buffer_length.times{ empty_buffer2 << "" }
tag1=empty_buffer; b.split('').each { |ch| empty_buffer << ch ; empty_buffer.delete_at(0) }