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
# Recreate ActiveRecord models from Delayed Job jobs. | |
# Ensure that we recreate the full model | |
ActiveRecord::Base.partial_updates = false | |
Delayed::Job.all.each do |job| | |
# Deserialize the Delayed Job handler. As we've been using the `.delay` syntax | |
# and no custom jobs, this returns a Delayed::PerformableMethod | |
pfm = YAML.load(job.handler) |
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
begin | |
require "bundler/inline" | |
rescue LoadError => e | |
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler" | |
raise e | |
end | |
gemfile(true) do | |
source "https://rubygems.org" | |
gem "rails", github: "rails/rails" |
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 |
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
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
#!/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
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 | |
# 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
#!/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
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 |
OlderNewer