Skip to content

Instantly share code, notes, and snippets.

View sherakama's full-sized avatar
💭
🇨🇦 Working from home

Sherakama sherakama

💭
🇨🇦 Working from home
View GitHub Profile
@sherakama
sherakama / CCK Machine Name Change
Created November 7, 2013 18:33
How to rename a cck field machine's name in Drupal 7.x
$fields = array(
'field_my_fields' => 'field_my_new_field',
'field_other_field' => 'field_adam_west',
);
// Loop through each of the fields/tables with the old name and change them
foreach($fields as $field_name => $new_field_name) {
// First check that field_name exists
if(!db_table_exists('field_data_' . $field_name)) {
@sherakama
sherakama / multiple-values-xpath.php
Created April 24, 2014 15:43
Feeds Importer X-Path Sub Selector
<?php
/**
* @file
* Feeds Tamper Plugin
* Provides a sub xpath selector for parsing xml for field collections with
* multiple value fields.
*/
/**
* Plugin definition
@sherakama
sherakama / multi_keyword_filter_plugin.inc
Created May 6, 2014 15:15
Feeds tamper plugin for multiple keywords.
<?php
/**
* @file
* Filter based on a list of words/phrases.
* This file is a copy of the default keyword_filter plugin except it has been
* modified to work with an array of values as well as single strings.
*/
$plugin = array(
@sherakama
sherakama / sites.aliases.drushrc.php
Last active March 20, 2018 21:50
Wildcard remote aliases for sites.
<?php
## STANFORD WILDCARD ###########################################################
// The command you just typed in shell.
$command = $_SERVER['argv'];
$remote_user = "sheamck";
// Look at every argument...
foreach ($command as $arg) {
@sherakama
sherakama / su-clone.sh
Last active August 16, 2016 22:36
Clone from sites to local
#!/bin/csh
# If dir exists empty it.
if [ -d /httpdocs/$1.su.dev ]; then
cd /httpdocs/$1.su.dev
drush sql-drop -y
cd ../
sudo rm -Rf /httpdocs/$1.su.dev
fi
@sherakama
sherakama / .bashrc
Last active November 18, 2015 19:21
.bashrc file
export PATH=${PATH}:/usr/local/sbin
export PATH=/usr/local/bin:${PATH}
export PATH=${PATH}:~/bin
export PS1="\u:\w$ "
# alias composer="php /usr/bin/composer.phar"
alias ppp="php app/console"
alias chrome='open -n -a "Google Chrome.app" --args --auth-server-whitelist="*.stanford.edu" --auth-negotiate-delegate-whitelist="*.stanford.edu"'
@sherakama
sherakama / drush.rb
Created August 21, 2015 23:39
brew install drush 7.0-dev
require File.expand_path("/usr/local/Library/Taps/homebrew/homebrew-php/Requirements/php-meta-requirement", __FILE__)
class Drush < Formula
desc "A command-line shell and scripting interface for Drupal"
homepage "https://github.com/drush-ops/drush"
url "https://github.com/drush-ops/drush/archive/7.x.tar.gz"
sha1 "6e648c6056a6a6d738ad5665ce842083b22e7e61"
version "7.0-dev"
head do
@sherakama
sherakama / README.md
Last active February 16, 2018 19:21
Drupal 7 module README.md stubb
@sherakama
sherakama / Delete these
Created September 14, 2015 21:34
Remove these
Github cleanup. Anyone object to deleting these repositories:
https://github.com/SU-SWS/stanford_baseline_roles
https://github.com/SU-SWS/stanford_ownership
https://github.com/SU-SWS/stanford_spotlight
https://github.com/SU-SWS/stanford_document
https://github.com/SU-SWS/stanford_display_categories
https://github.com/SU-SWS/stanford_article
https://github.com/SU-SWS/stanford_thesis_importer
https://github.com/SU-SWS/stanford_thesis_views
https://github.com/SU-SWS/stanford_person_views_english
@sherakama
sherakama / save_images.rb
Last active September 17, 2015 22:56
Pass ignore options to phantom.js for wraith when SSL cert is self signed or not working.
# OSX path: /Library/Ruby/Gems/2.0.0/gems/wraith-2.6.0/lib/wraith/save_images.rb
require "wraith"
require "parallel"
require "shellwords"
class Wraith::SaveImages
attr_reader :wraith, :history, :meta
def initialize(config, history = false)