Skip to content

Instantly share code, notes, and snippets.

@oboshto
oboshto / domain regexp
Last active January 25, 2017 12:58
cyr/latin domain regex
^(http(s)?:\/\/)?([ะฐ-ัั‘ะ-ะฏะa-zA-Z0-9]([ะฐ-ัั‘ะ-ะฏะa-zA-Z0-9\-]{0,61}[ะฐ-ัั‘ะ-ะฏะa-zA-Z0-9])?\.)+[ะฐ-ัั‘ะ-ะฏะa-zA-Z]{2,6}\/?$
@oboshto
oboshto / shuffle.js
Last active February 1, 2017 15:45
array shuffle
let shuffle = function (array) {
for (let i = array.length - 1; i > 0; i -= 1) {
let j = Math.floor(Math.random() * (i + 1));
let temp = array[i];
array[i] = array[j];
array[j] = temp;
}
return array;
};
@oboshto
oboshto / dateperiod.php
Created February 2, 2017 10:57
Just an example to include the end date using the DateTime method 'modify'
<?php
$begin = new DateTime( '2012-08-01' );
$end = new DateTime( '2012-08-31' );
$end = $end->modify( '+1 day' );
$interval = new DateInterval('P1D');
$daterange = new DatePeriod($begin, $interval ,$end);
foreach($daterange as $date){
@oboshto
oboshto / copyFake.js
Last active February 2, 2017 12:46
Replace copied selection
function fakeCopy () {
let selection = window.getSelection();
let fakeDiv = document.createElement('div');
fakeDiv.innerHTML = 'COPIED SELECTION REPLACED';
fakeDiv.style.position = 'absolute';
fakeDiv.style.top = '-999999px';
document.body.appendChild(fakeDiv);
selection.selectAllChildren(fakeDiv);
window.setTimeout(function () {
document.body.removeChild(fakeDiv);
@oboshto
oboshto / vk.ad_loaded.js
Created February 8, 2017 17:10
vk ad loaded callback
VK.Widgets.Ads('vk_ads_id', {
onAdsReady: function() {
console.log('ad loaded');
}}, adsParams);
@oboshto
oboshto / scrollProgress.js
Last active March 23, 2017 16:36
A little progress bar for scrolling
function setProgress() {
let bar = document.querySelector('.js-content-bar'),
content = document.body,
max = content.scrollHeight - window.innerHeight,
progressValue = content.scrollTop / max * 100;
bar.setAttribute('value', progressValue);
}
window.addEventListener('scroll', setProgress);
@oboshto
oboshto / emojis.md
Created March 23, 2017 16:35
full list of emoji
emoji aliases tags
๐Ÿ‘ :+1:, :thumbup:, :thumbsup: thumbs, up, sign, body, hands, hi, luck, thank, you, diversity, diversity, perfect, perfect, good, good, beautiful, beautiful
๐Ÿ‘๐Ÿป :+1_tone1:, :thumbup_tone1:, :thumbsup_tone1: thumbs, up, sign, tone, 1
๐Ÿ‘๐Ÿผ :+1_tone2:, :thumbup_tone2:, :thumbsup_tone2: thumbs, up, sign, tone, 2
๐Ÿ‘๐Ÿฝ :+1_tone3:, :thumbup_tone3:, :thumbsup_tone3: thumbs, up, sign, tone, 3
๐Ÿ‘๐Ÿพ :+1_tone4:, :thumbup_tone4:, :thumbsup_tone4: thumbs, up, sign, tone, 4
๐Ÿ‘๐Ÿฟ :+1_tone5:, :thumbup_tone5:, :thumbsup_tone5: thumbs, up, sign, tone, 5
๐Ÿ‘Ž :-1:, :thumbdown:, :thumbsdown: thumbs, down, sign, body, hands, diversity, diversity
๐Ÿ‘Ž๐Ÿป :-1_tone1:, :thumbdown_tone1:, :thumbsdown_tone1: thumbs, down, sign, tone, 1
@oboshto
oboshto / moods.js
Created March 24, 2017 09:21
all moods
['STUDYING',
'CALM',
'PIANO',
'HAPPY',
'CLASSICAL',
'DREAMY',
'GROOVY',
'SEXY',
'JUST WOKE UP',
'SECOND CHANCE',
@oboshto
oboshto / textAnimations.css
Created March 24, 2017 11:34
Colored text via gradient with animation
.text{
background: -webkit-linear-gradient(right, #26bf98, #2695bf);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-size: 400% 400%;
animation: bg-animation 3s ease infinite;
}
@keyframes bg-animation {
@oboshto
oboshto / reset.css
Created April 12, 2017 08:44
css isolation reset
.reset {
background:none;
border:none;
bottom:auto;
clear:none;
cursor:default;
float:none;
font-size:medium;
font-style:normal;
font-weight:normal;