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 SALT = 'salt'; | |
const IV = '1111111111111111'; | |
const ITERATIONS = 999; | |
function userPHPEncrypt($passphrase, $plainText) | |
{ | |
$key = \hash_pbkdf2("sha256", $passphrase, SALT, ITERATIONS, 64); | |
$encryptedData = \openssl_encrypt($plainText, 'AES-256-CBC', \hex2bin($key), OPENSSL_RAW_DATA, IV); | |
return \base64_encode($encryptedData); | |
} |
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 | |
/** | |
* Simple request response script | |
* | |
* Point you cURL request to this script to see all incoming data | |
*/ | |
echo '*API*'. PHP_EOL; |
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
--- | |
METHOD 1 | |
This should roughly sort the items on distance in MySQL, and should work in SQLite. | |
If you need to sort them preciser, you could try using the Pythagorean theorem (a^2 + b^2 = c^2) to get the exact distance. | |
--- | |
SELECT * | |
FROM table | |
ORDER BY ((lat-$user_lat)*(lat-$user_lat)) + ((lng - $user_lng)*(lng - $user_lng)) ASC |
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 | |
include_once 'google-api-php-client/vendor/autoload.php'; | |
$client = new Google_Client(); | |
$application_creds = 'service-account-credentials.json'; | |
$credentials_file = file_exists($application_creds) ? $application_creds : false; | |
define("SCOPE",Google_Service_Calendar::CALENDAR); | |
define("APP_NAME","Google Calendar API PHP"); |
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.filterGroups = function( options ) { | |
var settings = $.extend( {}, options); | |
return this.each(function(){ | |
var $select = $(this); | |
// Clone the optgroups to data, then remove them from dom | |
$select.data('fg-original-groups', $select.find('optgroup').clone()).children('optgroup').remove(); | |
$(settings.groupSelector).change(function(){ |
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
valid_elements : "" | |
+"@[accesskey|draggable|style|class|hidden|tabindex|contenteditable|id|title|contextmenu|lang|dir<ltr?rtl|spellcheck|" | |
+"onabort|onerror|onmousewheel|onblur|onfocus|onpause|oncanplay|onformchange|onplay|oncanplaythrough|onforminput|onplaying|onchange|oninput|onprogress|onclick|oninvalid|onratechange|oncontextmenu|onkeydown|onreadystatechange|ondblclick|onkeypress|onscroll|ondrag|onkeyup|onseeked|ondragend|onload|onseeking|ondragenter|onloadeddata|onselect|ondragleave|onloadedmetadata|onshow|ondragover|onloadstart|onstalled|ondragstart|onmousedown|onsubmit|ondrop|onmousemove|onsuspend|ondurationmouseout|ontimeupdate|onemptied|onmouseover|onvolumechange|onended|onmouseup|onwaiting]," | |
+"a[target<_blank?_self?_top?_parent|ping|media|href|hreflang|type" | |
+"|rel<alternate?archives?author?bookmark?external?feed?first?help?index?last?license?next?nofollow?noreferrer?prev?search?sidebar?tag?up" | |
+"]," | |
+"abbr," | |
+"address," | |
+"area[alt|coords|shape|href|target<_blank?_self?_top?_parent|ping|media |