Skip to content

Instantly share code, notes, and snippets.

View olafkarsten's full-sized avatar

olafkarsten olafkarsten

View GitHub Profile
/**
* Setting up the test.
*/
protected function setup() {
parent::setUp();
$this->drupalLogin($this->adminUser);
$config = \Drupal::configFactory()
->getEditable('commerce_stock.service_manager');
@olafkarsten
olafkarsten / runPhantomjs.sh
Created April 20, 2017 05:03 — forked from marek-pietrzak-tg/runPhantomjs.sh
Runs PhantomJs in background
#!/bin/bash
echo "Running PhantomJs..."
LOGFILE=/tmp/phantomjs.log
exec 6>&1 # Link file descriptor #6 with stdout.
exec > $LOGFILE # stdout replaced with file "logfile.txt".
# ----------------------------------------------------------- #

There are 18 kind of different scenarios for basefield:

  1. non-translatable and non-revisionable entity with basefield with cardnality 1. One DB table: base Field column(s) in base table
  2. non-translatable and non-revisionable entity with basefield with cardnality greater than 1. Two DB tables: base, field table Field column(s) in field table
  3. translatable and non-revisionable entity with basefield with cardnality 1. Two DB tables: base, data Field column(s) in data table
    • non-translatable basefield.
    • translatable basefield.
  4. translatable and non-revisionable entity with basefield with cardnality greater than 1. Three DB tables: base, data, field table Field column(s) in field table
    • non-translatable basefield.
    • translatable basefield.
@olafkarsten
olafkarsten / __INDEX.txt
Created September 11, 2016 13:41 — forked from facine/__INDEX.txt
Drupal 8 - Examples
# Taxonomy terms:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_taxonomy_term-php
# Menu links:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_menu_link-php
# File items:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_file-php
# Nodes:
@olafkarsten
olafkarsten / .gitconfig
Created May 31, 2016 15:24 — forked from pksunkara/config
Sample of git config file (Example .gitconfig)
[user]
name = Pavan Kumar Sunkara
email = pavan.sss1991@gmail.com
[core]
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
excludesfile = ~/.gitignore
[sendemail]
smtpencryption = tls
smtpserver = smtp.gmail.com
@olafkarsten
olafkarsten / jsonpp
Last active September 3, 2015 16:14 — forked from gboudreau/jsonpp
JSON pretty-print from the command line
#!/usr/bin/php
<?php
echo json_format(file_get_contents('php://stdin')) . "\n";
// Pretty print some JSON
function json_format($json)
{
$tab = " ";
$new_json = "";
$indent_level = 0;
$in_string = false;
/**********************************************************
* jQuery-less version of Chris Coyier's
* Value Bubbles for Range Inputs
* http://css-tricks.com/value-bubbles-for-range-inputs/
**********************************************************/
function modifyOffset() {
var el, newPoint, newPlace, offset, siblings, k;
width = this.offsetWidth;
newPoint = (this.value - this.getAttribute("min")) / (this.getAttribute("max") - this.getAttribute("min"));
<?php
namespace MyApp\ApiBundle\Listener;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpFoundation\Cookie;
use Doctrine\ORM\EntityManager;
$ = jQuery
queues = {}
running = false
queue = (name) ->
name = 'default' if name is true
queues[name] or= []
next = (name) ->
<?php
/**
* SplClassLoader implementation that implements the technical interoperability
* standards for PHP 5.3 namespaces and class names.
*
* http://groups.google.com/group/php-standards/web/final-proposal
*
* // Example which loads classes for the Doctrine Common package in the
* // Doctrine\Common namespace.