Skip to content

Instantly share code, notes, and snippets.

Selwyn Polit selwynpolit

Block or report user

Report or block selwynpolit

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@selwynpolit
selwynpolit / read_csv.php
Last active Jul 12, 2018
Php code to read a csv file of any size without exhausting memory and let you process it in chunks
View read_csv.php
/*
Reads a CSV file in chunks of 10 lines at a time
and returns them in an array of objects for processing.
Assumes the first line of the CSV file has headings
that will be used as the object name for the item you are
processing. i.e. the heading is CurrentURL then refer to
$item->CurrentURL
@selwynpolit
selwynpolit / config.yml
Created Mar 1, 2018
DrupalVM config.yml file for Mac OSX
View config.yml
---
# Available `vagrant_box` values include:
# - beet/box (pre-provisioned, based on Ubuntu 16.04)
# - geerlingguy/centos7
# - geerlingguy/centos6
# - geerlingguy/debian9
# - geerlingguy/debian8
# - geerlingguy/ubuntu1604
# - geerlingguy/ubuntu1404
vagrant_box: geerlingguy/ubuntu1604
View recipe_migrate_d7.php
/**
* Constructor.
*
* A Migration constructor takes an array of arguments as its
* first parameter. The arguments must be passed through to the parent
* constructor.
*
* @param array $arguments
* Arguments
*/
View bottom_of_blog_tracking.html
<script>
(function(dataLayer, $) {
var reachedBottom = false;
//returns true if view is at or below element
function scrolledToBottom(elem) {
var $elem = $(elem);
if ($elem.length > 0) {
var $window = $(window);
View gtm_video_tracker.html
<script type="text/javascript">
// This code loads the IFrame Player API code asynchronously.
(function GtmVideoTracker(){
var tag = document.createElement('script');
var firstScriptTag = document.getElementsByTagName('script')[0];
window.GTMplayers = window.GTMplayers || [];
tag.src = "https://www.youtube.com/iframe_api";
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
@selwynpolit
selwynpolit / migrate.migration.recipe_node.yml
Created Dec 10, 2015
Drupal 8 migration from sage api
View migrate.migration.recipe_node.yml
# Migration configuration for recipe content.
id: recipe_node
label: Recipes from Sage
migration_group: recipe
source:
plugin: wfm_migrate_recipe
destination:
plugin: entity:node
process:
# Hardcode the destination node type (bundle) as 'migrate_example_recipe'.
You can’t perform that action at this time.