Skip to content

Instantly share code, notes, and snippets.

View delineas's full-sized avatar
🚀
Launching...

Daniel Primo delineas

🚀
Launching...
View GitHub Profile
@ogredude
ogredude / rules_send_message_to_customer
Created October 26, 2012 02:20
Drupal Commerce Rules Component to send an email to the customer
{ "rules_send_message_to_customer" : {
"LABEL" : "Send message to customer",
"PLUGIN" : "rule set",
"REQUIRES" : [ "rules" ],
"USES VARIABLES" : {
"order" : { "label" : "Order", "type" : "commerce_order" },
"subject" : { "label" : "Subject", "type" : "text" },
"body" : { "label" : "Body", "type" : "text" }
},
"RULES" : [
var uri = casper.cli.get('uri');
var link = 'http://' + uri;
var alias = casper.cli.get('alias');
var drush = 'http://localhost:8888/' + alias + ' ';
var repo_dir = casper.cli.get('repo');
casper.test.begin('Setup methods for test suite', function suite(test) {
// Begin setUp().
casper.start(drush + 'core-status --format=json', function() {
// Test Access to the online help section.
// The online help handbook should only be accessible to administrators.
casper.test.begin('Restrict access to online help to Administrators only', function suite(test) {
// Check that online help is not accessible to anonymous user.
casper.start();
casper.setHttpAuth('USERNAME', 'PASSWORD');
casper.thenOpen(link + '/handbook').waitForSelector('.error',
@helios-ag
helios-ag / gist:2abd77f3d6e02d0ea8ab
Created June 9, 2015 04:51
Tinymce/Elfinder configuration
stfalcon_tinymce:
include_jquery: true
tinymce_jquery: true
selector: ".tinymce"
theme:
simple: ~
advanced:
plugins:
- "advlist autolink lists link image charmap print preview hr anchor pagebreak"
- "searchreplace wordcount visualblocks visualchars code fullscreen"
@philfreo
philfreo / file_upload.js
Last active September 18, 2017 15:45
Backbone-Forms File Upload Editor
// directly uploads to S3
// See http://philfreo.com/blog/how-to-allow-direct-file-uploads-from-javascript-to-amazon-s3-signed-by-python/
// See https://github.com/elasticsales/s3upload-coffee-javascript
editors.Filepicker = editors.Text.extend({
tagName: 'div',
events: {
'change input[type=file]': 'uploadFile',
@ogredude
ogredude / rules_automatic_update_notification_email
Created October 26, 2012 02:19
Drupal Commerce Rules to send an update email to customer on order status change
{ "rules_automatic_update_notification_email" : {
"LABEL" : "Automatic update notification email",
"PLUGIN" : "rule set",
"REQUIRES" : [ "rules" ],
"USES VARIABLES" : { "order" : { "label" : "Order", "type" : "commerce_order" } },
"RULES" : [
{ "RULE" : {
"PROVIDE" : { "entity_fetched" : { "billing_profile" : "Billing profile" } },
"IF" : [
{ "entity_has_field" : { "entity" : [ "order" ], "field" : "commerce_customer_billing" } }
@rossriley
rossriley / CSVImportCommand.php
Created July 25, 2016 10:38
Import Content to Bolt from CSV File
<?php
namespace Mysite\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputOption;
use Bolt\Application;
@yann-yinn
yann-yinn / drupal-7--fapi_multifield.php
Last active June 14, 2018 15:12
Creat multiple field (add more buttons) for form api elements
<?php
/**
* @file
* Re-usable stuff.
*
* @FIXME multifield function seems not to work in included several times in the same page.
*/
/**
* Implements hook_theme()
@ajaxray
ajaxray / symfony2-bundle-config.md
Last active February 7, 2019 12:02
Symfony2 - Getting Bundle configuration from app/config/config.yml as a separated config block

APPROACH 1: Getting it as a parameter

With an extension (more on extensions here) you can keep this easily "separated" into different blocks in the config.yml and then inject that as a parameter gettable from the controller.

Inside your Extension class inside the DependencyInjection directory write this:

class MyNiceProjectExtension extends Extension
{
 public function load( array $configs, ContainerBuilder $container )
@webdevilopers
webdevilopers / ElectricalEquipmentAdmin.php
Created January 11, 2016 09:16
Using createQuery with LEFT JOIN and PARTIAL to improve performance on Sonata Admin listView and prevent extra queries
<?php
public function createQuery($context = 'list')
{
$query = parent::createQuery($context);
$query->addSelect(
'PARTIAL ' . $query->getRootAlias() . '.{id, name, description, serialNumber, approvalNumber, ' .
'invoiceDate, createdAt}',
'PARTIAL pc.{id, name}',