Skip to content

Instantly share code, notes, and snippets.

View agudulin's full-sized avatar
🦦

sasha gudulin agudulin

🦦
View GitHub Profile

upgrading chromedriver on macos catalina v10.15.4

brew cask reinstall chromedriver
xattr -d com.apple.quarantine /usr/local/Caskroom/chromedriver/$VERSION/chromedriver
@agudulin
agudulin / git-cleanup
Created August 15, 2019 09:33 — forked from larowlan/git-cleanup
Clean up old git branches
#!/bin/bash
# This has to be run from master
git checkout master
# Update our list of remotes
git fetch
git remote prune origin
# Remove local fully merged branches
git branch --merged master | grep -v 'master$' | xargs git branch -d
function willThereEverBeARainbow(string) {
const rainbow = ['Red', 'Orange', 'Yellow', 'Green', 'Blue', 'Indigo', 'Violet'].join('').toUpperCase();
const characterFrequencyMap = (str) => str.split('').reduce((acc, letter) => {
return Object.assign({}, acc, {
[letter]: acc[letter] ? acc[letter] + 1 : 1
});
}, {});
const expectedLettersMap = characterFrequencyMap(rainbow); // => { R: 3, E: 7, D:2, ... }
const inputLettersMap = characterFrequencyMap(string);
@agudulin
agudulin / terminal-gif.md
Created July 22, 2018 10:03 — forked from protrolium/terminal-gif.md
convert images to GIF in Terminal

Install ImageMagick

brew install ImageMagick

Pull specific region of frames from video file w/ ffmpeg

ffmpeg -ss 14:55 -i video.mkv -t 5 -s 480x270 -f image2 %04d.png

  • -ss 14:55 gives the timestamp where I want FFmpeg to start, as a duration string.
  • -t 5 says how much I want FFmpeg to decode, using the same duration syntax as for -ss.
  • -s 480x270 tells FFmpeg to resize the video output to 480 by 270 pixels.
  • -f image2 selects the output format, a series of still images — make sure there are leading zeros in filename.

Releasing a new minor version

Say, the current version is 1.3.2 and you want to release 1.4.0 with some prereleases in between

$ npm version

1.3.2

And you want to make a prerelease before releasing a minor change

@agudulin
agudulin / .editorconfig
Created October 10, 2017 12:53
.editorconfig
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
@agudulin
agudulin / capybara cheat sheet
Created April 24, 2017 08:30 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
PATH := $(PATH):./node_modules/.bin/
JS = ./app/assets/javascripts
APP = $(JS)/legacy
SOURCE = $(wildcard $(APP)/common.js.coffee $(APP)/controllers/**/*.js.coffee)
TARGET = $(patsubst %.js.coffee,%.js,$(SOURCE))
LIBS = $(shell find $(APP)/{controllers,modules,utils} -name '*.js.coffee' -print)
VENDOR = $(shell find ./vendor/assets/javascripts -name '*.js' -print)
PKG = $(wildcard package.json)
FLAGS = -t browserify-shim -t coffeeify --extension='.js.coffee'
@agudulin
agudulin / github_gpg_key.md
Created October 11, 2016 13:28 — forked from ankurk91/github_gpg_key.md
Github : Signing commits using GPG (Ubuntu/Mac)

Github : Signing commits using GPG (Ubuntu/Mac) 🔐

  • You have an account on Github already ? If not create one.
  • Install required tools
  • Latest Git Client
  • gpg tools
# Ubuntu
sudo apt-get install gpa seahorse
# Mac
@agudulin
agudulin / better-nodejs-require-paths.md
Created September 26, 2016 09:53 — forked from branneman/better-nodejs-require-paths.md
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

var Article = require('../../../models/article');

Those suck for maintenance and they're ugly.

Possible solutions