// jQuery
$(document).ready(function() {
// code
})
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Roskis | |
* | |
* Adds custom trash view that can be also accessed by defined roles | |
* Pages in trash can be searched, sorted and restored. | |
* | |
* | |
* Copyright 2013 by Antti Peisa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Override limit based on user input | |
if($userLimit = (int) $input->get->limit) { | |
$remeberLimit = "?limit=$userLimit"; | |
$limit = $userLimit; | |
$input->whitelist('limit', $limit); | |
} | |
// Get year filter | |
if($userYear = (int) $sanitizer->selectorValue($input->get->year)) { | |
$year = $userYear; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Batch delete all fields containing order_ in name */ | |
foreach($fields->find("name%=order_") as $field) { | |
$fields->delete($field); | |
if (!$fields->get($field)) echo "<p>field {$field->name} was deleted.</p>"; | |
} | |
/* list all templates and provide ability to delete unused ones */ | |
if ($input->post->submit) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$json = file_get_contents('https://api.pinterest.com/v3/pidgets/boards/Globetrawter/natural-homes/pins/'); | |
$jsonIterator = new RecursiveIteratorIterator( | |
new RecursiveArrayIterator(json_decode($json, TRUE)), | |
RecursiveIteratorIterator::SELF_FIRST); | |
foreach ($jsonIterator as $key) { | |
// get only url you can var_dump($key) and see what you like ;-) | |
if(isset($key['url']) && strpos($key['url'], '.jpg') !== false) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace ProcessWire; | |
/** | |
* An Inputfield for handling relational Page inputs | |
* | |
* Delegates the actual input control to a user-defined Inputfield derived from InputfieldSelect | |
* | |
* @method PageArray getSelectablePages(Page $page) | |
* @method PageArray findPagesCode(Page $page) | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add to any textarea field from field settings | |
* or place the following code into any template file | |
* | |
* $modules->TextformatterBlogImages->formatValue($page, new Field(), $page->body); | |
* where $page->body is your textarea | |
* | |
* make sure to review path to simple_html_dom.php | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Git create empty branch | |
*/ | |
git checkout --orphan <branchname> # branch without parents | |
git rm --cached -r . # clear the working directory | |
/** | |
* rename git branch locally and remotely | |
* @from https://gist.github.com/lttlrck/9628955 |
Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.
This solution fixes the error caused by trying to run npm update npm -g
. Once you're finished, you also won't need to use sudo
to install npm modules globally.
Before you start, make a note of any globally installed npm packages. These instructions will have you remove all of those packages. After you're finished you'll need to re-install them.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$field = $fields->get("field_name_here"); // Insert system field i.e. roles | |
$field->flags = Field::flagSystemOverride; | |
$field->flags = 0; | |
$field->save(); |
OlderNewer