Skip to content

Instantly share code, notes, and snippets.

View paulhuisman's full-sized avatar

Paul Huisman paulhuisman

View GitHub Profile
@paulhuisman
paulhuisman / README.md
Last active March 3, 2020 14:54
Test voorbeeld van een readme.md

Paul Huisman - XT2 - Challenge 1

Wat wil ik bereiken met het dashboard

<< toelichting wat wil ik bereiken met dashboard hier toevoegen>>

Designkeuzes

<< toelichting designkeuzes hier toevoegen>>

Gebruikte techniek

@paulhuisman
paulhuisman / Solarized - Paul.xml
Created June 28, 2017 07:27
SublimeText Solarized customized theme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Solarized - Paul (dark)</string>
<key>settings</key>
<array>
<dict>
<key>settings</key>
<?php
$query = new EntityFieldQuery();
$entities = $query->entityCondition('entity_type', 'node')
->entityCondition('bundle', array('column','blog'))
->propertyCondition('uid', $user->uid)
->propertyCondition('status', 1)
->propertyOrderBy('created', 'DESC')
->range(0, 3)
->execute();
@paulhuisman
paulhuisman / ajax_callback_drupal.php
Last active December 15, 2015 04:49
Ajax Callbacks in Drupal Forms API
<?php
function partners_field_attach_form($entity_type, $entity, &$form, &$form_state, $langcode) {
if ($entity_type != 'field_collection_item' || $entity->field_name != 'field_partner_products') {
return;
}
$form['#after_build'][] = 'partners_products_after_build';
$id = drupal_html_id('partners_field');
$form['#prefix'] = '<div id="'. $id .'">';
@paulhuisman
paulhuisman / acf-hooks.php
Last active November 20, 2015 13:19
ACF hooks
<?php
function acf_field_group_testing($content) {
global $pagenow, $current_screen;
if ($pagenow == 'post-new.php' || $pagenow == 'post.php' && isset($current_screen->post_type)) {
$content = change_order_for_field_group($content, $current_screen->post_type);
}
return $content;
}
@paulhuisman
paulhuisman / basic_html.html
Created December 12, 2012 09:49
Indenting test
<!DOCTYPE html>
<html>
<head>
<title>Moo test</title>
</head>
<body>
<h1>Moo</h1>
<p>Lorem ipsum..</p>
</body>
</html>
@paulhuisman
paulhuisman / modulo_end.php
Created November 30, 2012 15:56
Modulo and End PHP
<div class="block_content">
<?php $c = 0; foreach ($dossiers as $k => $dossier):
if ($c % 4 == 0) print '<div class="clearfix">';?>
<div class="dossier <?php if ($k % 4 == 3) print 'last'; ?>">
<?php if (!empty($dossier->article_image_filepath)): ?>
<a href="<?php print url('node/'.$dossier->nid); ?>"><?php print theme('imagecache', 'op_list', $dossier->article_image_filepath, '', '', array('class' => 'dossier_img')); ?></a>
<?php endif; ?>
<h4><a href="<?php print url('node/'.$dossier->nid); ?>"><?php print $dossier->title; ?></a></h4>
</div>
<?php if ($c % 4 == 3 || $count == (count($dossiers))) print '</div>';
@paulhuisman
paulhuisman / cookies_timer.php
Created November 30, 2012 15:55
Cookies check PHP
<?php
$cookie_value = NULL;
if (!isset($_COOKIE['overlay_display'])) {
$cookie_value = TRUE;
setcookie("overlay_display", $cookie_value, time()+31536000); // Expire in one year
}
else {
$cookie_value = intval($_COOKIE['overlay_display'])+1;
setcookie("overlay_display", $cookie_value, time()+31536000);
@paulhuisman
paulhuisman / php_image_upload.php
Created November 30, 2012 15:53
Image upload in PHP
<?php
function save($category) {
$packageguide = JRequest::get( 'POST' );
$files = JRequest::get( 'FILES' );
if (isset($files['image_upload']) && !$files['image_upload']['error']) {
$dir = JPATH_ROOT.DS.'media'.DS.'packageguide'.DS.$category;
if(!file_exists($dir)) {
mkdir($dir, 0777, true);
}
move_uploaded_file($files['image_upload']['tmp_name'], $dir.DS.$files['image_upload']['name']);
@paulhuisman
paulhuisman / gist:304ab83fc385e5ce861d
Last active August 29, 2015 14:24
Elasticsearch commands
// get list of all indexes
curl 127.0.0.1:9200/_aliases?pretty=1
// get count of all items in index
curl 127.0.0.1:9200/_search?search_type=count