Skip to content

Instantly share code, notes, and snippets.

View ghiculescu's full-sized avatar
👨‍🍼
I may be slow to respond.

Alex Ghiculescu ghiculescu

👨‍🍼
I may be slow to respond.
View GitHub Profile
shift = Shift.find(532434)
shift.destroy!
if defined?(ActiveRecord::Base)
begin
ActiveRecord::Migration.maintain_test_schema!
rescue ActiveRecord::PendingMigrationError => e
puts e.to_s.strip
exit 1
end
end
ActiveSupport.on_load(:active_support_test_case) do
@ghiculescu
ghiculescu / lint_android.yml
Last active September 7, 2022 13:18
Github Actions CI steps for Turbo Android and Turbo iOS apps
name: ktlint
on: [pull_request]
jobs:
ktlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: ktlint
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem "rails", github: "rails/rails", branch: "main"
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem "rails", github: "rails/rails", branch: "main"
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem "rails", github: "rails/rails", branch: "main"
@ghiculescu
ghiculescu / keys.rb
Created January 31, 2022 19:48 — forked from archan937/keys.rb
List all Memcached keys using Ruby
# inspired by https://gist.github.com/archan937/f441146e1aeaa9da138e337514ee4000
require "net-telnet"
def keys(hosts, port, pattern = nil)
[hosts].flatten.each do |host|
slabs = {}
telnet = Net::Telnet::new("Host" => host, "Port" => port, "Timeout" => 30)
telnet.cmd("String" => "stats items", "Match" => /^END/) do |stats|
slabs = Hash[stats.scan(/STAT items:(\d+):number (\d+)/)]
require "json"
require "net/http"
image = "ruby"
uri = URI("https://registry.hub.docker.com/v1/repositories/#{image}/tags")
json = Net::HTTP.get(uri)
# json == ""
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem "rails", github: "rails/rails", branch: "main"
@ghiculescu
ghiculescu / test.rb
Last active June 17, 2021 14:39
#13071
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem "rails", github: "rails/rails", branch: "main"