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
| // ==UserScript== | |
| // @name Dark Mode | |
| // @version 1 | |
| // @description Add a Dark Mode / Night Mode to your website in a few seconds | |
| // @author theabbie | |
| // @match *://*/* | |
| // @namespace https://theabbie.github.io | |
| // @license MIT | |
| // @downloadURL https://update.greasyfork.org/scripts/435749/Dark%20Mode.user.js | |
| // @updateURL https://update.greasyfork.org/scripts/435749/Dark%20Mode.meta.js |
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
| (function() { | |
| // Check OS dark mode preference | |
| if (!window.matchMedia('(prefers-color-scheme: dark)').matches) return; | |
| // Check if already applied | |
| if (document.getElementById('auto-dark-mode')) { | |
| document.getElementById('auto-dark-mode').remove(); | |
| console.log('✓ Dark mode removed'); | |
| return; | |
| } |
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
| ### Keybase proof | |
| I hereby claim: | |
| * I am jmstacey on github. | |
| * I am jmstacey (https://keybase.io/jmstacey) on keybase. | |
| * I have a public key ASDAzj5grNTsb1RGvHM2eKUCZ5mqj17DugCq7RZFk7wiCgo | |
| To claim this, I am signing this object: |
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
| ... | |
| /Users/bamboo/.bup: Permission denied | |
| Traceback (most recent call last): | |
| File "/usr/lib/bup/cmd/bup-midx", line 231, in <module> | |
| git.check_repo_or_die() | |
| File "/usr/lib/bup/bup/git.py", line 850, in check_repo_or_die | |
| init_repo() | |
| File "/usr/lib/bup/bup/git.py", line 827, in init_repo | |
| _git_wait('git init', p) | |
| File "/usr/lib/bup/bup/git.py", line 886, in _git_wait |
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
| Jon-Staceys-iMac:Desktop jon$ time jmstacey-rubinius/bin/rbx -X19 -Xprofile ./obj.rb | |
| 1000000 objects created. | |
| 2000000 objects created. | |
| 3000000 objects created. | |
| 4000000 objects created. | |
| 5000000 objects created. | |
| 6000000 objects created. | |
| 7000000 objects created. | |
| 8000000 objects created. | |
| 9000000 objects created. |
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 TestObject | |
| def initialize | |
| @one_var = true | |
| end | |
| end | |
| objects = Array.new |
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
| Jon-Staceys-iMac:Desktop jon$ time rubinius/bin/rbx -X19 -Xprofile -Xprofiler.graph ./run.rb | |
| 500000 | |
| ===== Thread 1 ===== | |
| Total running time: 16.516832237000003s | |
| index % time self children called name | |
| ---------------------------------------------------------- | |
| [1] 99.8 0.00 16.48 1 Rubinius::Loader#script [1] | |
| 0.00 16.48 1 Rubinius::CodeLoader.load_script [2] | |
| ------------------------------------------------------- | |
| 0.00 16.48 1 Rubinius::Loader#script [1] |
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
| NAMES = ['hundred', 'thousand', 'million', 'billion', 'trillion', 'quadrillion', 'quintillion', 'sextillion', 'septillion', 'octillion', 'nonillion', 'decillion', 'undecillion', 'duodecillion', 'tredecillion', 'quattuordecillion', 'quindecillion', 'sexdecillion', 'septendecillion', 'octodecillion', 'novemdecillion', 'vigintillion'] | |
| WORDS = { '0': '', '1': 'one', '2': 'two', '3': 'three', '4': 'four', '5': 'five', '6': 'six', '7': 'seven', '8': 'eight', '9': 'nine', '10': 'ten', '11': 'eleven', '12': 'twelve', '13': 'thirteen', '14': 'forteen', '15': 'fifteen', '16': 'sixteen', '17': 'seventeen', '18': 'eighteen', '19': 'nineteen', '20': 'twenty', '30': 'thirty', '40': 'forty', '50': 'fifty', '60': 'sixty', '70': 'seventy', '80': 'eighty', '90': 'ninety' } | |
| to_words = (number) -> | |
| number = number.toString() | |
| string = if (number.replace('-', '') == number) then '' else 'negative' | |
| number = number.replace('-', '') | |
| number = '0' + number while (number.length % 3 != 0) | |
| triplets = number.match(/.../g) |
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
| NAMES = ['hundred', 'thousand', 'million', 'billion', 'trillion', 'quadrillion', 'quintillion', 'sextillion', 'septillion', 'octillion', 'nonillion', 'decillion', 'undecillion', 'duodecillion', 'tredecillion', 'quattuordecillion', 'quindecillion', 'sexdecillion', 'septendecillion', 'octodecillion', 'novemdecillion', 'vigintillion'] | |
| WORDS = Hash['0', '', '1', 'one', '2', 'two', '3', 'three', '4', 'four', '5', 'five', '6', 'six', '7', 'seven', '8', 'eight', '9', 'nine', '10', 'ten', '11', 'eleven', '12', 'twelve', '13', 'thirteen', '14', 'forteen', '15', 'fifteen', '16', 'sixteen', '17', 'seventeen', '18', 'eighteen', '19', 'nineteen', '20', 'twenty', '30', 'thirty', '40', 'forty', '50', 'fifty', '60', 'sixty', '70', 'seventy', '80', 'eighty', '90', 'ninety' ] | |
| def to_words(number) | |
| triplets = number.to_s.gsub('-', '').split(//).each_slice(3).to_a.each { |a| a.insert(0, '0') while a.size % 3 != 0 } | |
| string = number < 0 ? 'negative' : '' | |
| triplets.each_with_index do |triplet, triplets_index| | |
| string + |
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
| # Lucas–Lehmer primality test | |
| # Retrieved from http://rosettacode.org/wiki/Lucas-Lehmer_test | |
| def is_prime?(p) | |
| if p == 2 | |
| return true | |
| elsif p <= 1 || p % 2 == 0 | |
| return false | |
| else | |
| (3 .. Math.sqrt(p)).step(2) do |i| | |
| if p % i == 0 |
NewerOlder