Skip to content

Instantly share code, notes, and snippets.

View basvdheijden's full-sized avatar

Bas van der Heijden basvdheijden

View GitHub Profile
<?php
$nodes = db_select('node', 'n')
->fields('n', array('nid'))
->condition('type', array('product'), 'NOT IN')
->execute()->fetchAll();
$nids = array();
foreach ($nodes as $node) {
$nids[] = $node->nid;
#!/bin/sh
# 8888 = Local port to expose on
# 2443 = Remote port to tunnel
# server the name of the server (or root@IP)
ssh -L 8888:localhost:8080 -N server
<?php
$render_array = [
// My render array full of items.
]
$render_context = new RenderContext();
$this->renderer->executeInRenderContext($render_context, function() use (&$render_array) {
$this->renderer->render($render_array);
});
<?php
public function view(EntityInterface $node, $view_mode = 'full', $langcode = NULL) {
$page = $this->entityManager
->getViewBuilder($node->getEntityTypeId())
->view($node, $view_mode);
$page['#pre_render'][] = [$this, 'buildTitle'];
$page['#entity_type'] = $node->getEntityTypeId();
$page['#' . $page['#entity_type']] = $node;
<?php
/**
* @file
*
* Contains Drupal\newsletter_view\Controller\NewsletterViewNodeController
*/
namespace Drupal\newsletter_view\Controller;
@basvdheijden
basvdheijden / a-deep-dive-into-the-history-of-cryptography.md
Last active January 2, 2018 08:43
A deep dive into the history of cryptography

A deep dive into the history of cryptography

We implement or use some form of cryptography nearly every day: from public-key authentication or cryptocurrency transactions to credit-card processing or visiting a website over SSL. Security is omnipresent today, and has been for a long time. Tracing the colorful history of cryptography, I will present the evolution of secret writing from the ancient greeks and the Middle Ages to the present and beyond.

In this highly practical session, I explain encryption techniques (such as the "indecipherable cipher") through JavaScript code. You will gain hands-on experience with encrypting and decrypting messages. Through these examples, you will come to understand how the ongoing battle between code makers and breakers is a catalyst for fast-paced innovation, new strategies and paradigms for secret communication.

Topics will include:

  • Security through obscurity,
  • Plaintext vs. ciphertexts and substition ciphers,
  • Frequency analysis,
  • The enigma code during World W
@basvdheijden
basvdheijden / embrace-the-next-big-evolution-on-the-web-conversational-interfaces.md
Last active January 2, 2018 08:03
Embrace the next big evolution on the web: conversational interfaces.

Embrace the next big evolution on the web: conversational interfaces.

Conversational UX is any user interface that mimics chatting with a real human. When designed for the right use case and presented in the right context, conversational interfaces are very powerful and effective. They solve real UI/UX challenges by making the web more immersive, more human and more approachable.

In this session, I’ll give you a tour through the rapidly growing world of the conversational web and provide you with the know-how to start implementing conversational UX in your JavaScript apps and websites today.

You will gain experience with the tools and paradigms at hand and learn how and when to use conversational interfaces over traditional interfaces (e.g. GUI’s and CLI’s). Through our journey, you will learn what anthropomorphism entails, how to implement natural language processing in JavaScript and learn more about machine learning in general.

Short version