Skip to content

Instantly share code, notes, and snippets.

@migliori
migliori / Convert snake_case variables to smallCamelCase
Created May 20, 2024 09:28
untitled #python #snake_case #smallCamelCase
###
# This script converts $my_variable (snake_case) to $myVariable (smallCamelCase) in the given file or in the given folder and all its subfolders recursively.
import os
import re
def snake_to_camel(snake_str):
components = snake_str.split('_')
return components[0] + ''.join(x.title() for x in components[1:])
@migliori
migliori / proxy-logger.js
Created February 13, 2024 06:23
Javascript logging proxy - logs constructor and method calls made to a target object #debug #log
/**
* This file contains a logging proxy implementation that can be used to log constructor and method calls made to a target object.
* The `createLoggingProxy` function creates a logging proxy for a target object, which logs all constructor and method calls made to the target.
* The `LoggedMyClass` class is an example usage of the logging proxy, where an instance of `MyClass` is wrapped with the logging proxy to log its calls.
* The purpose of this file is to provide a utility for logging and tracking calls made to objects, which can be useful for debugging and monitoring purposes.
*/
/**
* A counter for the number of calls made to the proxy.
* @type {number}
@migliori
migliori / addAttendee.php
Last active February 13, 2024 06:34 — forked from AFelipeTrujillo/addAttendee.php
Use Google Calendar API #google #api
<?php
include_once 'google-api-php-client/vendor/autoload.php';
$client = new Google_Client();
$application_creds = 'service-account-credentials.json';
$credentials_file = file_exists($application_creds) ? $application_creds : false;
define("SCOPE",Google_Service_Calendar::CALENDAR);
define("APP_NAME","Google Calendar API PHP");
@migliori
migliori / vue-vue-router-global-lifecycle.md
Last active February 13, 2024 06:27
Vue + Vue router global lifecycle with a main route, a child route + a component inside the child route #vuejs

Vue + Vue router global lifecycle

with a main route, a child route + a component inside the child route

Legend

Item Target
MAIN main router-view
@migliori
migliori / sonarqube cheatsheet.md
Last active February 13, 2024 06:52
SonarQube Cheatsheet #sonarqube #api

SonarQube Cheatsheet

Start / Stop SonarQube server

// start
C:\sonarqube\bin\windows-x86-64\StartSonar.bat

// stop
@migliori
migliori / cpanel-whm.md
Last active February 13, 2024 06:29
cPanel & WHM Memo #server #cpanel #whm

cPanel & WHM Memo

Install PHP extension

  • WHM -> Software -> Module Installers -> PHP Pecl (manage).
  • "Install a PHP Pecl"
  • Restart Apache.
@migliori
migliori / mod_pagespeed cheatsheet.md
Last active February 13, 2024 06:29
Apache mod_pagespeed cheatsheet #server #apache #mod_pagespeed

mod_pagespeed setup with WHM & cPanel

to add instructions to apache httpd.conf:

  • open WHM
  • go to Apache Configuration
  • open Include Editor & choose Pre VirtualHost Include
  • add instructions, ie:
  ModPagespeedEnableFilters add_instrumentation
  ModPagespeedMessageBufferSize 100000
@migliori
migliori / scroll-to-anchor.js
Last active May 8, 2018 08:11
Smooth scroll to anchor
// anchors smooth scroll
$('a[href^="#"]').on('click', function() {
var $targetLink = $('#' + $.attr(this, 'href').substr(1)),
dataToggle = $(this).attr('data-toggle');
if($targetLink[0] && dataToggle != 'modal' && dataToggle != 'collapse') {
$('html, body').animate({
scrollTop: $targetLink.offset().top - 110
}, 500);
}
@migliori
migliori / scss-cheatsheet.scss
Last active February 13, 2024 06:30
SCSS Cheatsheet #scss #cheatsheet
//Single line comments are removed when Sass is compiled to CSS.
/* Multi line comments are preserved. */
/* Variables
============================== */
$body-color: #555;
$body-font: 'Roboto', sans-serif;
@migliori
migliori / README.md
Last active February 13, 2024 06:30
Bulk RECURSIVE Image Optimizer - PHP Ajax - from https://github.com/spatie/image-optimizer #optimization

Bulk Image Optimizer

Recursive image optimizer - optimize all the images in a parent folder and all its subdirectories without deph limitation.

Instructions

  1. Install spatie image optimizer with Composer: composer require spatie/image-optimizer
  2. Install all the optimizers on Linux server (SSH):