Skip to content

Instantly share code, notes, and snippets.

View nonsie's full-sized avatar

Katrin Valdre nonsie

  • Portland, OR
View GitHub Profile
@cam8001
cam8001 / full_feature_revert.php
Last active April 15, 2019 19:02
Feature revert library function
<?php
/**
* Completely reverts a feature based on the settings in its .info file.
*
* @param string $feature_module
* Name of feature/module to revert.
*/
function full_feature_revert($feature_module) {
$info = drupal_parse_info_file(drupal_get_path('module', $feature_module) . '/' . $feature_module . '.info');
@missinglink
missinglink / leaflet-foursquare.js
Last active November 29, 2016 14:59
Leaflet configuration which allows you to set map co-ordinates with a pixel offset (as per foursquare homepage). In this example I am using jQuery to find the width of `$('main.content')` and use that to offset the map.
var map = L.map( 'map' );
L.Map.prototype.panToOffset = function (latlng, offset, options) {
var x = this.latLngToContainerPoint(latlng).x - offset[0]
var y = this.latLngToContainerPoint(latlng).y - offset[1]
var point = this.containerPointToLatLng([x, y])
return this.setView(point, this._zoom, { pan: options })
}
function centerMap(){
@jerbob92
jerbob92 / ImageRenderExampleBlockResponsive.php
Created October 28, 2015 13:22
Render responsive image into a block Drupal 8 Example
<?php
/**
* @file
* Contains Drupal\mymodule\Plugin\Block\ImageRenderExampleBlockResponsive.
*/
namespace Drupal\mymodule\Plugin\Block;
use Drupal\Core\Block\BlockBase;
@colorfield
colorfield / drupal8-links.php
Last active May 3, 2024 22:47
Drupal 8 links, or where is my l() function