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
| #!/usr/bin/env ruby | |
| @series = [1, 2.2, 3.3, 4.7, 5.6, 6.8, 8.2].reverse | |
| @multiples = [1, 10, 100, 1000, 10_000, 100_000].reverse | |
| # Find the desired *target* resistance based on the available resistors | |
| def find_resistance(target, resistors = []) | |
| @multiples.each do |m| | |
| next if m > target |
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
| #!/usr/bin/env crystal | |
| struct Point3(T) | |
| def self.radians(degrees) | |
| degrees * Math::PI / 180.0 | |
| end | |
| def self.degrees(radians) | |
| radians * 180.0 / Math::PI | |
| end |
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
| javascript:(function() { | |
| var chatgptContent = document.querySelector('main > div > div > div').innerHTML; | |
| var pageTitle = document.title.replace(/[^a-zA-Z0-9\s]/g, "").replace(/\s+/g, "_"); | |
| var styles = ''; | |
| for (var i = 0; i < document.styleSheets.length; i++) { | |
| var styleSheet = document.styleSheets[i]; | |
| try { | |
| if (styleSheet.cssRules) { | |
| for (var j = 0; j < styleSheet.cssRules.length; j++) { | |
| styles += styleSheet.cssRules[j].cssText; |
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 "benchmark" | |
| n = 100.0 | |
| # From Quake 3 arena | |
| def fast_inverse_sqrt(num : Float32) | |
| i = uninitialized Int64 | |
| x2 = uninitialized Float32 | |
| y = uninitialized Float32 |
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
| #!/usr/bin/env ruby | |
| require 'shellwords' | |
| require 'pty' | |
| $stdout.sync = true | |
| RUBOCOP = "/Users/alex/.rvm/gems/ruby-2.7.1@zweb/wrappers/rubocop -c .rubocop.yml" | |
| proj_root = File.expand_path(File.join(__dir__, '..', '..')) |
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
| #!/usr/bin/env ruby | |
| require 'digest/sha1' | |
| require 'json' | |
| def path(*parts) | |
| File.join(Dir.pwd, *parts) | |
| end | |
| bundle_paths = { |
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
| #!/usr/bin/env ruby | |
| require 'digest/sha1' | |
| require 'json' | |
| require 'fileutils' | |
| Dir.chdir("/Users/alex/Library/Mobile\ Documents/com\~apple\~CloudDocs/Music/") | |
| search_dir = "library" | |
| trash_dir = "/tmp/duplicates/" |
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
| #!/usr/bin/env ruby | |
| require 'fileutils' | |
| require 'set' | |
| require 'digest/md5' | |
| require 'json' | |
| require 'optparse' | |
| VERSION = '1.0.0' | |
| APP = 'finddups' |
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
| #!/bin/env ruby | |
| "🌕🌖🌗🌘🌑🌒🌓🌔".chars.cycle.tap do |m| | |
| loop { sleep 0.1 and print "\r#{ m.next }" } | |
| end |
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
| #!/usr/bin/env ruby | |
| require 'http' | |
| class ArgVCurlParser | |
| def initialize(argv_array) | |
| @argv_array = argv_array | |
| parse(@argv_array) | |
| end |
NewerOlder