Skip to content

Instantly share code, notes, and snippets.

View beshur's full-sized avatar

Alex Buznik beshur

View GitHub Profile
@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 / 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==
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 / 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==
@beshur
beshur / canvas.js
Created September 13, 2019 07:39
Multiple covers on canvas
// image width and height
var iw = 132;
var imageCounter = 0;
var x = 0;
var y = 0;
var ctx = document.getElemenyById('c').getContext('2d');
ctx.fillStyle = "white";
ctx.fillRect(0, 0, 800, 1100);
@beshur
beshur / git_notes.md
Created November 22, 2019 11:45 — forked from jaygooby/git_notes.md
Git, you bloody git

Remove all local tracking branches to a remote & then delete the remote

git remote prune origin && git remote rm origin

Force checkout a branch to avoid the commit or stash your changes warning

Sometimes when you want to checkout a branch, even though your current branch is clean, you'll get a failed partial checkout, because a file in your current branch will be changed by the new branch (Looking at you .xcodeproj files). As long as you know your current branch is clean and up-to-date, -f force the checkout

git checkout -f the_branch

@beshur
beshur / 9gag-pics-only.js
Last active November 29, 2019 07:25
9gag-pics-only userscript
// ==UserScript==
// @name 9gag-pics-only
// @namespace https://buznik.net/
// @version 1.0.0
// @description Hide videos and GIFs from 9gag
// @author Alex Buznik
// @match https://9gag.com/
// @grant none
// ==/UserScript==
@beshur
beshur / README.md
Last active May 4, 2020 12:02
Aegea Lazy Loading

Ленивая загрузка картинок в Эгее

script.js - код, который обнаруживает, что картинка как минимум на 10% в зоне видимости, и начинает загрузку. Надо положить в /user/js и в шаблоне включить, например, в layout.tmpl.php где-то ближе к концу <?php _JS('script'); ?>

Файлы system_neasden_extensions_fotorama.php, system_neasden_extensions_picture.php нужно положить/заменить соответствующие файлы в system/neasden/extensions - fotorama.php и picture.php. Чтобы не заменять файлы полностью, достаточно заменить код возле блоков //CHANGE

  • picture.php - заменяем src на плейсхолдер (надо указать путь к вашей картинке-плейсхолдеру), а оригинальный путь переносим в атрибут data-src
@beshur
beshur / hourglassSum.js
Created October 23, 2020 14:48
hourglassSum.js
/*
Sample Input
1 1 1 0 0 0
0 1 0 0 0 0
1 1 1 0 0 0
0 0 2 4 4 0
0 0 0 2 0 0
0 0 1 2 4 0
@beshur
beshur / keybase.md
Created January 31, 2021 21:35
Keybase proof

Keybase proof

I hereby claim:

  • I am beshur on github.
  • I am shu (https://keybase.io/shu) on keybase.
  • I have a public key ASCwgu0UpuiydMOwgNxaqatExgv9AJomk-ClB91-OB281Qo

To claim this, I am signing this object: