Skip to content

Instantly share code, notes, and snippets.

View entendu's full-sized avatar

Domenic Santangelo entendu

View GitHub Profile
dest="../dst-test"; find . -type d -mindepth 1 -exec mkdir -p "$dest/"{} \; find . -type f -print0 | while IFS= read -r -d '' file; do if [[ "$(basename "$(dirname "$file")")" =~ ^[0-9]{4} ]]; then newfile=$(basename "$file"); else newfile=$file; fi; if [[ -f "$dest/$newfile" ]]; then i=1; until [[ ! -f "$dest/$newfile-$i" ]]; do ((i++)); done; newfile="$file-$i"; fi; echo "mv $file $dest/$newfile"; done
@entendu
entendu / controllers.application.js
Last active October 9, 2019 04:29 — forked from mike-north/controllers.application.js
EmberLearn - Ember.Object
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});

Keybase proof

I hereby claim:

  • I am entendu on github.
  • I am entendu (https://keybase.io/entendu) on keybase.
  • I have a public key ASC5jvK9J7KO1StVm0uTAaVxWIM6hL40b7soBu0A1lPLogo

To claim this, I am signing this object:

@entendu
entendu / mkto2.js
Created March 18, 2016 19:58
Dyamically setting Marketo form field values
MktoForms2.loadForm("//app-XXXX.marketo.com", "XXX-XXX-XXX", formID, function(form) {
form.setValues({
// Update this with the field/value.
"my_field": "my value!"
}, function(k, v){var o={};o[k]=v;form.addHiddenFields(o)});
});
@entendu
entendu / mkto1.js
Created March 18, 2016 19:35
Set Marketo fields
MktoForms2.loadForm("//app-sjXX.marketo.com", "XXX-XXX-XXX", formID, function(form) {
var myUTM = your_utm_function(); // This function is your custom logic to retrieve the user's UTM codes.
form.setValues({
"utm_source": myUTM.source;
"utm_campaign": // etc etc
});
});
@entendu
entendu / drupal-track-print.js
Last active March 16, 2016 18:10
Track when people print a page on your Drupal site thru Google Analytics events.
/**
* Track a Google Analytics event when people print.
*
* Inserts print-only CSS that's an image link to the GA collector, so it's only
* fired when someone tries to print.
*
* Inspired by https://sites.google.com/site/thedigitalinspiration/how-to-guides/use-google-analytics-to-track-when-people-print-your-web-pages
* and updated with a better tracking method for analytics.js.
*
* @author Domenic Santangelo <dsantangelo@magento.com>

Keybase proof

I hereby claim:

  • I am entendu on github.
  • I am entendu (https://keybase.io/entendu) on keybase.
  • I have a public key whose fingerprint is A738 472C 98EF 53B0 0EC5 E430 F647 2249 BC0D E00B

To claim this, I am signing this object:

<?php
 $result = db_query("SELECT nid FROM node WHERE type IN ('how_to','quick_start_guides')");
 $i = 1;
 $total = $result->rowCount();
 $types = array('how_to' => array(), 'quick_start_guides' => array(), 'document' => array());
 foreach ($result as $row) {
   $node_comment = node_load($row->nid);
   $types[$node_comment->type][] = $row->nid;
//    $node_comment->comment = "2";
   node_save($node_comment);
# $Id$
# vim:et:ft=sh:sts=2:sw=2
#
# Copyright 2008 Kate Ward. All Rights Reserved.
# Released under the LGPL (GNU Lesser General Public License)
#
# shFlags -- Advanced command-line flag library for Unix shell scripts.
# http://code.google.com/p/shflags/
#
# Author: kate.ward@forestent.com (Kate Ward)