Skip to content

Instantly share code, notes, and snippets.

@zArubaru
zArubaru / root-your-unihertz-atom-the-easy-way.md
Last active February 16, 2024 08:46
Root Your Unihertz Atom the Easy Way

Root Your Unihertz Atom the Easy Way

WARNING! This method will RESET your device. Remember backups, you know the drill. ;)

This guide targets the Unihertz Atom, it might work for other devices also. If you're trying to root an other android device, I highly recommend doing more research and reading the Magisk Installation Guide carefully.

This guide was written with Windows 10 in mind, but the given commands are general. On Windows, all commands with either adb or fastboot should be replace with .\adb.exe and .\fastboot.exe respectively (more on this later). The guide should work with other systems (MacOS, Linux, etc.) aswell.

WARNING! This will unlock your bootloader, I don't recommend relocking the bootloader, as in the worst case scenario you might get completely locked out of your device.

@zArubaru
zArubaru / thriv-times-2023-01.js
Created January 31, 2023 13:28
Thriv Times 1/2023
// Short answer, which fails on erroneous input.
const sumOfEveryOther = number =>
number.toString().match(/\d/g)
.reduce(
(result, currentNumber, currentIndex) =>
currentIndex % 2
? result + +currentNumber
: result
, 0);
@zArubaru
zArubaru / vesikefiiri.md
Last active May 27, 2020 19:13
Vesikefiiri

Vesikefiiri

Ainesosat

  • n. 1 l vettä (jos käytät hanavettä, suosittelen, että annat veden seistä vähintään muutaman tunnin isossa astiassa, jotta pääsee edes osa vedenpuhdistamon kemikaaleista haihtumaan)
  • n. 0.75-1 dl sokeria (suosittelen luomu ruoko hyvän tasasen maun vuoksi, tai intiaanisokeria jos haluaa vahvempaa)
  • kefiirinsiemeniä (määrä vaikuttaa enimmäkseen valmistunopeuteen).

Muuta huomioitavaa

Ensimmäisen kuukauden aikana kefiirinsiement totuttelevat uuteen ympäristöön. Voi kestää, että maku ja vahvuus tasaantuu.

Vesikefiirin juominen kannattaa aloittaa hitaasta 1-2 dl päivässä, muuten voi seurata mm. ilmavaivoja. Jotkut suosittelevat myös, että silloin tällöin pitää muutaman päivän tauon vesikefiirin juomisesta (itse en tätä tee).

@zArubaru
zArubaru / mapValuesDeep.js
Created April 6, 2020 13:19
lodash/fp mapValuesDeep
import fp from 'lodash/fp';
const mapValuesDeep = (callback, value) => {
if (fp.isArray(value)) {
return fp.map(value => mapValuesDeep(callback, value), value);
} else if (fp.isObject(value)) {
return fp.mapValues(value => mapValuesDeep(callback, value), value);
} else {
return callback(value);
}
@zArubaru
zArubaru / mobile-menu.js
Last active November 11, 2019 13:32
Basic mobile menu functionality with tab cycle locking
import $ from 'jquery';
export default function() {
const $body = $('body');
const $hamburger = $('.js-header-hamburger');
const $mobileMenu = $('.js-mobile-menu');
const $lastMenuItem = $mobileMenu.find('a').last();
const $close = $('.js-mobile-menu-close');
const $content = $('.js-mobile-menu-content');
@zArubaru
zArubaru / filter_language_navigation.php
Created August 30, 2019 15:07
Wordpress: Filter polylang language navigation
<?php
// Only show the provided languages in the language navigation (for polylang).
add_filter(
'wp_nav_menu_objects',
function ( $sorted_menu_items, $args ) {
if ( 'language_navigation' !== $args->theme_location ) {
return $sorted_menu_items;
}
return array_filter(
$sorted_menu_items,
@zArubaru
zArubaru / fix-envira-gallery.php
Created January 16, 2019 12:39
Fix corrupted serialized Envira Gallery Lite data.
@zArubaru
zArubaru / the_seo_framework_image_output.php
Last active February 21, 2019 03:36
Limit The SEO Framework og:image and twitter:image sizes.
<?php
// Edit these to suit your needs
add_image_size( 'og-image', 1200, 630, true );
add_image_size( 'twitter-image', 1024, 512, true );
/**
* Limit The SEO Framework og:image and twitter:image sizes.
*
* For: https://fi.wordpress.org/plugins/autodescription/
*/
@zArubaru
zArubaru / polylang-resync-taxonomoy-translations.php
Created February 13, 2018 10:24
Resync WordPress posts' taxonomy translations
<?php
/**
* "Resync" WP posts' taxonomy translations.
*
* This can either run after the `php` command,
* followed with CTRL+D x2 (OR x3), or included
* as a file in `php -a` interactive mode:
*
* https://jondavidjohn.com/interactive-wordpress-php-shell/
*/