Skip to content

Instantly share code, notes, and snippets.

View lcube45's full-sized avatar
๐ŸŒ๏ธโ€โ™‚๏ธ
Focusing

lcube lcube45

๐ŸŒ๏ธโ€โ™‚๏ธ
Focusing
View GitHub Profile
@lcube45
lcube45 / Sqlpgsql.php
Created May 11, 2017 12:25
Drush with PostGreSql on Windows
<?php
namespace Drush\Sql;
define('PSQL_SHOW_TABLES', "SELECT tablename FROM pg_tables WHERE schemaname='public';");
class Sqlpgsql extends SqlBase {
//public $query_extra = "--no-align --field-separator=\"\t\" --pset tuples_only=on";
public $query_extra = "--no-align --pset tuples_only=on";
@lcube45
lcube45 / drupal.bat
Created November 7, 2016 11:32
Drupal console install on windows
@php "%~dp0drupal.phar" %*
@lcube45
lcube45 / FeatureContext.php
Created October 10, 2016 15:04
Behat : add screenshot on error
<?php
class FeatureContext extends MinkContext {
/**
* Take screenshot when step fails. Works only with Selenium2Driver.
* Screenshot is saved at [Date]/[Feature]/[Scenario]/[Step].jpg
*
* @AfterStep @javascript
*/
@lcube45
lcube45 / behat.yml
Created October 10, 2016 15:02
Behat Starter Kit
default:
extensions:
Behat\MinkExtension:
base_url: "<url>"
default_session: selenium2
goutte: ~
selenium2:
wd_host: http://127.0.0.1:4444/wd/hub
browser: chrome
capabilities:
@lcube45
lcube45 / embed_form.php
Last active September 28, 2016 13:25
Drupal 7 - embed node form
function my_custom_form_callback($type = 'page') {
global $user;
module_load_include('inc', 'node', 'node.pages');
$node = (object) array(
'uid' => $user->uid,
'name' => (isset($user->name) ? $user->name : ''),
'type' => $type,
'language' => LANGUAGE_NONE
);
$form = drupal_get_form($type . '_node_form', $node);
@lcube45
lcube45 / example.module
Last active August 25, 2016 10:20
Drupal theme function for generating a bootstrap grid of nodes
/**
* Implements hook_theme()
*/
function example_theme() {
return array(
'bootstrap_grid' => array(
'render element' => 'elements'
),
);
}
@lcube45
lcube45 / template.php
Last active August 25, 2016 09:59
Remove panels separator panes
function themename_panels_default_style_render_region($vars) {
$output = '';
$output .= implode('', $vars['panes']);
return $output;
}