Skip to content

Instantly share code, notes, and snippets.

$('form :input').each(function(index, elem) {
var eId = $(elem).attr('id');
var label = null;
if (eId && (label = $(elem).parents('form').find('label[for='+eId+']')).length === 1) {
$(elem).attr('placeholder', $(label).html());
$(label).addClass('hide');
}
});
@arildm
arildm / .bash_git
Last active August 29, 2015 14:09
Git repo bash prompt
IBlack="\[\033[0;90m\]" # High-intensity Black
BYellow="\[\033[1;33m\]" # Bold Yellow
Green="\[\033[0;32m\]" # Green
IRed="\[\033[0;91m\]" # High-intensity Red
Yellow="\[\033[0;33m\]" # Yellow
Color_Off="\[\033[0m\]" # Text Reset
# Bash prompt for Git repos, based on
# http://mediadoneright.com/content/ultimate-git-ps1-bash-prompt but inserts
# the branch/dirty marker in the path.
@arildm
arildm / gist:27612301fea302b1a5cf
Created March 4, 2015 14:49
Captured article with hal enabled
{
"fields": {
"nid": {
"type": "integer",
"label": "Node ID",
"description": "The node ID.",
"required": false,
"storage": {
"cardinality": 1,
"custom_storage": false,
@arildm
arildm / gist:297e66cf0314fdd9934a
Created March 26, 2015 13:50
Captured user schema config with stored property definitions
uuid: 63a6d9e3-c8fb-4401-9100-e547486ee3b4
langcode: en
status: true
dependencies: { }
id: user
label: User
uri_pattern: 'http://schema.md-systems.ch/collect/0.0.1/collectjson/d8.dev/entity/user'
plugin_id: collectjson
locked: false
container_revision: true
@arildm
arildm / gist:f1bf3c5fdd0652f495d5
Created March 27, 2015 21:36
Captured user schema config with stored property definitions, including storage
uuid: 63a6d9e3-c8fb-4401-9100-e547486ee3b4
langcode: en
status: true
dependencies: { }
id: user
label: User
uri_pattern: 'http://schema.md-systems.ch/collect/0.0.1/collectjson/d8.dev/entity/user'
plugin_id: collectjson
locked: false
container_revision: true
<?php
interface Vehicle {
public function getNumberOfWheels();
}
abstract class Bicycle {
// Does not declare the method in the interface, and that's fine.
}
@arildm
arildm / gist:fa179613ffe6bb1e5d4b
Created May 28, 2015 11:40
Serialized CollectJsonSchema plugin instance
a:25:{s:11:"#attributes";a:1:{s:5:"class";a:2:{i:0;s:23:"collect-processing-form";i:1;s:19:"collect-schema-form";}}s:8:"#process";a:1:{i:0;s:13:"::processForm";}s:12:"#after_build";a:1:{i:0;s:12:"::afterBuild";}s:20:"processor_add_select";a:3:{s:5:"#type";s:6:"select";s:6:"#title";s:13:"Add processor";s:8:"#options";a:2:{s:16:"activity_creator";O:48:"Drupal\Core\StringTranslation\TranslationWrapper":3:{s:9:"*string";s:16:"Activity creator";s:12:"*arguments";a:0:{}s:10:"*options";a:0:{}}s:15:"contact_matcher";O:48:"Drupal\Core\StringTranslation\TranslationWrapper":3:{s:9:"*string";s:15:"Contact matcher";s:12:"*arguments";a:0:{}s:10:"*options";a:0:{}}}}s:20:"processor_add_submit";a:5:{s:5:"#type";s:6:"submit";s:6:"#value";s:3:"Add";s:7:"#submit";a:1:{i:0;s:20:"::submitAddProcessor";}s:24:"#limit_validation_errors";a:1:{i:0;a:1:{i:0;s:20:"processor_add_select";}}s:5:"#ajax";a:3:{s:7:"wrapper";s:24:"processors-table-wrapper";s:8:"callback";a:2:{i:0;O:34:"Drupal\collect\Form\ProcessingForm":9:{s:12:"*
@arildm
arildm / gist:31adc344b2028d29b5d7
Created May 28, 2015 12:09
Serialized CollectJsonSchema plugin instance, pretty-printed
array(25) {
'#attributes' =>
array(1) {
'class' =>
array(2) {
[0] =>
string(23) "collect-processing-form"
[1] =>
string(19) "collect-schema-form"
}
@arildm
arildm / Top 25 Doctor Who (1963) Episodes.txt
Created October 26, 2012 09:09
Episodes from referenced IMDb list, with episode numbers added
http://www.imdb.com/list/b_36JCbyaYw/
01. s13e82 Pyramids of Mars
02. s26e158 The Curse of Fenric
03. s21e136 The Caves of Androzani
04. s12e78 Genesis of the Daleks
05. s17e105 City of Death
06. s13e84 The Brain of Morbius
07. s25e152 Remembrance of the Daleks
08. s19e122 Earthshock
09. s13e81 Planet of Evil
type IP a = State -> (State,a)
data State
andThen :: IP a -> (a -> IP b) -> IP b
f `andThen` g = \s0 -> let (s1,a) = f s0
(s2,b) = g a s1
in (s2,b)
instance Monad IP where
(>>=) = andThen