Skip to content

Instantly share code, notes, and snippets.

View drogers98's full-sized avatar

Dan Rogers drogers98

View GitHub Profile
@drogers98
drogers98 / gist:9628120
Created March 18, 2014 19:56
nginx drupal oAuth module patch to settings.php. Lets oAuth run on Pantheon, yeay! Thanks to chustedde, https://drupal.org/comment/8475539#comment-8475539
// Modify server variables to be compatible with the OAuth.php library
$_SERVER['SERVER_NAME'] = $_SERVER['HTTP_HOST'];
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") {
$_SERVER['SERVER_PORT'] = 443;
}
else {
$_SERVER['SERVER_PORT'] = 80;
}
$_SERVER['QUERY_STRING'] = preg_replace("/&{0,1}q=[^&]*&{0,1}/i", "", $_SERVER['QUERY_STRING']);
@drogers98
drogers98 / gist:10479181
Created April 11, 2014 15:47
Curl D7 login junx
<?php
// Retrieve CSRF token
$curl_get = curl_init();
curl_setopt_array($curl_get, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => 'http://dev-oauth-test.gotpantheon.com/services/session/token',
));
$csrf_token = curl_exec($curl_get);
curl_close($curl_get);
$csrf_header = 'X-CSRF-Token: ' . $csrf_token;
<?php
//include parsedown.php, to format the descriptions parsedown markup
include '../plugins/parsedown.php';
// header needed for https workaround
$opts = array('http'=>array('header' => "User-Agent:MyAgent/1.0\r\n"));
$context = stream_context_create($opts);
$content = file_get_contents('https://4good.org/library-feed/Your_Feed_Here/latest.json',false,$context);
// function to remove the {by} in the description
@drogers98
drogers98 / gist:f3a35a4ac658608c4403
Created August 26, 2014 23:11
D7 Feeds JSON JSONPath parser ning users importer example
$feeds_importer = new stdClass();
$feeds_importer->disabled = FALSE; /* Edit this to true to make a default feeds_importer disabled initially */
$feeds_importer->api_version = 1;
$feeds_importer->id = 'ning_users';
$feeds_importer->config = array(
'name' => 'Ning Users',
'description' => 'port over ning users',
'fetcher' => array(
'plugin_key' => 'FeedsFileFetcher',
'config' => array(
## Service Script
define(['angular'], function (angular) {
'use strict';
angular.module('atlasApp.services.Drupal', ['restangular'])
.config(function(RestangularProvider){
RestangularProvider.addResponseInterceptor(function(data, operation, what, url, response, deferred) {
var extractedData;
@drogers98
drogers98 / SassMeister-input-HTML.html
Created September 23, 2014 17:22
Generated by SassMeister.com.
<h1>EBS is SASSy</h1>
<p>Sunt laborum accusamus Marfa, Thundercats butcher irony bitters. Letterpress delectus non, Etsy sint officia tofu forage et. Readymade pop-up cornhole, Marfa assumenda hoodie paleo photo booth vinyl. Keytar kitsch pork belly wolf. Tofu tempor sunt paleo food truck occupy cardigan, iPhone ex excepteur quinoa small batch odio ethical aliquip. Consectetur +1 gastropub tattooed keytar reprehenderit, slow-carb assumenda polaroid VHS duis fanny pack do synth. Hella Tonx tousled, chillwave aliquip beard consequat master cleanse PBR irony cupidatat vinyl nostrud. And a <a>Regular Link</a>.</p>
<a class="button">Button</a>
@drogers98
drogers98 / example.html
Last active August 29, 2015 14:06
SASS Background image and gradient mixin
<div class="Discussions"></div>
@drogers98
drogers98 / EBS Headless D7 Article View
Created October 23, 2014 21:08
EBS Headless D7 Article View
$view = new view();
$view->name = 'setup';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'setup';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
@drogers98
drogers98 / what it is view
Created October 24, 2014 13:55
EBS Headless D7 Article View (what it is)
$view = new view();
$view->name = 'what_it_is';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'What it is';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
@drogers98
drogers98 / alternateUpdatedVersion.php
Last active August 29, 2015 14:14
Drupal entity registration, see if user is already registered in order to hide/display stuff. use in the node.tpl.php. Modify line 6 to reference the particular product reference you are using.
<?php
// Hide/display stuff for users who are already registered
$query = new EntityFieldQuery();
$query
->entityCondition('entity_type', 'registration')
->propertyCondition('entity_id', $node->field_product_ref['und'][0]['product_id']);
$result = $query->execute();
//print_r($result['registration'][10]);
$ids = array_keys($result['registration']);
$registrations = entity_load('registration', $ids);