Skip to content

Instantly share code, notes, and snippets.

@markdboyd
markdboyd / Gruntfile.js
Created April 30, 2015 05:10
Add file copy support for GDT on Windows
module.exports = function(grunt) {
// Load all plugins and tasks defined by the grunt-drupal-tasks package.
require('grunt-drupal-tasks')(grunt);
// Get the OS and set it as a variable.
var os = require('os');
var platform = os.platform();
grunt.config('platform', platform);
@markdboyd
markdboyd / gist:616b41c13a1b71c8f74a
Last active August 29, 2015 14:20
Fix for thick axes - C3
.c3 path.domain {
shape-rendering: crispEdges;
}
@markdboyd
markdboyd / .jscsrc
Last active January 28, 2016 22:13
JSCS config
{
"preset": "node-style-guide",
"requireTrailingComma": false,
"disallowMultipleVarDecl": false,
"requireCurlyBraces": ["else", "for", "while", "do", "try", "catch" ],
"disallowKeywordsOnNewLine": [],
"maximumLineLength": null
}
@markdboyd
markdboyd / migration.js
Last active December 29, 2021 14:12
Drop constraint from Sequelize model
// Remove constraint and index
queryInterface.sequelize.query(
'ALTER TABLE "project" DROP CONSTRAINT IF EXISTS project_name_key;'
).then(function() {
return queryInterface.removeIndex('project', 'project_name_key');
});
// Add unique constraint and index
queryInterface.addIndex('project', ['name'], {
indexName: 'project_name_key',
@markdboyd
markdboyd / d7.make
Last active March 2, 2016 18:27
Coffee Extras - Drupal makefile snippets
; Coffee Extras
projects[coffee_extras][type] = module
projects[coffee_extras][download][type] = git
projects[coffee_extras][download][url] = git://git.drupal.org/sandbox/mrkdboyd/2361931.git
projects[coffee_extras][download][branch] = 7.x-1.x
@markdboyd
markdboyd / violations.php
Created June 8, 2016 23:57
Code for America challenge - Summary of Building Code Violations in 2012
<?php
$csv_contents = file_get_contents('http://forever.codeforamerica.org/fellowship-2015-tech-interview/Violations-2012.csv');
$csv_data = explode(PHP_EOL, $csv_contents);
$results = array();
for ($i = 1; $i < count($csv_data); $i++) {
$row_data = explode(',', $csv_data[$i]);
$violation_category = trim($row_data[2]);
@markdboyd
markdboyd / FieldCollectionItem.php
Created May 10, 2017 17:08
Migrate D7 Field Collections to D8 Paragraphs
<?php
namespace Drupal\saintlukes_migrate\Plugin\migrate\source\d7;
use Drupal\migrate\Row;
use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity;
/**
* Drupal 7 field_collection_item source from database.
*
diff --git a/geolocation.libraries.yml b/geolocation.libraries.yml
index 71c2fcf..b817e7c 100644
--- a/geolocation.libraries.yml
+++ b/geolocation.libraries.yml
@@ -22,6 +22,12 @@ geolocation.views.filter.geocoder:
dependencies:
- geolocation/geolocation.geocoder
+# HTML5 Geolocation API.
+geolocation.html5:
diff --git a/geolocation.libraries.yml b/geolocation.libraries.yml
index 71c2fcf..b817e7c 100644
--- a/geolocation.libraries.yml
+++ b/geolocation.libraries.yml
@@ -22,6 +22,12 @@ geolocation.views.filter.geocoder:
dependencies:
- geolocation/geolocation.geocoder
+# HTML5 Geolocation API.
+geolocation.html5: