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
// Cache user inputs into HTML5 local storage. Restore them upon next page load. | |
// Usage: | |
// $('body').CacheInputs(); | |
// | |
// Will store stringified JSON in local storage, against the key you specify | |
// or 'cache-inputs' if you omit it. See settings below. | |
// | |
// Author: Martin Drapeau | |
// | |
// Greatly inspired from Johnathan Schnittger |
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 if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | |
class MY_Session extends CI_Session{ | |
private $sess_use_redis = TRUE; | |
private $redis = ''; | |
public function __construct($params = array()) { | |
//parent::__construct(); | |
$this->CI =& get_instance(); |
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 if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | |
//Create a new config file | |
/* | |
|-------------------------------------------------------------------------- | |
| Number of databases in use | |
|-------------------------------------------------------------------------- | |
| | |
| Using a Master and Slave. The Slave doubles as a read-only database. |
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
// Decay class, to call a callback less and less often. For example, | |
// make an Ajax request and freshen the decay only if the request has changed. | |
// | |
// To start the timeouts, call decay_object.start() | |
// To freshen up the speed of query, call decay_object.reset() | |
// | |
// Options: | |
// - seconds: time between each callback at the start and after a reset() (default 2) | |
// - decay: multiplier to use after each callback call (default 1.3) | |
// - max: maximum number of seconds to wait between each call (default 42) |
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 | |
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/ | |
/* Remove Date Meta Tags Output by Yoast SEO | |
* Credit: Yoast development team | |
* Last Tested: Apr 09 2019 using Yoast SEO 10.1.3 on WordPress 5.1.1 | |
* For Yoast SEO 14.0 or newer, please see https://yoast.com/help/date-appears-search-results/#h-managing-dates | |
*/ | |
add_action('wpseo_dc_'.'DC.date.issued', '__return_false'); // Premium versions 5.2 or older |
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 | |
// @rodneyrehm | |
// http://stackoverflow.com/a/7917979/99923 | |
class ParensParser | |
{ | |
// something to keep track of parens nesting | |
protected $stack = null; | |
// current level | |
protected $current = null; |
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
<template> | |
<div> | |
<input v-validate data-rules="required" :class="{'has-error': errors.has("textInput")}" id="textInput" name="textInput" type="text"> | |
<span class="error" v-show="errors.has("textInput")">{{ errors.first("textInput") }}</span> | |
</div> | |
</template> | |
<script> | |
import { find, propEq } from 'ramda' | |
import bus from './bus' |
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
['Alberta', 'British Columbia', 'Manitoba', 'New Brunswick', 'Newfoundland and Labrador', 'Northwest Territories', 'Nova Scotia', 'Nunavut', 'Ontario', 'Prince Edward Island', 'Quebec', 'Saskatchewan', 'Yukon Territory'] |
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
add_action('post_submitbox_misc_actions', createCustomField); | |
add_action('save_post', saveCustomField); |
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
const analyticsId = 'UA-xxxxxxxxx-x' | |
addEventListener('fetch', event => { | |
event.respondWith(handleRequest(event)) | |
}) | |
/** | |
* Check request object for Googlebot UA to send tracking data | |
* @param {Event} event | |
*/ |
OlderNewer