Skip to content

Instantly share code, notes, and snippets.

View michelefenu's full-sized avatar
:octocat:
The code was never the important part

Michele Fenu michelefenu

:octocat:
The code was never the important part
  • inpeco
  • Cagliari
  • 04:20 (UTC +02:00)
View GitHub Profile
@michelefenu
michelefenu / replace-text.js
Created February 21, 2022 10:57
Replace all text in a webpage with random characters
"use strict";
function isExcluded(elm) {
if (elm.tagName == "STYLE") {
return true;
}
if (elm.tagName == "SCRIPT") {
return true;
}
if (elm.tagName == "NOSCRIPT") {
@michelefenu
michelefenu / autojump.js
Last active February 18, 2022 08:02
Chrome tRex autojump
const autoJump = () => {
const instance = window.Runner.instance_;
const dino = instance.tRex;
const nextObstacle = instance.horizon.obstacles.filter(
(x) => x.xPos > dino.xPos
)[0];
if (nextObstacle && nextObstacle.xPos - dino.xPos < 120) {
dino.startJump(100);
@michelefenu
michelefenu / sentence-case.pipe.ts
Last active November 25, 2021 15:08
Angular Sentence Case pipe
import { Pipe, PipeTransform } from '@angular/core';
/**
* Pipe to convert a string to sentence case, meaning the first letter of each **sentence** is capitalized.
*
* @example
* {{ 'i am a string. and me too.' | sentenceCase }} => I am a string. And me too.
*
* @example
* {{ 'I AM A STRING. AND ME TOO.' | sentenceCase:true }} => I am a string. And me too.
@michelefenu
michelefenu / hello.md
Last active November 21, 2020 18:37
Advent Of Code 2020

Advent of Code 2020

Hi! 👋

@michelefenu
michelefenu / test-performance.js
Created October 21, 2020 07:36
JavaScript Array vs for performance test
const numbers = [...Array(100000000).keys()]
const startTime = new Date()
// -- for
let result = 0
for (let i = 0; i < numbers.length; i++) {
const number = numbers[i]
if (number % 2 === 0) {
result = result + number * 2
}
@michelefenu
michelefenu / vi-color-schemes
Last active October 1, 2020 10:07
VI editor snippets
ls -l /usr/share/vim/vim*/colors/
-rw-r--r-- 1 root wheel 3274 Sep 4 2019 README.txt
-rw-r--r-- 1 root wheel 2476 Sep 4 2019 blue.vim
-rw-r--r-- 1 root wheel 2990 Sep 4 2019 darkblue.vim
-rw-r--r-- 1 root wheel 548 Sep 4 2019 default.vim
-rw-r--r-- 1 root wheel 2522 Sep 4 2019 delek.vim
-rw-r--r-- 1 root wheel 2812 Sep 4 2019 desert.vim
-rw-r--r-- 1 root wheel 1666 Sep 4 2019 elflord.vim
-rw-r--r-- 1 root wheel 2452 Sep 4 2019 evening.vim
@michelefenu
michelefenu / README.md
Last active October 1, 2020 09:46
Wodpress Child Theme
  1. Create a new directory inside wp-content/styles and name it parentthemename-child
  2. Create a file style.css using the snippet provided in this gist
  3. If you want to append the parent theme stylesheet copy the file functions.php in the same directory