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
# spec/system/support/login_helpers.rb | |
# See this blog post for setup guide: https://evilmartians.com/chronicles/system-of-a-test-setting-up-end-to-end-rails-testing | |
module LoginHelpers | |
def login_as(user) | |
# Craft session cookie to make request authenticated (to pass even routing constraints) | |
# Compilation of these: | |
# - https://dev.to/nejremeslnici/migrating-selenium-system-tests-to-cuprite-42ah#faster-signin-in-tests | |
# - https://turriate.com/articles/2011/feb/how-to-generate-signed-rails-session-cookie | |
# - https://github.com/rails/rails/blob/43e29f0f5d54294ed61c31ddecdf76c2e1a474f7/actionpack/test/dispatch/cookies_test.rb#L350 |
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
// Installation: | |
// 1. mkdir -p ~/.local/share/gnome-shell/extensions/switch-to-last-keyboard-layout@envek | |
// 2. cp ./extension.js ./metadata.json ~/.local/share/gnome-shell/extensions/switch-to-last-keyboard-layout@envek | |
// 3. Restart GNOME Shell (e.g. log out and log in) | |
// 4. Enable it in the GNOME Extensions App | |
// Usage: | |
// gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell/Extensions/SwitchToLastKeyboardLayout --method org.gnome.Shell.Extensions.SwitchToLastKeyboardLayout.Call | |
const { Gio } = imports.gi; | |
const { getInputSourceManager } = imports.ui.status.keyboard; |
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
# Collection has and belongs to many Projects through CollectionProject | |
# Usage | |
@collections = current_user.collections.page(1) | |
ActiveRecord::Associations::Preloader.new.preload(@collections, :projects, limited_projects(3)) | |
# Now @collections.first.projects will have only first 3 projects accessible | |
# Constructs SQL like this to preload limited number of recent projects along with collections: | |
# SELECT * FROM ( | |
# SELECT "projects".*, row_number() OVER (PARTITION BY collection_projects.collection_id ORDER BY collection_projects.created_at) AS collection_position |
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
#!/usr/bin/env ruby | |
# Example of how to launch separate process to export all metrics from Ruby processes on the same host/container. | |
# IMPORTANT: | |
# You MUST configure Direct File store in official Prometheus Ruby client for this to work. | |
# See https://github.com/yabeda-rb/yabeda-prometheus#multi-process-server-support | |
# Example of configuration that should be made for additional process to export all metrics | |
# Here: export Sidekiq metrics from not worker process. See https://github.com/yabeda-rb/yabeda-sidekiq#configuration |
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 | |
usage() { | |
echo "Android application copy from one device to another via ADB APK files copy (requires USB debugging to be enabled)" | |
echo "Usage: $0 <application_id> [application_id…]" | |
echo "Example: $0 jp.naver.line.android" | |
} | |
if [ $# -eq 0 ]; then usage; exit 1; fi | |
if [ "$1" = '--help' ]; then usage; exit 0; fi |
OlderNewer