Skip to content

Instantly share code, notes, and snippets.

View strzibny's full-sized avatar
🏠
Working from home

Josef Strzibny strzibny

🏠
Working from home
View GitHub Profile
@cnicodeme
cnicodeme / fixes.md
Last active May 8, 2024 18:03
List of 5,000 Most Frequently Used Domain Name Prefixes and Suffixes - Ordered By Length
@dillonchanis
dillonchanis / example.css
Created September 20, 2020 14:44
Tailwind Utility for using gradients with text
@layer utilities {
.text-gradient {
background-clip: text;
-webkit-text-fill-color: transparent;
}
}
@GustavoCaso
GustavoCaso / job_scheduler_using_ractor.rb
Last active January 5, 2021 04:30
Simple implementation for a job scheduler using ruby Ractor primitive
# How to install the latests version of ruby
# 1. clone ruby/ruby
# 2. autoconf
# 3. ./configure
# 4. cd ext/openssl && ruby extconf.rb --with-openssl-dir=<openssl_root>; make; make install
# 5. cd ../../
# 6. make
# 7. make install-nodoc
# You should be ready ti run this script!!!!
defmodule StringTrimmer do
def trim_utf8(string, len), do: trim(string, len, &utf8_counter/1)
def trim_utf16(string, len), do: trim(string, len, &utf16_counter/1)
def trim(string, len, counter) do
string
|> String.graphemes()
|> Enum.reduce_while({0, ""}, fn grapheme, {count, acc} ->
count = count + counter.(grapheme)
#!/bin/bash
###
### my-script — does one thing well
###
### Usage:
### my-script <input> <output>
###
### Options:
### <input> Input file to read.
### <output> Output file to write. Use '-' for stdout.
@dhh
dhh / Gemfile
Created June 24, 2020 22:23
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
@manzanit0
manzanit0 / extensions.sh
Last active November 24, 2021 09:02
My personal VS Code configuration
# theming
code --install-extension emmanuelbeziat.vscode-great-icons
code --install-extension github.github-vscode-theme
# terminal
code --install-extension formulahendry.terminal
code --install-extension msamueltscott.maximizeterminal
# general stuff
code --install-extension vscodevim.vim
@rishiip
rishiip / .irbrc
Created June 7, 2020 15:57
This is my current irbrc file which contains lots of helpful things - Medium
require 'irb/completion'
require 'rubygems'
ActiveRecord::Base.logger.level = 1 if defined?(ActiveRecord)
IRB.conf[:SAVE_HISTORY] = 1000
# Overriding Object class
class Object
# Easily print methods local to an object's class
def lm
@nateberkopec
nateberkopec / tf-dev-script.sh
Last active June 3, 2020 09:13
tf-dev-script.sh
#!/bin/bash
# Assumes you have a DIGITALOCEAN_TOKEN env var pre-set
# Assumes you have terraform and mutagen installed
# Assumes DO has an SSH key uploaded
DO_REGION="sgp1" # Set to DO region: https://www.digitalocean.com/docs/platform/availability-matrix/
SSH_KEY_FINGERPRINT="your-key-fingerprint" # You can find this in your control panel
if [ -z $DIGITALOCEAN_TOKEN ]; then
exit 1
@garyfoster
garyfoster / authority_to_pundit.rake
Last active July 29, 2023 17:28
Quick and Dirty Authority to Pundit Conversion Script
task authority_to_pundit: :environment do
# please note, this script was hastily created and does not convert everything but makes a good start to save some time
# get list of models first because eager loading will crash later after the script modifies code
Rails.application.eager_load!
policies = ApplicationRecord.subclasses.map { |item| { class_name: item.name, policy_name: item.name.underscore } }
# move authorizers to policies
if File.exist?(Rails.root.join('app', 'authorizers'))
FileUtils.mv Rails.root.join('app', 'authorizers'), Rails.root.join('app', 'policies')