Skip to content

Instantly share code, notes, and snippets.

View claudiug's full-sized avatar
💜
I eat stickers all the time, dude.

Klaus Heissler claudiug

💜
I eat stickers all the time, dude.
  • cto@relatico
  • Austin
View GitHub Profile
import os
import sys
import boto3
from PySide2.QtCore import QRunnable, QObject, QThreadPool, Signal, Slot
from PySide2.QtWidgets import QMainWindow, QVBoxLayout, QProgressBar, QPushButton, QWidget, QApplication
class TestWindow(QMainWindow):
class CustomDialog(QDialog):
def __init__(self, *args, **kwargs):
super(CustomDialog, self).__init__(*args, **kwargs)
self.setWindowTitle("HELLO!")
QBtn = QDialogButtonBox.Ok | QDialogButtonBox.Cancel
self.buttonBox = QDialogButtonBox(QBtn)
Interview with German Ventilator Manufacturer
"Absolutely Mission Impossible"
Drägerwerk is a world leader in the production of ventilators. In an interview, company head Stefan Dräger, 57, discusses the challenges of keeping up with current demand as the corona crisis accelerates.
Interview Conducted by Lukas Eberle und Martin U. Müller
27.03.2020, 18:30 Uhr
Workers at the Dräger factory in Lübeck: "Last weekend, the king of the Netherlands called."
Workers at the Dräger factory in Lübeck: "Last weekend, the king of the Netherlands called." LUTZ ROEßLER
DER SPIEGEL: Mr. Dräger, your company is currently receiving a record number of orders and shares in your company are in greater demand than ever. Are you able to derive any satisfaction because of it?
Dräger: The situation is humbling, but it does make me proud. We are aware of our responsibility.
@claudiug
claudiug / missing_indices.sql
Created April 7, 2020 20:35 — forked from consti/missing_indices.sql
Find missing indices in postgres
SELECT relname, seq_scan-idx_scan AS too_much_seq, case when seq_scan-idx_scan>0 THEN 'Missing Index?' ELSE 'OK' END, pg_relation_size(relname::regclass) AS rel_size, seq_scan, idx_scan
FROM pg_stat_all_tables
WHERE schemaname='public' AND pg_relation_size(relname::regclass)>80000 ORDER BY too_much_seq DESC;
module Slug
def self.customize(field: :name)
Module.new do
define_method :to_param do
public_send(field).downcase.gsub /\W+/, '-'
end
end
end
end

Faster Rails tests

Feedback loop speed in one of the biggest contributing factors to overall development time. The faster you get results, the faster you can move on to other things. A fast enough test suite is therefore critical to teams' success, and is worth investing some time at the beginning to save in the long run.

Below is a list of techniques for speeding up a Rails test suite. It is not comprehensive, but should definitely provide some quick wins. This list of techniques assumes you're using minitest, but most everything should translate over to rspec by simply replacing test/test_helper.rb with spec/spec_helper.rb.

@claudiug
claudiug / idb-backup-and-restore.md
Created March 31, 2021 16:35 — forked from loilo/idb-backup-and-restore.js
Back up and restore an IndexedDB database

Back up and restore an IndexedDB database

This gist is an ES module which provides functions to import and export data from an IndexedDB database as JSON. It's based on Justin Emery's indexeddb-export-import package, but applies some adjustments that reflect better on the current browser landscape (i.e. better developer ergonomics but no support for Internet Explorer).

Usage

For each of the provided functionalities, you need a connected IDBDatabase instance.

Export Data

import { idb } from 'some-database'
@claudiug
claudiug / losing_my_mind_on_concurrency.rb
Created May 11, 2021 07:13 — forked from noteflakes/losing_my_mind_on_concurrency.rb
A script showing how to use Polyphony to perform HTTP requests concurrently from a queue of jobs
# "I'm losing my mind on concurrency"
# https://www.reddit.com/r/ruby/comments/lmg8xo/im_losing_my_mind_on_concurrency/
require 'polyphony'
require 'httparty'
require 'json'
CHANNELS = ['list', 'of', 'channels']
JOB_QUEUE = Queue.new
TIMEOUT = 60 # 60 second timeout
@claudiug
claudiug / ruby31onrails.md
Created December 26, 2021 10:37 — forked from yahonda/ruby31onrails.md
Ruby 3.1 on Rails

Ruby 3.1 on Rails

Actions required to use Ruby 3.1.0 with Rails

Rails 7.0.Z

  • Rails 7.0.0 is not compatible with Ruby 3.1.0.
  • "Rails::Engine is abstract, you cannot instantiate it directly.."
    $ bin/rails s
    Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.

[WARNING] Could not load command "rails/commands/server/server_command". Error: Rails::Engine is abstract, you cannot instantiate it directly..

@claudiug
claudiug / select_controller.js
Created January 4, 2022 08:20 — forked from leastbad/select_controller.js
SlimSelect Stimulus wrapper
import ApplicationController from '../application_controller'
import SlimSelect from 'slim-select'
export default class extends ApplicationController {
static values = {
limit: Number,
placeholder: String,
searchText: String,
searchingText: String,
reflex: String,