Skip to content

Instantly share code, notes, and snippets.

View fogrew's full-sized avatar
🚀
Open for new opportunities

Andrew Gurylev fogrew

🚀
Open for new opportunities
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<div class="door_generator">
<div class="top"></div>
<div class="gate">
@fogrew
fogrew / buttons-outline.less
Created October 29, 2014 07:52
Bootstrap 3.2 button outline style and outline style on inverse background
// Button outline style
.btn-outline {
background-color: transparent;
}
.btn-primary.btn-outline {
color: @btn-primary-bg;
&:hover {
background-color: @btn-primary-bg;
border-color: @btn-primary-border;
@fogrew
fogrew / alarm.js
Last active December 7, 2016 12:01
vk.com music bookmarklets
// Alarm
var played = 0;
var time = prompt("Во сколько разбудить?", "6:55");
var waiting = setInterval(function() {
if ((new Date()) > (new Date("May,05,2015,"+time)) && played == 0) { // it is time to awake?
played = 1;
document.getElementById('play72450163_91647005').click();
clearInterval(waiting);
}
}, 1000 * 60 * 3); // to check every 3 minutes
define(function (require) {
var patternYouTube = /\/\/(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=|embed\/)?([a-z0-9_\-]+)/i;
var patternVimeo = /(http|https):\/\/(www\.)?vimeo.com\/(\d+)($|\/)/;
var patternSoundCloud = /https:\/\/(www\.)?soundcloud.com.*/;
var patternLink = /([-a-zA-Z0-9:%_\+.~#?&\/\/=]{2,256}\.[a-z]{2,4}\b(\/?[-a-zA-Z0-9:%_\+.~#?&\/\/=]*)?)/gi;
var pattern = {
url : /\s([a-z0-9а-я.-_]+)\.([a-z0-9а-я._-]{2,10})/gi, // первый символ пробел!!
email : /([a-z0-9а-я._-]+)@([a-z0-9а-я._-]+)\.([a-z0-9а-я._-]{2,10})/gi,
@fogrew
fogrew / time.js
Created August 30, 2015 13:53
Подсчёт времени разговоров на МТС
$(function() {
var min = 0;
var sec = 0;
$('table tr').each(function(e) {
var tr = $(this);
var phone = tr.find('td:nth-child(8)');
var time = tr.find('td:nth-child(10)');
if(phone.text()=='Телеф.') {
sec += parseInt(time.text().replace(/(\d+):(\d+)/, '$2'));
if(sec > 60) {
@fogrew
fogrew / buttons-outline.scss
Created October 17, 2015 09:07
Bootstrap 3.2 button outline style and outline style on inverse background
// Button outline style
.btn-outline {
background-color: transparent;
}
.btn-primary.btn-outline {
color: $btn-primary-bg;
$:hover {
background-color: $btn-primary-bg;
border-color: $btn-primary-border;
@fogrew
fogrew / Preferences.sublime-settings
Last active September 15, 2017 00:23
Preferences.sublime-settings
{
"auto_close_tags": true,
"auto_complete": true,
"auto_match_enabled": true,
"color_scheme": "Packages/User/SublimeLinter/base16-eighties (SL).tmTheme",
"draw_white_space": "all",
"enable_tab_scrolling": false,
"font_face": "Menlo",
"font_size": 18,
"highlight_line": true,
@fogrew
fogrew / easigns.scss
Created February 16, 2016 13:00
Google Material Transition Easing
$easing-swift: cubic-bezier(.4, 0, .2, 1);
$easing-swifter: cubic-bezier(.4, 0, 0, 1);
$easing-heavy: cubic-bezier(.7, 0, .6, 1);
$easing-swift-in: cubic-bezier(0, 0, .2, 1);
$easing-swift-out: cubic-bezier(.55, 0, .1, 1);
@fogrew
fogrew / eachTags.js
Created February 21, 2016 11:52
Get XPath for node
[].forEach.call(document.getElementsByTagName('a'), function (link) {
console.log(getXPathForElement(link, document));
});
@fogrew
fogrew / tricks.js
Created May 8, 2016 21:57
JavaScript tricks
// Converting NodeList to Arrays
[].slice.call(document.querySelectorAll(query));
// Shuffling array’s elements
[1,2,3].sort(Math.random() - 0.5); // [2,1,3]
// Caching the array.length in the loop
for(var i = 0, length = array.length; i < length; i++) {
console.log(array[i]);
}