Skip to content

Instantly share code, notes, and snippets.

View jubstuff's full-sized avatar

Giustino Borzacchiello jubstuff

View GitHub Profile
@jubstuff
jubstuff / FilterStorage.php
Last active August 29, 2015 14:19
Filter Storage
<?php
/**
* Stores a value and calls any existing function with this value.
*/
class FilterStorage
{
/**
* Filled by __construct(). Used by __call().
*
* @type mixed Any type you need.
@jubstuff
jubstuff / config.yml
Created May 29, 2015 13:59
Create pages in WordPress with Python and Wp-cli
Obj1:
- Obj21
- Obj22
- Obj23
- Obj24
- Obj25
@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'
<?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 / 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>
$.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 / A. setup xip.io in VVV .md
Last active October 5, 2015 20:33
Setup xip.io in VVV
@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 / 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 / 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";