This file contains hidden or 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
$dispatcher = Model::getEventDispatcher() | |
// Remove Dispatcher Model::unsetEventDispatcher() | |
//DO THINGS $model->save(); | |
// Re-add Dispatcher Model::setEventDispatcher($dispatcher); |
This file contains hidden or 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 | |
const HTTP_CONTINUE = 100; | |
const HTTP_SWITCHING_PROTOCOLS = 101; | |
const HTTP_PROCESSING = 102; // RFC2518 | |
const HTTP_OK = 200; | |
const HTTP_CREATED = 201; | |
const HTTP_ACCEPTED = 202; | |
const HTTP_NON_AUTHORITATIVE_INFORMATION = 203; | |
const HTTP_NO_CONTENT = 204; | |
const HTTP_RESET_CONTENT = 205; |
This file contains hidden or 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
function b64EncodeUnicode(str) { | |
return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function(match, p1) { | |
return String.fromCharCode('0x' + p1); | |
})); | |
} |
This file contains hidden or 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
// base64 decode and utf-8 decode the base64 encoded string | |
let encodedData = 'base64encodedstring...'; | |
let decodedData = JSON.parse(decodeURIComponent(Array.prototype.map.call(atob(encodedData), function(c) { | |
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2); | |
}).join(''))); |
This file contains hidden or 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
$.fn.serializeFormJSON = function () { | |
var o = {}; | |
var a = this.serializeArray(); | |
$.each(a, function () { | |
if (o[this.name]) { | |
if (!o[this.name].push) { | |
o[this.name] = [o[this.name]]; | |
} | |
o[this.name].push(this.value || ''); | |
} else { |
This file contains hidden or 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
camelCase.replace(/([A-Z])/g, '-$1').toLowerCase() |
This file contains hidden or 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
for (let property in object) { | |
if (object.hasOwnProperty(property)) { | |
// do stuff | |
} | |
} |
This file contains hidden or 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
camelCase.replace(/([A-Z])/g, function (g) { | |
return "-" + g[0].toLowerCase(); | |
}) |
NewerOlder