Skip to content

Instantly share code, notes, and snippets.

View bricel's full-sized avatar

Brice Lenfant bricel

View GitHub Profile
$query = db_select('field_data_name_field', 'nf');
$query->join('taxonomy_term_hierarchy', 'tth', 'tth.tid = nf.tid');
$query->addField('nf', 'name_field_value', 'name');
$query->addField('nf', 'entity_id', 'tid');
$query
->condition('entity_type', 'taxonomy_term')
->condition('bundle', $bundle)
->condition('name', db_like($prefix) . '%', 'LIKE')
->range(0, 10)
@bricel
bricel / gist:d4b1429aa5270ffc0b47
Created May 3, 2015 13:41
reset 403 image style
drush @cri.dev vset image_allow_insecure_derivatives 1 --strict=0
drush @cri.dev vset image_allow_insecure_derivatives 0 --strict=0
<?php
class MimeMailSystem__SmtpMailSystem implements MailSystemInterface {
protected $formatClass;
protected $mailClass;
public function __construct() {
if (drupal_autoload_class('MimeMailSystem')) {
$this->formatClass = new MimeMailSystem;
}
else {
$this->formatClass = new DefaultMailSystem;
@bricel
bricel / update.sh
Created July 13, 2015 10:57
Update pantheon foder
rsync -azvr --delete-after ../productivity/productivity profiles/
rsync -azvr --delete-after ../productivity/www/app/ app/
@bricel
bricel / gist:8736f404166869bc2db4
Created July 30, 2015 06:39
MAC install shoov
npm install -g yo mocha generator-shoov
brew install graphicsmagick
@bricel
bricel / gist:5c5a804bf438241c629d
Created September 24, 2015 07:41
Import from csv snipet
<?php
/**
* Created by PhpStorm.
* Migrate taxonomy terms with heiarchy for open calls
* User: brice
* Date: 9/21/15
* Time: 3:04 PM
*/
// drush @sh scr sites/all/modules/idealist/drush/open-calls-import.php --src='csv/calls.csv'
@bricel
bricel / resave.php
Created November 22, 2015 18:37
Resave all nodes
<?php
/**
* Created by JetBrains PhpStorm.
* User: Brice
* Date: 6/23/13
* Time: 22:05 PM
* To change this template use File | Settings | File Templates.
*/
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'node');
#!/bin/bash
echo -n "GitHub User: "
USER="<username>"
echo -n "GitHub Password: "
PASS="<passowrd>"
echo ""
echo -n "GitHub Repo (e.g. foo/bar): "
*/
protected function prepareImages($value) {
$images = parent::fileProcess($value);
$images_clean = array();
dpm($value);
foreach ($images as $image) {
$image['self'] = image_style_url('business_image', $value['uri']);
// Composer's auto-loading functionality
// https://github.com/tijsverkoyen/CssToInlineStyles
require libraries_get_path('css-to-inline') . "/vendor/autoload.php";
$html = "<span> Some html template</span>";
// Set inline CSS.
$css_file_path = drupal_get_path('theme', 'bootstrap_subtheme') . '/bootstrap/css/email.css';
$css_content = file_get_contents($css1);