Skip to content

Instantly share code, notes, and snippets.

@palkan

palkan/config.rb Secret

Last active February 23, 2024 23:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save palkan/7da70e5654c034c1c77622f893fbb8e7 to your computer and use it in GitHub Desktop.
Save palkan/7da70e5654c034c1c77622f893fbb8e7 to your computer and use it in GitHub Desktop.
[ruby-next] ifn't
# Inspired by the joke from the C# community:
# https://twitter.com/phantom_thegame/status/1745215916348952671
RubyNext.define_text_rewriter "ifn't" do
def safe_rewrite(source)
source.gsub(/(\b)ifnot(\b)/, '\1unless\2')
end
end
require "date"
using(Module.new do
refine Date do
def weekend? = saturday? or sunday?
end
end)
ifnot Date.today.weekend?
puts "Keep working ⚙️"
else
puts "Relax ☺️"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment