This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
#!/usr/bin/env drush | |
// Example rebuild script | |
// local alias | |
$self_record = drush_sitealias_get_record('@self'); | |
$self_name = '@' . $self_record['#name']; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add drush aliases. | |
# Please, first is download this file from pantheon if you haven't did it early | |
# and place to the .drush folder | |
cd ~/ | |
cp ~/Downloads/pantheon.aliases.drushrc.php ~/.drush | |
cd ~/websites | |
# use 'drush sa' command to check if drush is using new aliases. | |
# this command will provide list of aliases, so you need to check something like | |
# pantheon.* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET filepath = REPLACE(filepath, 'sites/default/files', ''); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
(function() { | |
var mod = angular.module("App.services", []); | |
//register other services here... | |
/* pubsub - based on https://github.com/phiggins42/bloody-jquery-plugins/blob/master/pubsub.js*/ | |
mod.factory('pubsub', function() { | |
var cache = {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var myApp = angular.module('myApp',[]); | |
function Parent($scope) { | |
$scope.name = 'Superhero'; | |
$scope.clickParent = function() { | |
$scope.name = 'Clicked from base controller'; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
function ParentService(arg1) { | |
this.arg1 = arg1; | |
} | |
function ChildService(arg1, arg2) { | |
ParentService.call(this, arg1); | |
this.arg2 = arg2; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var myApp = angular.module('myApp', []); | |
var baseService = function () { | |
this._state = {}; | |
}; | |
baseService.prototype.getState = function () { | |
return this._state; | |
}; | |
baseService.prototype.setState = function (state) { | |
this._state = state; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
end($array); | |
$referenceToLastElement = &$array[key($array)]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function entity_property_values_create_entity($entity_type, $values = array()) { | |
if (entity_type_supports($entity_type, 'create')) { | |
$info = entity_get_info($entity_type); | |
// Create the initial entity by passing the values for all 'entity keys' | |
// to entity_create(). | |
$entity_keys = array_filter($info['entity keys']); | |
$creation_values = array_intersect_key($values, array_flip($entity_keys)); | |
// In case the bundle key does not match the property that sets it, ensure | |
// the bundle key is initialized somehow, so entity_extract_ids() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function yourtheme_preprocess_page(&$vars) { | |
$contexts = context_active_contexts(); | |
// Add delta based tpl. | |
foreach ($contexts as $context) { | |
if (isset($context->reactions['delta']) && ($delta_name = $context->reactions['delta']['delta_template'])) { | |
$vars['theme_hook_suggestions'][] = 'page__'. $delta_name; | |
} | |
} | |
} |