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 | |
/** | |
* simple method to encrypt or decrypt a plain text string | |
* initialization vector(IV) has to be the same when encrypting and decrypting | |
* | |
* @param string $action: can be 'encrypt' or 'decrypt' | |
* @param string $string: string to encrypt or decrypt | |
* | |
* @return string | |
*/ |
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
function poll(fn, timeout, interval) { | |
var endTime = Number(new Date()) + (timeout || 2000); | |
interval = interval || 100; | |
return new Promise(function(resolve, reject) { | |
(function p() { | |
// If the condition is met, we're done! | |
if (fn()) { | |
resolve(); | |
} |
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
/** | |
* Problem: an Hammer.JS instance listens to the horizontal swipe gestures | |
* targeted at a top-level html element (e.g.: body) in order to show/hide | |
* an off-canvas menu; it should be possible to browse a touch-enabled carousel | |
* placed in the same page (e.g.: RoyalSlider, Owl Carousel or similar) without | |
* interfering with the above listener. | |
* | |
* Solution: enable Hammer.JS custom DOM events and prevent any "swipe" gesture | |
* from bubbling up to the body element by stopping event propagation via listeners | |
* attached to each nested touch-enabled element (e.g.: the carousel) |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Box Shadow</title> | |
<style> | |
.box { | |
height: 150px; | |
width: 300px; | |
margin: 20px; |
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
// Example Use | |
(function () { | |
function success() { | |
console.log("success: ", this.src); | |
} | |
function failure() { | |
console.log("failure: ", this.src); | |
} |