Skip to content

Instantly share code, notes, and snippets.


Arthur Nisnevich ArthurN

View GitHub Profile

Keybase proof

I hereby claim:

  • I am arthurn on github.
  • I am arthurn ( on keybase.
  • I have a public key ASAMIYJVK2x339Jmc7L8QypS9XFOTA2qZbvqdJ7LkKakWQo

To claim this, I am signing this object:

ArthurN / BootstrapMultiselect.vue
Created Jan 24, 2018
Vue wrapper for jquery bootstrap multiselect
View BootstrapMultiselect.vue
<template lang='slm'>
select.form-control multiple="multiple"
option v-for="option in selectOptions" :value='option.value' {{ option.label }}
export default {
name: 'bootstrap-multiselect',
props: {
selectOptions: {
ArthurN /
Last active Jul 2, 2020
From pow to puma-dev on macOS keeping .dev domains
# Why:
# 1) Chrome 63 (Dec 8) breaks .dev domains by forcing HTTPS:
# 2) Pow is at EOL, superceded by puma-dev (see, 6 Version History, 0.6.0, Dec 8 2017)
# Uninstall pow
curl | sh
# If you use powder, you can remove it as well
gem uninstall powder
View chronic_date_property.rb
module ChronicDateProperty #:nodoc:
extend ActiveSupport::Concern
module ClassMethods
# Define a Reform property which coerces its input via the Chronic parser.
def chronic_date_property(*args)
options = args.extract_options!
field = args.first
property(field, options)
ArthurN /
Created Aug 24, 2015
Kill Duplicate Sidekiq processes
if [ $(pgrep -f sidekiq | wc -l) -gt 1 ]; then
kill $(pgrep -f sidekiq | grep -v $(pgrep -of sidekiq) | sort -n | uniq | awk '{printf $1" "}');
ArthurN / gist:e980d723a6d63e9fc766
Created Nov 22, 2014
View gist:e980d723a6d63e9fc766
def get_fields
# We have to use #send because AFAIK, PDF::Reader does not expose the root object anywhere
acroform = @reader.send(:root)[:AcroForm]
# PDF::Reader encapsulates each piece of PDF data in #objects. The field_refs are really references to
# these objects. We iterate through and de-reference the actual object, creating a AcroField based on its
# data
field_refs = @reader.objects[acroform][:Fields] unless acroform.nil?
fields = do |field_ref|[field_ref])
View gist:f16ad0e6958a0af73d39
# From
"Statement": [
"Sid": "AllowPublicRead",
"Action": [
View gist:e13637dce27d15168d4b
# Extract PDF field names and positions using pCOS:
./pcos --extended field "FT fullname Rect[0] Rect[1] Rect[2] Rect[3]" fw9.pdf
# CSV format, also output pagesize as the first line:
./pcos --extended pagesize "width height" --extended field "FT fullname V Rect[0] Rect[1] Rect[2] Rect[3]" --format "(VAL,)\n" --replace missing "" test.pdf
ArthurN / i18n.t
Created Aug 26, 2014
Peak into what I18n namespaces are attempted by third party gems
View i18n.t
# This monkeypatch logs any calls to I18n#t. This is especially useful to "peaking" into what namespaces are expected
# for third party gems, e.g. simple_form or reform.
I18n.module_eval do
class << self
def translate_with_puts(*args)
Rails.logger.debug "#{args}"
alias :old_translate :translate
alias :translate :translate_with_puts
ArthurN / gist:6ac227eb21e6f0627f18
Created May 29, 2014
Getting Source of a Package on CentOS, Applying Patch, & Rebuilding
View gist:6ac227eb21e6f0627f18
cd /tmp
sudo yumdownloader --source zbar
sudo yum-builddep zbar-blah-blah.rpm
rpm -ivh packagename-version.src.rpm
cd ~/rpmbuild
copy patch to SOURCES