Skip to content

Instantly share code, notes, and snippets.

@dawehner
dawehner / -
Created November 2, 2016 19:11
# General settings
unbind C-b
unbind l
set -g prefix C-f
bind-key C-a last-window
set -g status-keys vi
# Faster Command Sequences
set -s escape-time 0
@dawehner
dawehner / -
Created October 25, 2016 19:45
function gpatch
wget -O - $argv[1] | git apply --index -3
end
@dawehner
dawehner / -
Created October 15, 2016 00:02
if status --is-interactive
set PATH $PATH ~/bin;
set PATH $PATH ~/.composer/vendor/bin
set PATH $PATH ~/anaconda/bin
set PATH $PATH ~/.cabal/bin
set PATH $PATH ~/.platformsh/bin
# set PATH $PATH /usr/local/sbin
end
ulimit -n 65536
<?php
/**
* Provides an AMP Google DoubleClick for Publishers block
*
* @Block(
* id = "amp_google_doubleclick_block",
* admin_label = @Translation("AMP Google DoubleClick for Publishers block"),
* )
*/
/**
* Implements hook_query_TAG_alter().
*/
function custom_comment_query_comment_filter_alter(SelectQueryInterface $query) {
// Reverse the order in which comments are displayed.
$node = $query->getMetaData('node');
if ($node->type == 'lesson') {
$mode = variable_get('comment_default_mode_' . $node->type, COMMENT_MODE_THREADED);
if ($mode === COMMENT_MODE_FLAT) {
$field = 'c.cid';
<?php
namespace Drupal\foo_video\Plugin\Field\FieldWidget;
use Drupal\Core\Entity\FieldableEntityInterface;
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\WidgetBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Form\OptGroup;
<?php
/**
* @param \Drupal\Core\Url[][] $urlss
*/
function foo($urlss) {
foreach ($urlss as $urls) {
foreach ($urls as $url) {
$url->getOptions();
}
<?php
namespace Drupal\foo_article\Plugin\Field\FieldType;
use Drupal\Core\Field\Plugin\Field\FieldType\BooleanItem;
use Drupal\workbench_moderation\Entity\ModerationState;
/**
* Defines the 'boolean' entity field type.
*
@dawehner
dawehner / -
Created October 10, 2016 13:22
diff --git a/core/lib/Drupal/Core/Condition/ConditionAccessResolverTrait.php b/core/lib/Drupal/Core/Condition/ConditionAccessResolverTrait.php
index 106eeec..8cee282 100644
--- a/core/lib/Drupal/Core/Condition/ConditionAccessResolverTrait.php
+++ b/core/lib/Drupal/Core/Condition/ConditionAccessResolverTrait.php
@@ -26,8 +26,11 @@ protected function resolveConditions($conditions, $condition_logic) {
$pass = $condition->execute();
}
catch (ContextException $e) {
- // If a condition is missing context, consider that a fail.
- $pass = FALSE;
var notify = require('osx-notifier');
var cron = require('node-cron');
// Stand up every 30 minutes at least.
cron.schedule('30 * * * *', () => {
notify({
type: 'fail',
title: 'Stand up',
subtitle: 'Standup, do some excerise or at least drink some water, dude!',
message: 'It is time for it',