Skip to content

Instantly share code, notes, and snippets.

View chriscalip's full-sized avatar

Christopher Calip chriscalip

  • Chicago, IL
  • 20:05 (UTC -05:00)
View GitHub Profile
<?php
$selectedFilters['region'] = 'ALL';
$selectedFilters['state'] = 'ALL';
$selectedFilters['zip'] = 60101;
$selectedFilters['specialty'] = 'ALL';
$dataGrid[] = array(
'client' => 'A',
'region' => 'east',
@chriscalip
chriscalip / example1.conf
Last active November 2, 2015 22:45
Example apache2 conf file to integrate with vagrant vlad system
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName example1.drupal.local
DocumentRoot /vagrant/sites/example1
<Directory "/vagrant/sites/example1/">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
@chriscalip
chriscalip / foreach-for-loop-example
Created September 11, 2015 16:02
Example why to initiate variables first versus on-demand initiation inside loop
<?php
// test for efqs
/**
* Root directory of Drupal installation.
*/
define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
// turn error reporting back to normal
error_reporting(E_ALL);
<?php
if (!function_exists('krumo')) {
has_krumo();
}
$nids = db_query('SELECT nid FROM {node} n')->fetchCol();
$query = db_select('node', 'n');
<?php
class checkGR
{
public $prop = array();
function __construct($title) {
$ret = $this->callGR($title);
$xml = new SimpleXMLElement($ret);
$this->prop = $this->parseXML($xml);
}
public function parseXML(SimpleXMLElement $xml) {
@chriscalip
chriscalip / gist:37df8bc7becbc8a10453
Created July 15, 2015 02:24
JS code snippet of geojson into leaflet layers.
jQuery.each(marketAreas, function (key, marketArea) {
parsedMarketArea = {
'type': 'Feature',
'properties' : marketArea.properties,
'geometry' : jQuery.parseJSON(marketArea.geometry)
};
maOverlayGroups[marketArea.properties.title] = L.geoJson(parsedMarketArea, {
'style': mapPolygonSettings,
'onEachFeature': function (feature, layer) {
var area_content = themeString(
@chriscalip
chriscalip / gist:62ec7310bcd9c5eac172
Created July 15, 2015 02:10
Utility drupal php function to get polygon data from node containing a geofield that stores polygons.
<?
/**
* Utility function to get market areas map data.
* Pretty much just a typical parse entities data into market areas array
*
* @param array $filters contextual array (entity_type, bundle, field_name)
* @return array $market_areas output array used for painting market area layer.
*/
function capacitype_mapbox_get_market_areas($filters) {
$market_areas = array();