Skip to content

Instantly share code, notes, and snippets.

View vladdancer's full-sized avatar
🖖

Vlad Moyseenko vladdancer

🖖
View GitHub Profile
<?php
#!/usr/bin/env drush
// Example rebuild script
// local alias
$self_record = drush_sitealias_get_record('@self');
$self_name = '@' . $self_record['#name'];
@vladdancer
vladdancer / setup_project_drupalpro_pantheon.sh
Created June 2, 2014 11:37
Setup new project instance from pantheon service in the Drupalpro environment.
# 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.*
SET filepath = REPLACE(filepath, 'sites/default/files', '');
'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 = {};
var myApp = angular.module('myApp',[]);
function Parent($scope) {
$scope.name = 'Superhero';
$scope.clickParent = function() {
$scope.name = 'Clicked from base controller';
}
}
(function () {
function ParentService(arg1) {
this.arg1 = arg1;
}
function ChildService(arg1, arg2) {
ParentService.call(this, arg1);
this.arg2 = arg2;
}
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;
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()
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;
}
}
}