Skip to content

Instantly share code, notes, and snippets.

@basiszwo
basiszwo / final working config
Last active December 22, 2023 23:00
kamal deployment issues
#
# Important note:
# - traefik reboot was required to pick up the new / updated config
# - `kamal traefik reboot -d <destination>`
#
service: med1-core
traefik:
args:
entryPoints.web.address: ":80"
@basiszwo
basiszwo / dialog_component.html.erb
Last active May 13, 2023 14:34
Dialog Component with Stimulus Dialog Controller
<div
class="dialog-wrapper p-5 md:p-8 fixed w-full h-full left-0 top-0 z-90 flex items-start hidden flex overflow-y-auto backdrop-<%=@backdrop%>"
id="<%= @id %>"
data-controller="dialog"
data-dialog-target="dialogWrapper">
<div class="dialog-backdrop absolute w-full h-full top-0 left-0 opacity-0"></div>
<div class="dialog relative z-20 m-auto w-full text-brand-primary bg-white rounded-lg shadow-xl opacity-0 translate-y-32 <%= @max_width %>">
<%= content %>
</div>
</div>
@basiszwo
basiszwo / github-apps.md
Last active November 25, 2022 04:15
Web, mobile and desktop apps for managing Github (Issues)
@basiszwo
basiszwo / google-cloud-memorystore-dump.md
Last active October 14, 2022 21:15
Dump Redis rdb file from Google Cloud MemoryStore

Dumping a redis rdb file from a Google Cloud MemoryStore is easier than expected using redis-cli

Command

redis-cli -h <IP of MemoryStore Instance> --rdb dump.rdb
@basiszwo
basiszwo / active_record_query_locator.rb
Created April 23, 2018 13:09
Find active record query location
module ActiveRecord
class QueryLocator
def call(name, started, finished, unique_id, payload)
# filter caller locations to application backtrace (filter all gem calls)
# see http://ruby-doc.org/core-2.5.0/Kernel.html#method-i-caller_locations for more options
caller_names = caller_locations.select { |line| line.to_s =~ /#{Rails.root.to_s}/ }
# use the last caller in backtrace
caller_name = caller_names.first
Rails.logger.debug ["Notification:", name, started, finished, unique_id, caller_name, payload].join(" - ")
@basiszwo
basiszwo / spree-commerce.md
Created August 19, 2013 22:11
Spree Commerce Resources
@basiszwo
basiszwo / rails-and-mssql.md
Created September 4, 2013 09:51
Rails and MSSQL Server

Rails and MSSQL

Install freeTDS (http://freetds.schemamania.org/)

brew install freetds for OSX Checkout what's required for Ubuntu.

Install tiny_tds for using freetds on

Check working connection

@basiszwo
basiszwo / FileHelpers.java
Last active January 23, 2018 08:10
Load local json and feed to accumulo instance
package one.flak.flinkgeomesa;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;
@basiszwo
basiszwo / fizzbuzz.rb
Created August 8, 2017 10:54
FizzBuzz Implementation
fizz = ["", "", "Fizz"].lazy.cycle
buzz = ["", "", "", "", "Buzz"].lazy.cycle
pattern = fizz.zip(buzz).map(&:join)
p pattern.take(15).to_a.join(", ")
numbers = (1..Float::INFINITY).lazy.map(&:to_s)
fizzbuzz = numbers.zip(pattern).map(&:max)
@basiszwo
basiszwo / carrierwave-upload-partitioning.rb
Created August 29, 2013 10:07
Carrierwave upload directory partitioning
# thanks to @rainchen
class BaseUploader < CarrierWave::Uploader::Base
storage :file
after :remove, :delete_empty_upstream_dirs
# e.g.: "uploads/venue/photo/000/000/003/thumb_Limoni_-_overall-resized-1.jpg"
def store_dir
"#{base_store_dir}/#{model_id_partition}"
end