Skip to content

Instantly share code, notes, and snippets.

@siamkreative
siamkreative / disable-bloatware-xiaomi-phones.md
Last active February 18, 2024 11:07
Disabling bloatware on Xiaomi phones

How to disable or uninstall bloatwares on Xiaomi?

This guide is for non-rooted Xiaomi/Redmi/POCO phones.

  1. You will first need to install Android Debug Bridge (ADB): https://developer.android.com/tools/adb. On a Mac, you can install it with Brew: brew install android-platform-tools
  2. To use adb with a device connected over USB, you must enable USB debugging in the device system settings, under Developer options. On a Xiaomi phone, tap the MIUI version multiple times until Developer Options are unlocked. You can then search the Settings for "USB debugging" and enable it.
  3. Connect the phone to your computer via USB. Choose “File Transfer” mode.
  4. Open a terminal and run adb devices
  5. Your phone will prompt to add your computer’s key to allowed, whihc you must agree to.
  6. On the terminal, enter adb shell.
@manfromanotherland
manfromanotherland / formspree.html
Last active July 30, 2021 07:05
JS: Ajax send forms using the most excellent Formspree » http://formspree.io #snippet
<form id="contact-form" action="//formspree.io/your@email.com" method="post">
<input type="text" name="Name" placeholder="Name" required>
<input type="email" name="Email" placeholder="Email" required>
<textarea name="Message" cols="30" rows="6" placeholder="Message" required></textarea>
<!-- CONFIG -->
<input class="is-hidden" type="text" name="_gotcha">
<input type="hidden" name="_subject" value="Subject">
<input type="hidden" name="_cc" value="email@cc.com">
<!-- /CONFIG -->
<input class="submit" type="submit" value="Send">
@mathetos
mathetos / smart-excerpts
Last active May 17, 2016 19:43
Smart Excerpts
<?php
/*
* This asks first for a Yoast SEO meta description,
* If that's not present, then it asks for the excerpt of the post,
* If that's not present, then it strips the content
* In this case, I have an excerpt length setting in the Customizer
* Both the excerpt and content stripping, also strip shortcodes
* @author Matt Cromwell <reachme@mattcromwell.com>
* @copyright Copyright (c) 2014, Matt Cromwell
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
@georgiecel
georgiecel / wp-comment-callback
Created March 9, 2014 09:09
Custom callback for HTML5 friendly WordPress comment. Also includes schema.org microdata. To use, insert the following into comments.php: <?php wp_list_comments('callback=better_comment&end-callback=better_comment_close'); ?>
// awesome semantic comment
function better_comment($comment, $args, $depth) {
$GLOBALS['comment'] = $comment;
extract($args, EXTR_SKIP);
if ( 'article' == $args['style'] ) {
$tag = 'article';
$add_below = 'comment';
} else {
@gruber
gruber / Liberal Regex Pattern for Web URLs
Last active April 22, 2024 19:02
Liberal, Accurate Regex Pattern for Matching Web URLs
The regex patterns in this gist are intended only to match web URLs -- http,
https, and naked domains like "example.com". For a pattern that attempts to
match all URLs, regardless of protocol, see: https://gist.github.com/gruber/249502
# Single-line version:
(?i)\b((?:https?:(?:/{1,3}|[a-z0-9%])|[a-z0-9.\-]+[.](?:com|net|org|edu|gov|mil|aero|asia|biz|cat|coop|info|int|jobs|mobi|museum|name|post|pro|tel|travel|xxx|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|dd|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|s
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active April 22, 2024 01:47
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@Viper007Bond
Viper007Bond / whatissoslow.php
Last active October 29, 2023 14:23
WordPress: Times how long it takes each filter and action to run and displays results at the end of the page. Quick and dirty.
<?php
/**
* This little class records how long it takes each WordPress action or filter
* to execute which gives a good indicator of what hooks are being slow.
* You can then debug those hooks to see what hooked functions are causing problems.
*
* This class does NOT time the core WordPress code that is being run between hooks.
* You could use similar code to this that doesn't have an end processor to do that.
*