Skip to content

Instantly share code, notes, and snippets.

@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
@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 / 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 / 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 / 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 / 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 / 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 / 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 / rubin.rb
Created November 5, 2021 21:57
forgot to include this with sys rubin
## rubin entry point is the rubin sys class file right now
## but could become this file in the future
##this file should never be anything more than a shortcut
## shortcuts to this file can have their own window config
load Dir.getwd.to_s+'/sys/rubin.rb'
current_update 2021.11.6.7.2
A bunch of ruby code i use to write
more complex ruby apps
more info and classes are being added all the time with the last major version change being september 2021 now at 7.2
version rollover soon!!! (less than 2 weeks now, so much is about to be fixed with dir and file, im releasing an encoder too)
next:
shadow cert
gem manager