Skip to content

Instantly share code, notes, and snippets.

vilepickle

Block or report user

Report or block vilepickle

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
@vilepickle
vilepickle / DomainNegotiatorCurlTest.php
Created Jun 6, 2018
Tests for custom domain negotiation in Drupal 8 with the domain module and multilingual endpoints
View DomainNegotiatorCurlTest.php
<?php
namespace Drupal\Tests\domain_locale_custom\Unit;
use Drupal\Tests\UnitTestCase;
use DrupalProjectStub\Settings\ProjectSettings;
/**
* Unit tests that run curl against the current site.
*
View gist:0431b295f206f0be172a73a68e32c481
### Keybase proof
I hereby claim:
* I am vilepickle on github.
* I am vilepickle (https://keybase.io/vilepickle) on keybase.
* I have a public key ASD0JfVQ9ykOJBejxQQNEsioxzAJGp9WhAjnhf9ZUb979go
To claim this, I am signing this object:
@vilepickle
vilepickle / unset_comment_tips.info.yml
Last active Apr 25, 2018
Unset the filter tips link under comments form in Drupal 8
View unset_comment_tips.info.yml
name: Remove Comment Tips
type: module
description: Remove the comment tips link beneath comment forms in Drupal 8.
core: 8.x
version: '8.x-1.0'
@vilepickle
vilepickle / yourtheme.theme
Last active Jan 11, 2016
Manipulate search tab URLs in Drupal 8
View yourtheme.theme
/**
* Implements hook_pre_render_HOOK() for menu-local-tasks templates.
*
* Changes search tab URLs if you have more than one search page to be able
* to automatically search the other page when you navigate to it.
* This snippet assumes two search plugins:
* search.plugins:node_search (core)
* search.plugins:content_part (custom)
*
* This snippet assumes two search routes:
@vilepickle
vilepickle / performance.now()-polyfill.js
Created Oct 1, 2015 — forked from paulirish/performance.now()-polyfill.js
performance.now() polyfill (aka perf.now())
View performance.now()-polyfill.js
// @license http://opensource.org/licenses/MIT
// copyright Paul Irish 2015
// Date.now() is supported everywhere except IE8. For IE8 we use the Date.now polyfill
// github.com/Financial-Times/polyfill-service/blob/master/polyfills/Date.now/polyfill.js
// as Safari 6 doesn't have support for NavigationTiming, we use a Date.now() timestamp for relative values
// if you want values similar to what you'd get with real perf.now, place this towards the head of the page
// but in reality, you're just getting the delta between now() calls, so it's not terribly important where it's placed
@vilepickle
vilepickle / gist:092e421c36d138c8e65d
Created Jan 8, 2015
Create a new Wordpress page after making a new form and embed the new Gravity Form in it
View gist:092e421c36d138c8e65d
/**
* Create a new Wordpress page after making a new form
* and embed the new Gravity Form in it
*/
add_action("gform_after_save_form", "actonregister_create_page", 10, 2);
function actonregister_create_page($form, $is_new){
$user = wp_get_current_user();
if($is_new){
$page_id = wp_insert_post(array(
'post_title' => $form["title"],
@vilepickle
vilepickle / gist:2f606578158c9467e2a4
Created Jan 8, 2015
Gravity Forms custom validation: Ensure that the total on a product form is > 0
View gist:2f606578158c9467e2a4
/**
* Ensure that the total on a product form is > 0
*/
add_filter('gform_validation', 'actonregister_validate_total');
function actonregister_validate_total($validation_result){
$form = $validation_result["form"];
$current_page = rgpost('gform_source_page_number_' . $form['id']) ? rgpost('gform_source_page_number_' . $form['id']) : 1;
foreach($form["fields"] as &$field){
$field_page = $field['pageNumber'];
@vilepickle
vilepickle / template.php
Last active Aug 29, 2015
Bootstrap 3 Pager for Drupal 6 template.php entry
View template.php
<?php
function YOURTEMPLATE_pager($tags = array(), $limit = 10, $element = 0, $parameters = array()) {
global $pager_page_array, $pager_total;
$page_prev = $pager_page_array[$element] - 1;
$page_curr = $pager_page_array[$element] + 1;
$page_next = $pager_page_array[$element] + 1;
$page_last = $pager_total[$element] - 1;
if ($pager_total[$element] > 1) {
$output = '<ul class="pagination">';
if ($pager_page_array[$element]!=0) {
You can’t perform that action at this time.