Skip to content

Instantly share code, notes, and snippets.

<?php
$colors = [
1 => '#7E7EEB',
'#D483E5',
'#F693DB',
'#EF6B8F',
'#EF9A5A',
'#FBD263',
'#C0DC83',
@weeger
weeger / parse_yaml.sh
Created November 21, 2017 20:31 — forked from pkuczynski/parse_yaml.sh
Read YAML file from Bash script
#!/bin/sh
parse_yaml() {
local prefix=$2
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
awk -F$fs '{
indent = length($1)/2;
vname[indent] = $2;
for (i in vname) {if (i > indent) {delete vname[i]}}
@weeger
weeger / sf-update.sh
Last active March 3, 2017 14:50
Semantic Forms Update
# Go to personnal deploy folder
cd ~/deploy/
# Enter to SF source forlder
cd semantic_forms_play-1.0-SNAPSHOT
# Stops running application
./scripts/stop.sh
# ? Go to forms
cd /var/www/data/scala/forms_play/
# ? Script missing
./scripts/update_server.sh
@weeger
weeger / gist:c2f6c7efbb3f04fbd4950df19b93283a
Last active August 24, 2016 18:36 — forked from drupalista-br/gist:4223201
Drupal 7 Profile2 Custom User Tab Form ( MYMODULE_profile2_MYPROFILE2TYPE.inc )
<?php
/**
* @file
* User Profile2 MYPROFILE2TYPE.
*/
/**
* Page callback for user profile2 MYPROFILE2TYPE form.
*/
function MYMODULE_load_profile2_MYPROFILE2TYPE_form($form, &$form_state, $user = NULL) {
@weeger
weeger / gist:d2025ecffbb94c2c8b509ff821a958d0
Created August 20, 2016 10:50
Create a custom form template in Drupal 7.x
function YOURMODULE_form($form, &$form_state) {
  $form           = array();
  $form['myfield'] = array(
    '#type'     => 'text',
    '#value'    => 'Do Cool Things',
  );
  return $form;
}
/**