Skip to content

Instantly share code, notes, and snippets.

View amitaibu's full-sized avatar

Amitai Burstein amitaibu

View GitHub Profile
myMaximumBy :: (a -> a -> Ordering) -> [a] -> a
myMaximumBy _ [] = undefined
myMaximumBy _ (x : []) = x
myMaximumBy f (x : xs) =
case f x val of
GT -> x
_ -> val
where val = (myMaximumBy f xs)
module Jammin where
import Data.List
data Fruit =
Peach
| Plum
| Apple
| Blackberry
deriving (Eq, Show, Ord)
module WordNumber where
import Data.List (intersperse)
digitToWord :: Int -> String
digitToWord 0 = "Zero"
digitToWord 1 = "One"
digitToWord 2 = "Two"
digitToWord 3 = "Three"
digitToWord _ = "other"
<?php
/**
* @file
* Turn Drupal to a RESTful server, following best practices.
*/
include_once __DIR__ . '/restful.entity.inc';
include_once __DIR__ . '/restful.cache.inc';
<script>alert('xss');</script>
ALTER DATABASE pantheon CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
ALTER TABLE field_data_field_feed_item_description CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE field_data_field_feed_item_description CHANGE field_feed_item_description_value field_feed_item_description_value longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
getHomeR :: Handler Html
getHomeR = do
blogs <- runDB
$ E.select
$ E.from $ \(blog `E.InnerJoin` author) -> do
E.on $ blog ^. BlogAuthor E.==. author ^. AuthorId
E.where_ $ author ^. AuthorId E.>. (E.val 1) -- how to get ID 1
E.limit 5
return
( blog ^. BlogId
docker run --rm --name=ch -p=0.0.0.0:8484:8484 -p=0.0.0.0:2222:2222 \
-p=0.0.0.0:4470:4444 -p=0.0.0.0:5920:5900 \
-e SCREEN_WIDTH=1920 -e SCREEN_HEIGHT=1080 \
-e VNC_PASSWORD=hola -e WITH_GUACAMOLE=true \
-e SSH_PUB_KEY="$(cat ~/.ssh/id_rsa.pub)" \
elgalu/selenium:v2.46.0-base1
'use strict';
var Promise = require('bluebird');
var exec = require('child_process').exec;
var fs = Promise.promisifyAll(require('fs'));
var git = require('git-rev');
var nconf = require('nconf');
var open = require('open');
var path = require('path');
var R = require('ramda');
script:
- curl -I http://127.0.0.1:8888/api/articles
- ./bin/behat SPECIFIC