Skip to content

Instantly share code, notes, and snippets.

View beshur's full-sized avatar

Alex Buznik beshur

View GitHub Profile
@beshur
beshur / compareFromCommit-TamperMonkey.js
Last active May 15, 2019 13:33
Compare from commit
// ==UserScript==
// @name compareFromCommit
// @namespace http://buznik.net/
// @version 0.1.1
// @description The script inserts a link to compare commits from the current commit in Github pull-request
// @author Alex Buznik
// @include /https:\/\/github.com\/(.*[^/])\/(.*[^/])\/pull\/(.*)/
// @downloadURL https://gist.githubusercontent.com/beshur/e1398ff5e741308cd29476f75d612bdd/raw/compareFromCommit-TamperMonkey.js
// @grant none
// ==/UserScript==
describe('RequestRepeater functions', function() {
it('should make request and repeat it at least once', function(done) {
const requestRepeater = new RequestRepeater({
request: MOCK_REQUEST,
delay: 1000
})
let times = 0;
requestRepeater.requestAndRepeat()
requestRepeater.on('result', (result, error) => {
@beshur
beshur / userscripts.js
Last active November 15, 2018 13:30
[Tampermonkey] Quora Links Remover
// ==UserScript==
// @name Quora Links Remover
// @namespace http://tampermonkey.net/
// @version 0.1.1
// @description try to read Quora again!
// @author Alex Buznik
// @match https://www.quora.com/
// @grant none
// ==/UserScript==
@beshur
beshur / Gruntfile.js
Last active April 20, 2018 15:55
Chrome Extension Grunt Build Script
// Task configurations
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('manifest.json'),
bumpup: {
options: {
updateProps: {
pkg: 'manifest.json'
}
},
@beshur
beshur / convert.sh
Created April 3, 2018 11:56 — forked from akost/convert.sh
Bash script for recursive file convertion windows-1251 --> utf-8
#!/bin/bash
# Recursive file convertion windows-1251 --> utf-8
# Place this file in the root of your site, add execute permission and run
# Converts *.php, *.html, *.css, *.js files.
# To add file type by extension, e.g. *.cgi, add '-o -name "*.cgi"' to the find command
find ./ -name "*.php" -o -name "*.html" -o -name "*.css" -o -name "*.js" -type f |
while read file
do
@beshur
beshur / hsb.scss
Created November 14, 2014 09:45
Sass: HSB to HSL converter
// Simple HSB to HSL converter by Alexander Futekov (@futekov)
// http://www.sitepoint.com/hsb-colors-with-sass/
//
@function hsb($h-hsb, $s-hsb, $b-hsb, $a: 1) {
@if $b-hsb == 0 {
@return hsla(0, 0, 0, $a)
} @else {
$l-hsl: ($b-hsb/2) * (2 - ($s-hsb/100));
$s-hsl: ($b-hsb * $s-hsb) / if($l-hsl < 50, $l-hsl * 2, 200 - $l-hsl * 2);
@return hsla($h-hsb, $s-hsl, $l-hsl, $a);
@beshur
beshur / gist:4124512
Created November 21, 2012 11:50
Sublime Text 2 - Useful Shortcuts Windows

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
@beshur
beshur / debounce.js
Created December 3, 2015 18:37
javascript debounce
/**
* Debounce creates a FUNCTION that when invoked, delays invoking func for wait milliseconds since
* the last time it is called.
*
* Examples of where this may be useful:
*
* // Avoiding repeated costly operations while a window size is in flux
* jQuery(window).on('resize', debounce(calculateLayout, 150));
*
* // Avoiding triggering an event on a double button press
@beshur
beshur / deploy.sh
Created February 20, 2015 15:53
Deployment script
#!/bin/sh
cd ..
grunt release
cd build
echo "compressing..."
tar -cf portal.tgz ../* --exclude=../node_modules --exclude=../tests/node_modules --exclude=../data --exclude=../config/local.json
echo "deploying to server"
scp -r portal.tgz root@server:/root/remote-folder/
echo "updating sources"
ssh root@server "
@beshur
beshur / twirlTimer.css
Created November 11, 2016 15:52
twirlTimer
.block {
text-align: center;
}
.spinner {
padding: 15px 0;
display: inline-block;
font-size: 30px;
font-weight: bold;
}