Skip to content

Instantly share code, notes, and snippets.

FieldException: Attempt to create field name <em class="placeholder">logged_item_type</em> which already exists and is active. in field_create_field() (line 85 of /Users/martindean/Sites/drupal-core/modules/field/field.crud.inc).
@Mizpah
Mizpah / genima_log.install
Created November 27, 2014 00:29
How to account for different bundles in the installer? Currently my second field (bug_status) has no active instance. I guess I need logic in and around lines 38-42?
<?php
/**
* @file
* Contains content installed by the module.
*
* Created by PhpStorm.
* User: martindean
* Date: 26/11/14
* Time: 05:14
*/
@Mizpah
Mizpah / genima_log.module
Created November 26, 2014 06:41
The array, returning an error from code sniffer
/**
* Implements hook_node_info().
*/
function genima_log_node_info() {
// Returns an array defining a new node type.
return array(
'logged_item' => array(
'name' => t('Logged Item'),
'base' => 'genima_logged_item',
@Mizpah
Mizpah / Export_Feed_Configuration.txt
Created May 22, 2014 06:38
SQL Error importing XML via XPath XML Parser & Feeds
$feeds_importer = new stdClass();
$feeds_importer->disabled = FALSE; /* Edit this to true to make a default feeds_importer disabled initially */
$feeds_importer->api_version = 1;
$feeds_importer->id = 'items_import';
$feeds_importer->config = array(
'name' => 'Items Import',
'description' => 'Import WildStar item data from XML',
'fetcher' => array(
'plugin_key' => 'FeedsFileFetcher',
'config' => array(
@Mizpah
Mizpah / error1_debug_output.txt
Last active August 29, 2015 14:01
A detailed breakdown of the two alternate errors using Feeds & Feeds Xpath Parser to import XML nodes. Please see readme.txt for details.
Wildstar Item Import 51 has been created.
context :
<N K="tItemDb" T="t"> <N F="37671" T="t"> <N K="tItemInfo" T="t"> <N K="nPowerLevel" T="n" V="48"/> <N K="sIcon" T="s" V="IconSprites:Icon_ItemArmor_Heavy_Armor_Shoulders_01"/> <N K="nItemPower" T="n" V="1434"/> <N K="tPrimary" T="t"> <N K="strName" T="s" V="Mutagen Shoulder Plates"/> <N K="eCategory" T="n" V="3"/> <N K="tLevelRequirement" T="t"> <N K="nLevelRequired" T="n" V="48"/> <N K="bRequirementMet" T="b" V="-"/> </N> <N K="nId" T="n" V="37671"/> <N K="bDestroyOnLogout" T="b" V="-"/> <N K="tCost" T="t"> <N K="nBuyCost" T="n" V="78384"/> <N K="nSellValue" T="n" V="15676"/> </N> <N K="tDurability" T="t"> <N K="nMax" T="n" V="71"/> </N> <N K="eType" T="n" V="18"/> <N K="tStack" T="t"> <N K="nMaxCount" T="n" V="1"/> </N> <N K="arInnateProperties" T="t"> <N F="1" T="t"> <N K="nSortOrder" T="n" V="3"/> <N K="eProperty" T="n" V="42"/> <N K="nValue" T="n" V="1496"/> </N> </N> <N K="tProfRequirement" T="t"> <N K="nId" T="n" V="2"/> <N K="bRequirementMet" T="b"
@Mizpah
Mizpah / application.html.erb
Created March 6, 2013 05:04
I am trying to dynamically change the output of <%= render 'layouts/header %> called from application.html.erb, based on the controller. I have just created a namespaced admin controller, accessible under /admin The controller is Admin::DashboardController. Based on inheritance, I have to place my alternate version of the partial _header.html.er…
<!DOCTYPE html>
<html>
<head>
<title><%= full_title(yield(:title)) %></title>
<%= stylesheet_link_tag "application", media:" all" %>
<%= javascript_include_tag "application" %>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="<%= content_for?(:description) ? yield(:description) : "mmofish" %>">
<%= csrf_meta_tags %>
<%= render 'layouts/shim' %>
@Mizpah
Mizpah / new_seeds.rb
Created March 5, 2013 12:08
Trying to work out the syntax of a seeds.rb file for a rake:dbseed command. I have a reference - the first file -- however in my example I do not have an entity 'name' in my db, I have the entity 'username'. Clearly I am not identifying correctly that the user is both the reference to the column, and an object - So after several attempts I guess…
puts 'DEFAULT USERS'
user = User.find_or_create_by_email :username => ENV['ADMIN_NAME'].dup, :email => ENV['ADMIN_EMAIL'].dup,
:password => ENV['ADMIN_PASSWORD'].dup, :password_confirmation => ENV['ADMIN_PASSWORD'].dup
puts 'username: ' << user.username
user.add_role :admin
@Mizpah
Mizpah / gemfile
Created March 2, 2013 01:13
gemfile
# mmofish gemfile -- DO NOT MODIFY without speaking to Mizpah!
source 'https://rubygems.org'
# We have chose to use a pessamistic versioning constraint (~>2.1) during development
# in some cases, amd latest versions (optimistic constraint) (=>2.1) in others.
# This iwll be reviewed for production
gem 'rails', '~>3.2'
# Bundle edge Rails instead (initiate for testing only):
@Mizpah
Mizpah / gist:5069033
Created March 2, 2013 00:31
Running: rake assets:precompile rake aborted! undefined method `[]' for nil:NilClass The below output shows sequence from passing tests through to error. I have also tried to tun a local precom,pile (google tip, and then output that with a trace)
Finished in 0.59557 seconds
13 examples, 0 failures, 2 pending
<-- Slave(2) run done!
Martin@BALOO /g/Aptana Studio 3 Workspace/mmofish (master)
$ git push heroku master
Enter passphrase for key '/c/Users/Martin/.ssh/id_rsa':
Counting objects: 44, done.
@Mizpah
Mizpah / _game_classes.html.erb
Created February 25, 2013 23:31
Initially built with scaffold, edit and show links were working. After working extensively on index (ajaz, paging, sorting, search fielkds, partials), I have discovered they are no longer working! For example the show.html.erb gives me: undefined method `name' for nil:NilClass when executing <%= @game_class.name % However, the show method is def…
<%= hidden_field_tag :direction, params[:direction] %>
<%= hidden_field_tag :sort, params[:sort] %>
<table class="pretty">
<thead>
<tr>
<th><%= sortable "name" %></th>
<th>Description</th>
<th><%= sortable "game_id" %></th>
<th></th>
<th></th>