Skip to content

Instantly share code, notes, and snippets.

View warengonzaga's full-sized avatar
🪄
Building Magic Commit (npx magicc)

Waren Gonzaga warengonzaga

🪄
Building Magic Commit (npx magicc)
View GitHub Profile
@warengonzaga
warengonzaga / README.md
Created September 27, 2023 17:01
Recover Ownership of Contract (thirdweb)

Recover Ownership of Contract

This is useful when your admin for your contract has been compromised. For example, when you add balance to your admin address and suddenly your admin balance goes to random address. It is painful to remove your admin address if you don't have a gas to spend to assign a new admin address.

Setup

  1. Do npx thirdweb create app --node --javascript --evm
  2. Rename the .env.example to .env
  3. Copy and paste this to your .env
@warengonzaga
warengonzaga / build_your_own_react.md
Last active September 20, 2023 03:12
React - Plain Javascript

Build Your Own React

Here's the code on how you can build your own react. So you can understand how react works.

@warengonzaga
warengonzaga / git-update-remote-branch-list.md
Created August 29, 2022 08:40
Git - Update Remote Branch List

Update Remote Branch List - Git Commands

  1. Update your remote branch list.
git remote update origin --prune
  1. After that, check your remote branch list.
git branch -a
@warengonzaga
warengonzaga / profiles.yml
Last active April 16, 2022 08:43
Minecraft Configs - FarmControl
# Please visit https://github.com/froobynooby/FarmControl/wiki/Profiles for help with making profiles.
profiles:
###########################################################
# PROACTIVE MODE
###########################################################
# ======================================================= #
# nerf animal farms
@warengonzaga
warengonzaga / git-new-empty-branch.md
Last active March 15, 2022 13:25
Git - New Empty Branch

New Empty Branch - Git Commands

  1. Switch to a new empty branch.
git switch --orphan <branch-name>
  1. Remove all the files, mostly all in the .gitignore file will start to show here.
rm -rf *
@warengonzaga
warengonzaga / logout-without-confirmation.php
Created November 25, 2021 15:10
WP Snippet - Logout Without Confirmation
<?php
// logout without confirmation
function logout_without_confirmation($action, $result) {
if ($action == "log-out" && !isset($_GET['_wpnonce'])) {
$redirect_to = isset($_REQUEST['redirect_to'])?$_REQUEST['redirect_to']:'';
$location = str_replace('&amp;', '&', wp_logout_url($redirect_to));
header("Location: $location");
die;
}
@warengonzaga
warengonzaga / keybase.md
Created May 30, 2021 13:19
Keybase Proof

Keybase proof

I hereby claim:

  • I am warengonzaga on github.
  • I am warengonzaga (https://keybase.io/warengonzaga) on keybase.
  • I have a public key ASCbM3a16TPIOtOhQj0UF3Hf2qBqZt21ZJbfMh_tBgBWzgo

To claim this, I am signing this object:

@warengonzaga
warengonzaga / functions.php
Created January 10, 2020 15:02
Defer JavaScript via functions.php File
function defer_parsing_of_js( $url ) {
if ( is_user_logged_in() ) return $url; //don't break WP Admin
if ( FALSE === strpos( $url, '.js' ) ) return $url;
if ( strpos( $url, 'jquery.js' ) ) return $url;
return str_replace( ' src', ' defer src', $url );
}
add_filter( 'script_loader_tag', 'defer_parsing_of_js', 10 );
@warengonzaga
warengonzaga / usefulgitcmd_keep_fork_updated.md
Last active December 4, 2017 22:55
How to keep your forked repository up to date?

Keep Your Forked Repository Up to Date!

Useful Git Commands

  • Add the remote from your original repository in your forked repository:

git remote add upstream git://github.com/original-developer/original-repository.git
git fetch upstream

  • Update your forked repository by typing the git command below:
@warengonzaga
warengonzaga / media_query_breakpoints.css
Created November 22, 2017 17:58
Media Query Breakpoints for Responsive Web Development.
/* Smartphones (portrait and landscape) ----------- */
@media only screen and (min-device-width : 320px) and (max-device-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) ----------- */
@media only screen and (min-width : 321px) {
/* Styles */
}