Skip to content

Instantly share code, notes, and snippets.

Paul Huisman paulhuisman

Block or report user

Report or block paulhuisman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@paulhuisman
paulhuisman / Solarized - Paul.xml
Created Jun 28, 2017
SublimeText Solarized customized theme
View Solarized - Paul.xml
<?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>
View acf-hooks.php
<?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;
}
View gist:304ab83fc385e5ce861d
// 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
@paulhuisman
paulhuisman / flickr_field_example.php
Last active Aug 29, 2015
Flickr field code example
View flickr_field_example.php
<?php $flickr_photostream = get_field('flickr_photoset'); ?>
<?php if (isset($flickr_photostream['items'])): ?>
<ul class="flickr-items">
<?php foreach ($flickr_photostream['items'] as $id => $photo): ?>
<li>
<a href="<?php echo $photo['large']; ?>" title="<?php echo $photo['title']; ?>">
<img src="<?php echo $photo['thumb']; ?>" />
</a>
</li>
@paulhuisman
paulhuisman / simpleform_mails
Last active Aug 29, 2015
Simpleform Mailform Rails
View simpleform_mails
# model; quotations.rb
class Quotation < MailForm::Base
attribute :name, :validate => true
attribute :email, :validate => /\A([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})\z/i
attribute :organisation, :validate => true
attribute :telephone, :validate => true
attribute :attachment, :attachment => true
attribute :message
# Declare the e-mail headers. It accepts anything the mail method
@paulhuisman
paulhuisman / register_post_type.php
Created Dec 16, 2014
Register post type in WordPress
View register_post_type.php
<?php
/* Register custom post types on the 'init' hook. */
add_action( 'init', 'my_register_post_types' );
/**
* Registers post types needed by the plugin.
*
* @since 0.1.0
* @access public
@paulhuisman
paulhuisman / git commands
Last active Aug 29, 2015
Fancy git commands
View git commands
// Cherry pick; edit message
git cherry-pick --edit 3fbd473
// Cherry pick; see where its cherry picked from
git cherry-pick -x bdf9578
// Cherry pick; put your username on the cherry pick
git cherry-pick --signoff bdf9578
View EntityFieldQuery.php
<?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 Dec 15, 2015
Ajax Callbacks in Drupal Forms API
View ajax_callback_drupal.php
<?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 .'">';
View basic_html.html
<!DOCTYPE html>
<html>
<head>
<title>Moo test</title>
</head>
<body>
<h1>Moo</h1>
<p>Lorem ipsum..</p>
</body>
</html>
You can’t perform that action at this time.