Skip to content

Instantly share code, notes, and snippets.

View siamkreative's full-sized avatar

Julien Vernet siamkreative

View GitHub Profile
@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.
@siamkreative
siamkreative / fedora-31-install-webstorm.md
Created February 14, 2020 04:21
Installing WebStorm on Fedora 31
@siamkreative
siamkreative / ruby-mac-m1.md
Last active November 2, 2022 08:31
Quick guide on how to install Ruby on a MacBook M1

Install Ruby on a MacBook Air M1

Prerequisites

  • You already have brew installed (you can double check that everything is setup with brew doctor).
  • Make sure you don’t have RVM, rbenv, or asdf installed (read this)

Installation Steps

  1. Run ruby-install 3.1.2 -- --enable-shared (taken from this article)
<?php
/* Strip out un-supported HTML tags */
$content = strip_tags($content, '<strong><em><del><li><code><pre>');
/* Properly format message */
$content = str_replace(array('<strong>', '</strong>'), array('*', '*'), $content);
$content = str_replace(array('<em>', '</em>'), array('_', '_'), $content);
$content = str_replace(array('<del>', '</del>'), array('~', '~'), $content);
$content = str_replace(array('<li>', '</li>'), array('•', ''), $content);
@siamkreative
siamkreative / french-regions-departments.json
Last active November 26, 2021 02:31
Regions & Departments of France (JSON format). Régions et Départements de France (format JSON). Inspired from https://en.wikipedia.org/wiki/Regions_of_France & https://en.wikipedia.org/wiki/Departments_of_France
{
"regions": {
"alsace": [67, 68],
"aquitaine": [40, 47, 33, 24, 64],
"auvergne": [43, 3, 15, 63],
"basse-normandie": [14, 61, 50],
"bourgogne": [21, 58, 71, 89],
"bretagne": [29, 35, 22, 56],
"centre": [45, 37, 41, 28, 36, 18],
"champagne-ardenne": [10, 8, 52, 51],
@siamkreative
siamkreative / formspree-ajax-contact-form.js
Created March 30, 2016 02:46
A plain JavaScript AJAX Contact Form that is designed to work with http://formspree.io/
/**
* AJAX Form
* http://stackoverflow.com/a/13038218/1414881
*/
var form = document.getElementById('contact_form');
// Append the form status
var formStatus = document.createElement('div');
formStatus.setAttribute('class', 'form-status alert');
@siamkreative
siamkreative / editorEmptyCheck.js
Created March 28, 2016 03:42
Check if a TinyMCE editor is empty in WordPress
jQuery(document).ready(function ($) {
// Check if TinyMCE is active
if (typeof tinyMCE != "undefined") {
$('form').on('submit', function () {
// Get content of active editor
var editorContent = tinyMCE.activeEditor.getContent();
if ((editorContent === '' || editorContent === null)) {
// Do stuff when TinyMCE is empty
}
@siamkreative
siamkreative / pluginLoaded.js
Created March 4, 2016 04:36
Check if a jQuery plugin is loaded. If not, load it using the $.getScript() function.
jQuery(document).ready(function ($) {
'use strict';
function initModal() {
$('.popup-youtube, .popup-vimeo, .popup-gmaps').magnificPopup({
disableOn: 700,
type: 'iframe',
mainClass: 'mfp-fade',
removalDelay: 160,
@siamkreative
siamkreative / cf7-horizontal-form.html
Last active July 14, 2020 23:58
Contact Form 7 Horizontal Form
<div class="form-horizontal">
<div class="form-group"><label class="control-label col-md-3">Full Name</label><div class="col-md-9">[text* your-name class:form-control]</div></div>
<div class="form-group"><label class="control-label col-md-3">Email Address</label><div class="col-md-9">[email* your-email class:form-control]</div></div>
<div class="form-group"><label class="control-label col-md-3">Subject</label><div class="col-md-9">[text your-subject class:form-control]</div></div>
<div class="form-group"><label class="control-label col-md-3">Message</label><div class="col-md-9">[textarea your-message x5 class:form-control]</div></div>
<div class="form-group"><div class="col-md-offset-3 col-md-9">[submit class:btn class:btn-primary "Send"]</div></div>
</div>
@siamkreative
siamkreative / building-cordova-apps-fedora-31-draft.md
Created January 31, 2020 04:38
Building Cordova apps on Fedora 31

Installing and configuring Docker

Install Docker

sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
sudo dnf makecache
sudo dnf install docker-ce

Install Docker-Compose