Skip to content

Instantly share code, notes, and snippets.

View vlasikhin's full-sized avatar
:octocat:

Pavel Vlasikhin vlasikhin

:octocat:
View GitHub Profile
@vlasikhin
vlasikhin / up.sh
Created November 28, 2023 18:56 — forked from milushov/up.sh
up.sh
#!/bin/bash
# Don't forget chmod +x up.sh
# Installation:
# brew install jq
#
# Define function in ~/.zshrc
# container_name() {
# docker ps --format "{{.Names}}" | grep "app-1"
@vlasikhin
vlasikhin / SIDEKIQ RUNIT.md
Created April 24, 2023 09:15 — forked from rusllonrails/SIDEKIQ RUNIT
SIDEKIQ RUNIT

sudo apt-get install runit

cd /etc/sv/ mkdir sidekiq cd sidekiq

nano run

#!/bin/sh
cd /home/deployer/application/current/
@vlasikhin
vlasikhin / convert_ruby_hash_string_to_json.rb
Created November 27, 2018 11:47 — forked from gene1wood/convert_ruby_hash_string_to_json.rb
A set of regex converstions to turn a ruby hash output string into a json parseable string
require 'json'
# Example ruby hash string which exercises all of the permutations of position and type
# See http://json.org/
ruby_hash_text='{"alpha"=>{"first second > third"=>"first second > third", "after comma > foo"=>:symbolvalue, "another after comma > foo"=>10}, "bravo"=>{:symbol=>:symbolvalue, :aftercomma=>10, :anotheraftercomma=>"first second > third"}, "charlie"=>{1=>10, 2=>"first second > third", 3=>:symbolvalue}, "delta"=>["first second > third", "after comma > foo"], "echo"=>[:symbol, :aftercomma], "foxtrot"=>[1, 2]}'
puts ruby_hash_text
# Transform object string symbols to quoted strings
ruby_hash_text.gsub!(/([{,]\s*):([^>\s]+)\s*=>/, '\1"\2"=>')
@vlasikhin
vlasikhin / example_activejob.rb
Created October 31, 2018 18:58 — forked from ChuckJHardy/example_activejob.rb
Example ActiveJob with RSpec Tests
class MyJob < ActiveJob::Base
queue_as :urgent
rescue_from(NoResultsError) do
retry_job wait: 5.minutes, queue: :default
end
def perform(*args)
MyService.call(*args)
end