Skip to content

Instantly share code, notes, and snippets.

View Morasta's full-sized avatar

Matt Viehdorfer Morasta

View GitHub Profile
@Morasta
Morasta / d7_field_collection-feeds_integration.patch
Created April 17, 2014 19:40
Drupal 7 Field Collection Feeds Integration Patch
diff --git a/field_collection.module b/field_collection.module
index 9da8350..6610fa6 100644
--- a/field_collection.module
+++ b/field_collection.module
@@ -1142,3 +1142,87 @@ function field_collection_devel_generate($object, $field, $instance, $bundle) {
return array('value' => $field_collection->item_id);
}
+
+/**
@Morasta
Morasta / add-om-maximenu-parentclass
Last active August 29, 2015 14:01
Drupal 7: Add class to om-maximenu parent item
$('.om-maximenu-content').hover(
function () {
$(this).parent().addClass('active-parent-li');
},
function () {
$(this).parent().removeClass('active-parent-li');
}
);
@Morasta
Morasta / autolink
Created June 6, 2014 18:39
Convert plain text URLs in a string to clickable links
@Morasta
Morasta / ie_console_fix.js
Created June 10, 2014 16:21
IE console fix
/**
* Protect window.console method calls, e.g. console is not defined on IE
* unless dev tools are open, and IE doesn't define console.debug
* Source: http://stackoverflow.com/questions/3326650/console-is-undefined-error-for-internet-explorer
*/
(function() {
if (!window.console) {
window.console = {};
}
// union of Chrome, FF, IE, and Safari console methods
<?php
function win_time($timestr) {
return substr($timestr, 4, 2) . "/" . substr($timestr, 6, 2) . "/" .
substr($timestr, 0, 4) . " " . substr($timestr, 8, 2) . ":" .
substr($timestr, 10, 2) . ":" . substr($timestr, 12, 2) . " " .
substr($timestr, -4);
};
?>
@Morasta
Morasta / applescript_wine_launcher
Created July 21, 2014 22:36
AppleScript Homebrew Wine Launcher
-- main.scpt
-- Cocoa-AppleScript Applet
tell application "Terminal"
activate
do shell script "/usr/local/bin/wine '/Users/<user>/.wine/drive_c/Program Files/<programdir>/<program.exe>'"
end tell
@Morasta
Morasta / drupal_importable_node_export
Created October 2, 2014 21:50
Drupal: Export node for reimport
<?php
// Enter node NID to export.
$nid = 1234;
// Use Drupal's export utility to convert the object to code.
include_once DRUPAL_ROOT . '/includes/utility.inc';
$export = drupal_var_export(node_load($nid));
// Strip node NIDs and VIDs, so it imports cleanly.
@Morasta
Morasta / jqueryGetUrlVars
Created October 22, 2014 19:02
jquery getUrlVars extension
//adapted from http://stackoverflow.com/questions/6001839/check-whether-a-url-variable-is-set-using-jquery
//modified to return empty array when no ? params are set
$.extend({
getUrlVars: function(){ //return all vars set in $_GET
var vars = [], hash;
if (window.location.href.indexOf('?') != -1) {
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++)
{
hash = hashes[i].split('=');
@Morasta
Morasta / csvtolookups.py
Created November 20, 2014 23:52
CSVToLookups
#Separates columns in a CSV into individual files with unique values per field
# Useful for generating lookup tables with unique values from the original csv's field
#
# Room for implementation improvement, but this works as a quick and dirty solution
#!/usr/bin/python
import csv
from distutils.util import strtobool
@Morasta
Morasta / changeFirefoxSearchProvider.ps1
Created March 9, 2015 16:52
Change Firefox Search Provider Script
# Originally from http://www.adminarsenal.com/admin-arsenal-blog/powershell-silently-change-firefox-default-search-providers-for-us
$Provider = "Google"
# Default valid provider options:
# Amazon.com, Bing, DuckDuckGo, eBay, Google, Twitter, Wikipedia (en), Yahoo
# This disclaimer is required verbatim...
$Disclaimer = "By modifying this file, I agree that I am doing so only "
$Disclaimer += "within Firefox itself, using official, user-driven search "
$Disclaimer += "engine selection processes, and in a way which does not "