Skip to content

Instantly share code, notes, and snippets.

@brianjhanson
brianjhanson / BasePlugin.php
Created June 15, 2017 18:01
Importing Categories, Matrix fields and Super Table fields with Craft Import
<?php
/**
* Modify data just before importing
*
* @param BaseElementModel $element The current element receiving import data.
* @param array $map Mapping of data between CSV -> Craft fields.
* @param array $data Raw data provided for this row.
*/
public function modifyImportRow($element, $map, $data)
{
@brianjhanson
brianjhanson / task-config.js
Created July 9, 2017 17:21
Example of adding CSS globbing to Vigor's blendid
var nodeSassGlobbing = require('node-sass-globbing');
module.exports = {
images : true,
fonts : true,
svgSprite : true,
stylesheets : {
sass: {
includePaths: ["./node_modules"], // from default, but we still want it
// Not sure why we have to split this into a function, but we seem to need to
@brianjhanson
brianjhanson / faq-scrape.js
Last active September 8, 2017 20:13
Scrape FAQs
var $questions = jQuery('.faq-question');
var json = {};
json.categories = [];
json.entries = [];
var categoryIndex = -1;
var sectionId = 21;
var typeId = 28;
function isFirst(string) {
return (string.search(/^1\./g) !== -1);
@brianjhanson
brianjhanson / Contract Killer 3.md
Last active June 25, 2018 01:39
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Original post

Between Brian Hanson

/** VERSION: 2.2.3 Please don't modify or unzip this content. It will be updated regularly **/
function BCSfFilterCallback(a) {
bcsffilter.afterGetFilterData(a, a.event_type)
}
function viewMoreFilterOption(a) {
var b = "." + bcsffilter.class.filterBlockContent,
c = "." + bcsffilter.class.filterOptionViewMoreList;

Keybase proof

I hereby claim:

  • I am brianjhanson on github.
  • I am brianjhanson (https://keybase.io/brianjhanson) on keybase.
  • I have a public key ASDJ1n7E_b5ARc1pW57hrpJ5LklEBkW6Ef8PzJiLNmsZiQo

To claim this, I am signing this object: