Skip to content

Instantly share code, notes, and snippets.

View alexanderadam's full-sized avatar
⌨️
⌨️

Alexander ADAM alexanderadam

⌨️
⌨️
View GitHub Profile
@awright415
awright415 / graph_preload.ex
Created June 27, 2021 16:23
Recursively Preloading Children from Join Table w/ Elixir & Ecto
# Use a recursive CTE to turn the join table into a (partial) closure table,
# then join all of the child records for the provided parent(s)
query = """
WITH RECURSIVE traversal(depth, parent_id, child_id) AS (
SELECT
1 depth,
parent_id,
child_id
FROM rules_rules
WHERE parent_id = ANY($1)
@thienha1
thienha1 / Absolute Enable Right Click & Copy.user.js
Created April 25, 2021 15:16
Absolute Enable Right Click & Copy.user.js
// ==UserScript==
// @name Absolute Enable Right Click & Copy
// @namespace Absolute Right Click
// @description Force Enable Right Click & Copy & Highlight
// @shortcutKeys [Ctrl + `] Activate Absolute Right Click Mode To Force Remove Any Type Of Protection
// @author Absolute
// @version 1.8.9
// @include *://*
// @icon https://i.imgur.com/AC7SyUr.png
// @compatible Chrome Google Chrome + Tampermonkey
@matthewd
matthewd / db-switch.rb
Created April 1, 2021 05:50
bin/db-switch
#!/usr/bin/env ruby
require(Dir.pwd + "/config/environment")
ActiveRecord::Base.configurations.configs_for(env_name: ActiveRecord::Tasks::DatabaseTasks.env).each do |db_config|
ActiveRecord::Base.establish_connection(db_config.config)
context = ActiveRecord::Base.connection.migration_context
missing_migrations = []
time = Time.monotonic
gcfile = File.new("chry_multiplied.fa")
at = 0
gc = 0
while true
# Peek the IO's buffer
peek = gcfile.peek
# in src/app_server.cr
def middleware : Array(HTTP::Handler)
[
Lucky::ForceSSLHandler.new,
Lucky::HttpMethodOverrideHandler.new,
Lucky::LogHandler.new,
Lucky::ErrorHandler.new(action: Errors::Show),
CORSHandler.new,
Lucky::RemoteIpHandler.new,
Cable::Handler.new(ApplicationCable::Connection),
@swanson
swanson / .irbrc
Last active March 3, 2024 17:14
.irbrc color coding Rails console by environment
# Add color coding based on Rails environment for safety
if defined? Rails
banner = if Rails.env.production?
"\e[41;97;1m #{Rails.env} \e[0m "
else
"\e[42;97;1m #{Rails.env} \e[0m "
end
# Build a custom prompt
@robacarp
robacarp / .gitignore.diff
Last active January 30, 2022 07:22
Lucky with Parcel Bundler
+public/_entrypoint.html
+public/*.js
+public/*.css
+public/*.map
@trajano
trajano / stack-redeploy.pl
Last active October 22, 2021 05:55
Redeploy stack images if they do not match
#!/usr/bin/perl
use warnings;
use strict;
use Fatal qw(open);
our $VERSION = '1.0.0';
my $stack_name = shift;
sub _process_stack_entry {
my ($task_id, $task_image) = @_;
open my $container_fn, q{-|},
@lrvick
lrvick / github-troll.md
Last active May 3, 2024 16:20
Trolling Github's DMCA repo with their own security flaws.
@spalladino
spalladino / falsehoods-that-ethereum-programmers-believe.md
Last active May 20, 2024 21:04
Falsehoods that Ethereum programmers believe

Falsehoods that Ethereum programmers believe

I recently stumbled upon Falsehoods programmers believe about time zones, which got a good laugh out of me. It reminded me of other great lists of falsehoods, such as about names or time, and made me look for an equivalent for Ethereum. Having found none, here is my humble contribution to this set.

About Gas

Calling estimateGas will return the gas required by my transaction

Calling estimateGas will return the gas that your transaction would require if it were mined now. The current state of the chain may be very different to the state in which your tx will get mined. So when your tx i