Skip to content

Instantly share code, notes, and snippets.

View amitaibu's full-sized avatar

Amitai Burstein amitaibu

View GitHub Profile
decodeStudentBoard : Decoder StudentBoard
decodeStudentBoard =
-- @todo: We don't send quizStatus yet, so made it optional.
Decode.decode StudentBoard
|> required "user" User.Decoder.decode
|> optional "selectedSlide" string ""
|> optional "slides_dict" (dict decodeStudentSlideContent) Dict.empty
|> required "joined" decodeDate
  1. Create a Drupal 7 site on Pantheon
  2. Create Pusher apps. One for local, and 3 for pantheon (Dev, Test, Live)
  3. On Pantheon dashboard switch connection mode to "Git"
  4. Clone Pantheon site locally
  5. In the Pantheon directory, cd sites/default && cp default.settings.php settings.php
  6. Add the following code, to the end of settings.php - replace Pusher's app ID,key, secret and cluster
# Pusher integration.
if ($_ENV['PANTHEON_ENVIRONMENT'] == 'dev') {  
#! /bin/bash
gcloud compute instances create live-instance13-primary \
--machine-type=n1-standard-1 \
--image=ubuntu-14-04 \
--metadata-from-file startup-script=startup-script.sh \
--zone us-central1-f \
--tags http-server
gcloud compute instances create live-instance13-secondary \
getSlideR :: SlideId -> Handler Value
getSlideR slideId = do
slide <- runDB $ get404 slideId
let (Object slideHM) = entityIdToJSON (Entity slideId slide)
embedTextsBySlide <- runDB $ selectList [EmbedTextSlide ==. slideId] [] :: Handler [Entity EmbedText]
embedImagesBySlide <- runDB $ selectList [EmbedImageSlide ==. slideId] [] :: Handler [Entity EmbedImage]
let embedTextVector = V.fromList [entityIdToJSON (Entity k r) | Entity k r <- embedTextsBySlide]
module Main exposing (..)
import Html exposing (..)
import Html.App as Html
import Html.Events exposing (..)
import WebSocket
import Json.Encode
import Json.Decode
import Json.Decode.Pipeline as JD
<?xml version="1.0" encoding="UTF-8"?>
<!-- TODO set checkForUnintentionallyCoveredCode="true" once https://www.drupal.org/node/2626832 is resolved. -->
<!-- TODO set printerClass="\Drupal\Tests\Listeners\HtmlOutputPrinter" once
https://youtrack.jetbrains.com/issue/WI-24808 is resolved. Drupal provides a
result printer that links to the html output results for functional tests.
Unfortunately, this breaks the output of PHPStorm's PHPUnit runner. However, if
using the command line you can add
- -printer="\Drupal\Tests\Listeners\HtmlOutputPrinter" to use it (note there
should be no spaces between the hyphens).
uuid: ea2dc482-44ed-49c2-9fb4-5ce41d7e1d32
langcode: en
status: true
dependencies:
module:
- node
- user
id: current
label: 'Current user'
module: views
<?php
/**
* Implements hook_node_insert().
*/
function example_node_insert(\Drupal\node\NodeInterface $node) {
$message = Message::create(['template' => 'node_created']);
$arguments = [
'@url' => $node->toUrl()->setAbsolute()->toString(),
<?php
/**
* Get the parent groups of an entity.
*
* @param \Drupal\Core\Entity\EntityInterface $entity
* The entity objects.
* @param array $groups
* Array of group entities passed by reference.
*