Skip to content

Instantly share code, notes, and snippets.

@stvkoch
stvkoch / details.md
Created March 20, 2023 21:10 — forked from Agusx1211/details.md
Universal deployer for EVM

Universal deployer for EVM contracts

To deploy a contract send the init_code of the contract to the Universal deployer. The deployed contract will have the same counter-factual address on all networks.

Universal deployer address: 0x1b926fbb24a9f78dcdd3272f2d86f5d0660e59c0

Deployment details

Signed transaction: 0xf9010880852416b84e01830222e08080b8b66080604052348015600f57600080fd5b50609980601d6000396000f3fe60a06020601f369081018290049091028201604052608081815260009260609284918190838280828437600092018290525084519495509392505060208401905034f5604080516001600160a01b0383168152905191935081900360200190a0505000fea26469706673582212205a310755225e3c740b2f013fb6343f4c205e7141fcdf15947f5f0e0e818727fb64736f6c634300060a00331ca01820182018201820182018201820182018201820182018201820182018201820a01820182018201820182018201820182018201820182018201820182018201820

@stvkoch
stvkoch / functions_triggers.sql
Last active November 9, 2022 15:46
SUPERBASE: add ownership to data
--- for policies where the table doesnt have user association
create or replace function get_user_id(cond varchar) returns uuid as $$
declare
id integer;
begin
if cond <> 'no_profile' then
select profile_id into id
from profiles
where user_id = auth.uid();
end if;
@stvkoch
stvkoch / migration_00001.sql
Created May 20, 2021 16:15
Don't lock the table while migrate your db
-- dont force update all table with default value
ALTER TABLE TB_A
ADD COLUMN new_coumn boolean;
-- add constaint for new records
ALTER TABLE public.TB_A
ALTER COLUMN new_coumn SET DEFAULT false;
-- while not return 0 update the table
do $$
@stvkoch
stvkoch / keybase.md
Last active October 12, 2020 11:29
keybase.md

Keybase proof

I hereby claim:

  • I am stvkoch on github.
  • I am stvkoch (https://keybase.io/stvkoch) on keybase.
  • I have a public key ASBD6oqtFE2R0g-YHNHbPw-zFPjv61hcyFACBszyQA5DVQo

To claim this, I am signing this object:

@stvkoch
stvkoch / containerForm.js
Last active October 23, 2019 09:24
Formik multiples submit buttons
function FormContainer(props) {
const [formType, setFormType] = useState(DEFAULT_FORM_TYPE);
const handlerSubmit = (methodX, methodY) => async values => {
if (formType === FORM_TYPE_X) {
return await methodX(values);
}
return await methodY(values);
};
@stvkoch
stvkoch / object-hashcode.js
Last active July 4, 2019 15:02
generateHashFromObject
const generateHashFromObject = (obj) =>
Object.entries(obj).reduce((hash, [key, str])=> {
let result = hash;
if (!str || !key) return hash;
if (!str.charCodeAt && !isNaN(str)) {
result = (result * 33) ^ str;
}
if (!key.charCodeAt && !isNaN(key)) {
result = (result * 33) ^ key;
@stvkoch
stvkoch / .tmux.conf
Last active May 30, 2019 09:52
my .tmux.conf
unbind C-b
set -g prefix C-a
bind C-a send-prefix
set-option -g default-shell /bin/zsh
set -g default-terminal "screen-256color"
set-window-option -g status-left " #S "
set-window-option -g status-left-fg black
@stvkoch
stvkoch / git-reset-author.sh
Created February 3, 2019 11:53 — forked from bgromov/git-reset-author.sh
Git: reset author for ALL commits
#!/bin/sh
# Credits: http://stackoverflow.com/a/750191
git filter-branch -f --env-filter "
GIT_AUTHOR_NAME='Newname'
GIT_AUTHOR_EMAIL='new@email'
GIT_COMMITTER_NAME='Newname'
GIT_COMMITTER_EMAIL='new@email'
" HEAD
@stvkoch
stvkoch / rx.js.md
Last active October 15, 2018 16:27
RX.js

RX.js

Terms: observable, observer, subscribe, Subject, BehaviorSubject, ReplaySubject, AsyncSubject, subscription, multicast, publish, publishReplay, publishBehavior, publishLast

Observable, Observer e Subscribe.

@stvkoch
stvkoch / index.html
Last active May 31, 2018 14:20
React 16.3 new context api and rxjs
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script src="https://unpkg.com/@reactivex/rxjs@5.0.3/dist/global/Rx.js"></script>