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 sleep(ms) { | |
return new Promise(resolve => setTimeout(resolve, ms)); | |
} | |
// using | |
// await sleep(300); |
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
@keyframes block-ui-spin { | |
from { | |
transform: rotate(0deg); | |
} | |
to { | |
transform: rotate(359deg); | |
} | |
} |
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
<style> | |
input[type="file"]{ | |
position: absolute; | |
top: -500px; | |
} | |
div.file-listing{ | |
width: 200px; | |
} |
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
$files = $_FILES[ 'attachments' ]; | |
$attachments = []; | |
foreach ( $files['name'] as $key => $value ) { | |
if ( $files[ 'name' ][ $key ] ) { | |
$file = array( | |
'name' => $files[ 'name' ][ $key ], | |
'type' => $files[ 'type' ][ $key ], | |
'tmp_name' => $files[ 'tmp_name' ][ $key ], | |
'error' => $files[ 'error' ][ $key ], |
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
// Implementation in ES6 | |
function pagination(c, m) { | |
var current = c, | |
last = m, | |
delta = 2, | |
left = current - delta, | |
right = current + delta + 1, | |
range = [], | |
rangeWithDots = [], | |
l; |
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
let getUserMedia; | |
let browserUserMedia = navigator.webkitGetUserMedia | |
|| navigator.mozGetUserMedia | |
|| navigator.getUserMedia; | |
if (!browserUserMedia) throw 'Your browser doesn\'t support WebRTC'; | |
getUserMedia = browserUserMedia.bind(navigator); | |
let successCb = stream => { |
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
#!/usr/bin/env bash | |
# https://docs.docker.com/install/linux/docker-ce/ubuntu/ | |
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable" | |
sudo apt-get update | |
sudo apt-get install docker-ce | |
# https://docs.docker.com/compose/install/ |
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
export const getOffset = (e, offset = 3, isCentered = true) => { | |
const pageX = e.pageX | |
const pageY = e.pageY | |
const scrollTop = window.pageYOffset // To remove a {scrollTop} from the {pageY} | |
const winWidth = window.innerWidth | |
const winHeight = window.innerHeight | |
const centerTop = winHeight / 2 | |
const centerLeft = winWidth / 2 | |
const onePercentWidth = centerLeft / offset | |
const onePercentHeight = centerTop / offset |
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 logClass(target: any) { | |
// save a reference to the original constructor | |
var original = target; | |
// a utility function to generate instances of a class | |
function construct(constructor, args) { | |
var c : any = function () { | |
return constructor.apply(this, args); | |
} |
OlderNewer