Skip to content

Instantly share code, notes, and snippets.

View VovanR's full-sized avatar
😺
I may be slow to respond.

Vladimir Rodkin VovanR

😺
I may be slow to respond.
View GitHub Profile
@dariok
dariok / .bashrc
Last active May 25, 2023 07:16
bash prompt with date, time and git branch
# Path for openSuSE – may be different in other distributions
source /usr/share/bash-completion/completions/git-prompt.sh
# taken from https://github.com/qupada/git-bashrc/blob/master/git-bashrc
_in_git_repo () {
# Check the current dir is actually a repository
git status &> /dev/null || return 2
# If we are not on a branch we will get annoying errors if we don't do this check
git branch | grep -qE '^\* \((no branch|detached from .*)\)' && return 1
return 0
@gragland
gragland / use-toggle.jsx
Last active October 5, 2022 05:58
Thought process when creating a useToggle() React hook with useState
import { useState, useCallback } from "react";
function useToggle(initialValue = false){
// State with initial boolean value (true/false)
const [state, setState] = useState(initialValue);
// Let's create a toggle function
// This works, but we're using the state value from above
// instead of the current state. Usually they are the same,
// but if this hook was triggered multiple times rapidly then
@n-peugnet
n-peugnet / add-dates-to-bash-prompt.md
Last active May 24, 2023 16:07
simple trick to add dates in bash prompt

Add dates to bash prompt

I think I just found the easiest and cleanest way to add precise dates to my bash prompt:

PS0=">>> \$(date +%T.%3N)\\n$PS0"
PROMPT_COMMAND='echo "<<<" $(date +%T.%3N);'$PROMPT_COMMAND

skip the explanations and see the resluts >>>

Explanations

@ai
ai / requirements.md
Last active December 19, 2023 14:19
Website requirements

Amplifr logo

Amplifr Landings Rules

Amplifr’s rules for landing pages created by outsource.

Requirements

async function processPens(pens) {
for (let pen of pens) {
await processPen(pen);
}
}
async function processPen(pen) {
await page.goto(url);
await page.waitForSelector(FORK_SELECTOR);
await page.click(FORK_SELECTOR);
@askd
askd / checklist.md
Created July 3, 2018 10:43
Чеклист спикера

Общее

  1. Представься: краткая информация о себе – имя, место работы, чем занимаешься, можно фото для тех, кто будет смотреть слайды отдельно
  2. План доклада: несколько пунктов (лучше не более 5) о чём будет доклад. Это могут быть главы доклада (кстати, составление плана может помочь грамотнее структурировать доклад ещё при создании)
  3. Зачем: кратко рассказать, чем то, о чем рассказываешь в докладе, может быть полезно остальным – и разработчикам, и руководителям, и клиентам (можно акцентироваться на аудитории конкретной конфы – например если там есть дизайнеры, бэкенды, то упомянуть, что они могут узнать из доклада)
  4. Итоги: в конце доклада ещё раз пройтись по плану и подвести итог по каждому пункту – что узнали, чему научились
  5. Контакты: как слушатель и тот кто смотрит слайды может связаться и задать вопрос

Оформление

@zaydek-old
zaydek-old / bookmark.min.js
Last active May 28, 2024 19:18
A *simple* CSS debugger. To use, bookmark "Debug CSS" at https://zaydek.github.io/debug.css. Learn more here https://medium.freecodecamp.org/88529aa5a6a3 and https://youtu.be/2QdzahteCCs?t=1m25s (starts at 1:25)
/* debug.css | MIT License | zaydek.github.com/debug.css */ if (!("is_debugging" in window)) { is_debugging = false; var debug_el = document.createElement("style"); debug_el.append(document.createTextNode(`*:not(g):not(path) { color: hsla(210, 100%, 100%, 0.9) !important; background: hsla(210, 100%, 50%, 0.5) !important; outline: solid 0.25rem hsla(210, 100%, 100%, 0.5) !important; box-shadow: none !important; filter: none !important; }`)); } function enable_debugger() { if (!is_debugging) { document.head.appendChild(debug_el); is_debugging = true; } } function disable_debugger() { if (is_debugging) { document.head.removeChild(debug_el); is_debugging = false; } } !is_debugging ? enable_debugger() : disable_debugger();
@akella
akella / shaurma.js
Created January 30, 2018 15:45
Plural intl
let items = new Intl.PluralRules('ru-RU');
let result,word;
for(var i = 0;i<25;i++){
if(items.select(i)=='one'){
word = 'шаурма';
}
if(items.select(i)=='few'){
word = 'шаурмы';
}
if(items.select(i)=='many'){

Given a subscribed calendar with a url like

https://example.com/example.ics

To force Google Calendar to refresh and reload the contents right now, unsubscribe from the calendar and subscribe to a new calendar with a URL like

https://example.com/example.ics#1

Adding the anchor tag will force Google Calendar to think of it as a new calendar

@zkat
zkat / index.js
Last active September 26, 2024 10:33
npx is cool
#!/usr/bin/env node
console.log('yay gist')