Skip to content

Instantly share code, notes, and snippets.

View yurikoval's full-sized avatar
🌴
On an island in the sun

Yuri Kovalov yurikoval

🌴
On an island in the sun
  • on an island in the sun
View GitHub Profile
@yurikoval
yurikoval / prototype.sh
Last active April 22, 2023 15:06
Simple script to jumpstart a new Rails app with your favourite gems
#!/bin/bash
# This script accepts one argument, which is the name of the your new project
if [ "$#" -ne 1 ]; then
echo "Usage: $0 generate new rails app"
exit 1
fi
app=$1
@yurikoval
yurikoval / snippets.cson
Created July 30, 2019 10:49
Atom Snippets
'.source.elixir':
'exunit':
'prefix': 'exunit'
'body': 'use ExUnit.Case, async: ${1:true}$2'
'IO.inspect':
'prefix': 'io'
'body': 'IO.inspect(${1:}, label: "${2:inspecting}")$3'
'|> IO.inspect':
'prefix': 'iop'
'body': '|> IO.inspect(label: "${1:inspecting}")$2'
def    
puts "spooky!"
end
   
puts "Indeed!"
@yurikoval
yurikoval / array_finder_benchmark.rb
Created December 6, 2017 07:19
Finding an element using array/hash/set
#!/usr/bin/env ruby
require 'benchmark'
require 'active_support'
require 'active_support/all'
require 'set'
BENCHMARK_TIMES = 1_000_000
def find_array(array, find_me)
array.any?{ |id, sku| id == find_me && sku.present? }
@yurikoval
yurikoval / git_setup.sh
Last active July 1, 2020 09:13
Setup git
#!/bin/sh
# http://uberblo.gs/2010/12/git-lol-the-other-git-log
git config --global --add alias.lol "log --graph --decorate --pretty=oneline --abbrev-commit"
git config --global --add alias.lola "log --graph --decorate --pretty=oneline --abbrev-commit --all"
git config --global --add alias.m "merge --no-ff --log"
git config --global --add alias.st "status"
git config --global --add alias.br "branch"
git config --global --add alias.bra "branch --all"
git config --global --add alias.sweep "!git branch --merged master | grep -v 'master$' | xargs git branch -d && git remote prune origin"
@yurikoval
yurikoval / keymap.cson
Created August 17, 2017 03:21
Atom custom keybindings
# ~/.atom/keymap.cson
# Your keymap
#
# Atom keymaps work similarly to style sheets. Just as style sheets use
# selectors to apply styles to elements, Atom keymaps use selectors to associate
# keystrokes with events in specific contexts. Unlike style sheets however,
# each selector can only be declared once.
#
# You can create a new keybinding in this file by typing "key" and then hitting
# tab.

Keybase proof

I hereby claim:

  • I am yurikoval on github.
  • I am yurik (https://keybase.io/yurik) on keybase.
  • I have a public key ASCzecHfS9Is-DjuUelCP2aJI6mpTpsbWPOR2ppz-Nappwo

To claim this, I am signing this object:

@yurikoval
yurikoval / index.html
Created November 13, 2016 07:08
Pixelate image in console.log
<html>
<body>
<img src="http://i.imgur.com/0jWrSmF.jpg" width="300" height="234">
<canvas id="canvas" width=50></canvas>
<script>
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
img = new Image();
img.crossOrigin = 'http://profile.ak.fbcdn.net/crossdomain.xml';
@yurikoval
yurikoval / grep_unique_vars
Last active September 4, 2016 04:01
List unique ENV variables
grep -ohR 'ENV\[.[a-zA-Z_]*.]' ./* | uniq
@yurikoval
yurikoval / capybara_steps.rb
Last active March 12, 2016 08:25
Take screenshot on capybara's every browser action.
class Capybara::Session
%i(visit click_on fill_in).each do |method_name|
original_method_name = "old_#{method_name}".to_sym
alias_method original_method_name, method_name
define_method method_name do |*args|
return_value = send original_method_name, *args
save_screenshot(save_path)
increment_counter
return_value
end