require "sidekiq/api"
Sidekiq::ScheduledSet.new.each { |j| p [j.at, j.display_class, j.display_args] }Inspired by https://www.facebook.com/techieprogrammer016/videos/1903944506811756
| Python | Ruby | |
|---|---|---|
| Swap two variables | a, b = b, a |
a, b = b, a |
| Reverse a string | s[::-1] |
s.reverse |
| Check palindrome | s == s[::-1] |
s == s.reverse |
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
| import { Controller } from 'stimulus' | |
| // Sets the visibility of elements based on the checked state of a source | |
| // element. | |
| // | |
| // source target is expected to emit a change event when the value changes so | |
| // the UI can be updated. | |
| // | |
| // Target elements must be configured with a `data-visible-when` attribute set | |
| // to either "on" or "off" depending on when the element should be visible. The |
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/sh | |
| # | |
| # Check for Ruby style errors using Rubocop | |
| red='\033[0;31m' | |
| green='\033[0;32m' | |
| yellow='\033[0;33m' | |
| NC='\033[0m' | |
| if git rev-parse --verify HEAD >/dev/null 2>&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
| #!/bin/bash | |
| # This script installs the version of Chromedriver that matches the installed | |
| # Chrome applicaton. | |
| # | |
| # It installs the chromedriver binary into ~/bin/. If an existing chromedriver | |
| # is installed it will be replaced by the updated binary. | |
| # | |
| # Assumptions: | |
| # |
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
| configure: WARNING: you should use --build, --host, --target | |
| checking for ruby... /Users/jakob/.rvm/rubies/ruby-2.6.0/bin/ruby | |
| *** using http instead of https *** | |
| config.guess already exists | |
| *** using http instead of https *** | |
| config.sub already exists | |
| checking build system type... x86_64-apple-darwin18.7.0 | |
| checking host system type... x86_64-apple-darwin18.7.0 | |
| checking target system type... x86_64-apple-darwin18.7.0 | |
| checking whether the C compiler works... yes |
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/bash | |
| COUNTER=0 | |
| while [ $COUNTER -lt 10 ]; do | |
| let COUNTER=COUNTER+1 | |
| wget "http://domæne.dk/navn?id=$COUNTER" | |
| done |
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
| module Delayed::Job::Ext | |
| module_function | |
| # Returns all failed jobs | |
| def failed_jobs | |
| Delayed::Job.where.not(:last_error => nil).order(:failed_at) | |
| end | |
| def failed_with(message) | |
| failed_jobs. |
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
| def do_stuff | |
| list = [1, 2, 3, 4, 5] | |
| list.map { |value| | |
| return "Fizz" if value == 3 | |
| value | |
| } | |
| end | |
| p do_stuff |
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
| # frozen_string_literal: true | |
| # A generic presenter class | |
| class Presenter < SimpleDelegator | |
| attr_reader :view | |
| class << self | |
| # Returns true if object has been wrapped in a Presenter | |
| def decorated?(object) | |
| object.is_a?(Presenter) | |
| end |
NewerOlder