Skip to content

Instantly share code, notes, and snippets.

View dasginganinja's full-sized avatar

Tom Donahue dasginganinja

  • Lehigh University
  • Bethlehem, PA
View GitHub Profile
@dasginganinja
dasginganinja / Box Setup.txt
Created December 3, 2013 14:09
A little look at what's going on with FileConveyor & Cumulus / Rackspace Cloudfiles ERROR
Jeremys-Mac:squeeze-20131203 james$ vagrant box list
Debian 6 Squeeze x64 according to documentation (virtualbox)
Jeremys-Mac:squeeze-20131203 james$ vagrant init "Debian 6 Squeeze x64 according to documentation"
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
Jeremys-Mac:squeeze-20131203 james$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
[default] Importing base box 'Debian 6 Squeeze x64 according to documentation'...
@dasginganinja
dasginganinja / RatRace.php
Last active December 30, 2015 04:29
I absolutely love GoTos and I don't know why..
<?php
/**
* Retrieves the title of the Content Item with the given filepath
*/
function km_zipcart_get_title($file) {
// Start our query with searching for the file
$qf = db_select('file_managed','fm');
$qf->condition('fm.filename',$file,'=');
// Get the fields we need
$qf->fields('fm', array('fid','filename'));
@dasginganinja
dasginganinja / FSARetrieval.js
Last active August 29, 2015 13:58
Canadian FSA Retrieval from WIkipedia. Provides a comma delimited list. Example URL: http://en.wikipedia.org/wiki/List_of_B_postal_codes_of_Canada
(function($) {
var fsas = [];
$('table td:not([style]) b').each(
function() {
var val = $(this).text();
if (val.length == 3) {
fsas.push(val);
}
});
var csv = fsas.sort().join(',');
@dasginganinja
dasginganinja / PFMChooser.js
Created July 2, 2014 19:46
I didn't like the pager on a website so I created this.
if ($('.chooser').length == 0) {
var pagearr = [];
var $pageSel = $('<select class="chooser">').hide();
var pageMax = parseInt($('.pager').data('pages'));
var pageCur = parseInt($('.pager').data('currentpage'));
for(i=0;i<pageMax;++i) {
if (i < 5 || i >= (pageMax-5) || (i+1)%10 == 0 || ((i > pageCur-5) && (i < pageCur + 5))) {
pagearr.push({ val: i+1, text: (i+1)+" / "+pageMax });
}
}
@dasginganinja
dasginganinja / sh_drupal_language.php
Last active May 10, 2016 11:30
Drupal Bulk Language Changer (Uses Views Bulk Options)
$view = new view();
$view->name = 'sh_drupal_languages';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'sh_drupal_languages';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
@dasginganinja
dasginganinja / showTranslationsLinks.js
Created August 13, 2014 17:49
Drupal Field Translation links (from fields list in admin)
@dasginganinja
dasginganinja / km_hydraulics_sales_directory.module
Created January 26, 2015 18:14
Drupal 7 hook_menu local task troubles. Trying to add a local task to import/sales_person_importer/prepare_csv.
Feeds Paths:
Feeds Import -> import/%/ path definitions -> http://cgit.drupalcode.org/feeds/tree/feeds.module#n293
Feeds UI -> admin/structure/feeds/% path definitions -> http://cgit.drupalcode.org/feeds/tree/feeds_ui/feeds_ui.module#n46
@dasginganinja
dasginganinja / template.php
Created January 28, 2015 15:35
Drupal 7 Remove Breadcrumb and Title from homepage
function east_penn_trucks_20141222_preprocess_page(&$vars, $hook) {
// Remove the Breadcrumb and Title from the homepage
if ($vars['is_front']) :
$vars['breadcrumb'] = '';
$vars['title'] = '';
endif;
}
// Main containers
.container
@include outer-container
// Rows
.row
@include row()
// A basic column without a defined width or height
@dasginganinja
dasginganinja / template.php
Created July 8, 2015 13:52
Customizing Page Title for User View pages
/**
* Implements hook_menu_alter().
*/
function MYTHEME_menu_alter(&$items) {
$items['user/%user']['title callback'] = 'MYTHEME_user_page_title';
}
/**
* Custom Callback for setting page title.
*/