Skip to content

Instantly share code, notes, and snippets.

@mergeweb
mergeweb / gist:4666385
Created January 29, 2013 18:25
Replace the default gallery with a simple thickbox
add_action('init', 'load_classes');
/**
* Function Name: load_classes
* Description: Load the classes we need
* Date Added: Thu, Jan 24, 2013
*/
function load_classes(){
global $GalleryHelper;
require.config({
baseUrl:'/js/Dash',
shim: {
backbone: {
deps: [
"underscore",
"jquery"
],
exports: "Backbone"
},
● apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2)
Active: failed (Result: exit-code) since Thu 2015-05-14 11:50:34 EDT; 6min ago
Process: 5837 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)
@mergeweb
mergeweb / Field Options
Last active August 29, 2015 14:21
ACF Fields Repeatable
{
"id":"whitepaper_acf",
"title":"Whitepaper ACF",
"location":[
[
{
"param":"post_type",
"operator":"==",
"value":"upnup-whitepapers",
"order_no":0,
<table cellspacing="0" cellpadding="0" class="gstl_50 gssb_c" style="width: 599px; top: 485px; position: absolute; text-align: left; /* display: none; */ left: 34px;" dir="ltr">
<tbody>
<tr>
<td class="gssb_f"></td>
<td class="gssb_e" style="width: 100%;">
<table cellspacing="0" cellpadding="0" class="gsc-completion-container" style="width: 100%;">
<tbody>
<tr class="">
<td class="gssb_a " dir="ltr" style="text-align: left;">
<div class="gsq_a">
function create_post_types() {
register_post_type('degrees-and-programs', [
'labels' => [
'name' => 'Degrees and Programs',
'all_items' => 'All Degrees/Programs'
],
'public' => true,
'has_archive' => true,
'rewrite' => ['slug' => 'degrees-and-programs'],
'hierarchical' => true,
<?php
$this->Source = $this->getMock('PwfSource');
ConnectionManager::create($this->sourceName, array(
'datasource' => get_class($this->Source),
));
$this->Model = $this->getMock(
'PwfTask',
array('getDataSource'),
<?php
App::uses('PwfSource', 'Model/Datasource');
App::uses('Model', 'Model');
public function setUp() {
$this->Source = ClassRegistry::init('PwfSource');
$this->sourceMethods = get_class_methods($this->Source);
$methods = array_diff($this->sourceMethods, ['read', '__call', '__isset', '__get']);
$this->Source = $this->getMock('PwfSource', $methods);
Request = {
send: function (options) {
this.options.success = this.success.bind(this);
this.options.error = this.error.bind(this);
this.options = _.extend(this.options, options)
return this.request(this.options);
},
request: function (options){
return new Promise(function (resolve, reject){
// Do the usual XHR stuff
@mergeweb
mergeweb / stuff.js
Last active September 10, 2015 13:20
this.beforeSave()
.then(this.send.bind(this))
.then(this.success.bind(this))
.then(this.afterSave.bind(this))
// Error validation shown in page
.catch(function(error){
// HERE IS WHERE I WANT THE DEFAULT HTML5 ERRORS TO SHOW
// This will be called if any of the above promises throw an error
})
.then(this.enable_save.bind(this))