Skip to content

Instantly share code, notes, and snippets.

View jubstuff's full-sized avatar

Giustino Borzacchiello jubstuff

View GitHub Profile
@jubstuff
jubstuff / utm_track.js
Created September 19, 2024 11:22
A simple utm link passthrough
(function() {
// Helper function to get UTM parameters from the URL
function getUTMParams() {
const urlParams = new URLSearchParams(window.location.search);
const utmParams = {};
['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content'].forEach(param => {
if (urlParams.has(param)) {
utmParams[param] = urlParams.get(param);
}
});
{"traceEvents":[{"pid":2460,"tid":2490,"ts":121298953076,"ph":"X","cat":"toplevel","name":"ThreadController::Task","dur":4,"tdur":3,"tts":205,"args":{"src_file":"../../base/task/sequence_manager/task_queue_impl.cc","src_func":"PushOntoDelayedIncomingQueue"}},{"pid":2460,"tid":2490,"ts":121298953075,"ph":"X","cat":"disabled-by-default-devtools.timeline","name":"RunTask","dur":22,"tdur":21,"tts":204,"args":{}},{"pid":2460,"tid":2490,"ts":121298953010,"ph":"X","cat":"toplevel","name":"ThreadControllerImpl::RunTask","dur":89,"tdur":86,"tts":142,"args":{}},{"pid":2460,"tid":2490,"ts":121298953101,"ph":"X","cat":"toplevel","name":"ThreadControllerImpl::RunTask","dur":1,"tdur":0,"tts":230,"args":{}},{"pid":2460,"tid":2490,"ts":121299954136,"ph":"X","cat":"toplevel","name":"ThreadController::Task","dur":11,"tdur":11,"tts":265,"args":{"src_file":"../../base/task/thread_pool/delayed_task_manager.cc","src_func":"ScheduleProcessRipeTasksOnServiceThread"}},{"pid":2460,"tid":2490,"ts":121299954135,"ph":"X","cat":"disabled-
@jubstuff
jubstuff / format_xls_for_YNAB.sh
Created December 27, 2017 14:20
Format ING direct exported XLS to YNAB compliant CSV
#!/bin/bash
if [ $# -eq 0 ]
then
echo "Usage: $0 filename.xls (where the xls is exported from ING direct website)"
exit 1;
fi
result=$(echo $1 | cut -d . -f1);
result+=".csv";
@jubstuff
jubstuff / cycle_button.js
Created January 20, 2016 15:50
A simple button in React that cycles between multiple states
var GiustinoButton = React.createClass({
getInitialState: function() {
return {
current_state: 1,
name: "A"
};
},
stateSwitcher: function() {
switch(this.state.current_state) {
@jubstuff
jubstuff / check_domains.sh
Created November 2, 2015 07:33
Use this script to check which of the domains contained in file are pointing to the given domain
#!/bin/bash
# Use this script to check which of the domains contained in file are pointing to the
# given domain
# Credits: https://www.euperia.com/linux/howto-get-the-ip-address-of-a-domain-in-a-one-liner/385
# and various Stackoverflow users ^_^
if [ $# -eq 0 ]; then
echo "Usage ${0##*/} path/to/file domain"
@jubstuff
jubstuff / A. setup xip.io in VVV .md
Last active October 5, 2015 20:33
Setup xip.io in VVV
$.ajaxPrefilter(function( options, originalOptions, jqXHR ) {
var data = originalOptions.data;
if( data && data.action === 'ab_session_save' && data.time_from) {
options.data = $.param($.extend(originalOptions.data||{}, {
make: $('#'+$options.makeId).find("option:selected").text(),
model: $('#'+$options.modelId).find("option:selected").text(),
version: $('#'+$options.versionId).find("option:selected").text()
}));
}
@jubstuff
jubstuff / index.html
Last active August 29, 2015 14:26
MarionetteJS Example - Static View
<div id="main-region">
<p>This is static</p>
</div>
<script type="text/template" id="static-template">
<p> This is a text rendered by our Marionette App. </p>
</script>
<?php
/*
* Plugin name: Test Rewrite Plugin
* Source: https://jeremyfelt.com/2015/07/17/flushing-rewrite-rules-in-wordpress-multisite-for-fun-and-profit/
* */
add_action( 'admin_bar_menu', 'toolbar_link_to_mypage', 999 );
function toolbar_link_to_mypage( $wp_admin_bar ) {
@jubstuff
jubstuff / bridge-DOM.js
Last active August 29, 2015 14:22
Simple Toggle widget with jQuery or Backbone
var toggleFacet = {
init: function (options, elem) {
this.options = $.extend({}, this.options, options);
this.$elem = $(elem);
this.eventify();
},
options: {
toggleClass: 'facet-collapsed'