Skip to content

Instantly share code, notes, and snippets.

View beshur's full-sized avatar

Alex Buznik beshur

View GitHub Profile
@beshur
beshur / mockVrtComands.ts
Created October 12, 2023 08:41
mock cypress VRT plugin
/* global Cypress, cy */
const commandsToMock = ['vrtStart', 'vrtStop', 'vrtTrack', 'vrtTrackBuffer', 'vrtTrackBase64'];
export default function mockVrtComands() {
commandsToMock.forEach((command) => {
Cypress.Commands.add(
command,
{
// optional: may start a chain, or use an existing chain: (dual command)
prevSubject: 'optional',
},
@beshur
beshur / encodeAndOpenSchema.js
Created July 11, 2023 09:43
Encode to base64 And Open prisma.schema in prismalizer
#!/usr/bin/env node
const { readFileSync } = require("fs");
const cp = require("child_process");
function openUrl(port) {
const data = btoa(readFileSync("./prisma/schema.prisma", "utf8"));
console.log("data.length", data.length);
const start =
process.platform == "darwin"
? "open"
@beshur
beshur / gitlabThread.ts
Created September 1, 2022 10:24
Danger.js create gitlab thread
import {danger} from 'danger';
const enFile = 'lang/en.json';
const deFile = 'lang/de.json';
const NEEDS_TRANSLATION =
'🌍 This MR contains changes in translation files, do not forget to run translation script right before the merge.';
if (danger.git.modified_files.includes(enFile)) {
if (!danger.git.modified_files.includes(deFile)) {
danger.gitlab.api.MergeRequestDiscussions.all(
@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:

@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 / 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 / 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 / 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 / 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 / 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==