Skip to content

Instantly share code, notes, and snippets.

@jastkand
jastkand / hexToRGBA.js
Created December 11, 2018 14:47
hexToRGBA
// https://stackoverflow.com/questions/15898740/how-to-convert-rgba-to-a-transparency-adjusted-hex
function hexify(color) {
var values = color
.replace(/rgba?\(/, '')
.replace(/\)/, '')
.replace(/[\s+]/g, '')
.split(',');
var a = parseFloat(values[3] || 1),
r = Math.floor(a * parseInt(values[0]) + (1 - a) * 255),

Keybase proof

I hereby claim:

  • I am jastkand on github.
  • I am jastkand (https://keybase.io/jastkand) on keybase.
  • I have a public key ASBPn14FnSITRAlkzA9-Ul6_93w8YN-rWTKa9MlTzmBYzAo

To claim this, I am signing this object:

@jastkand
jastkand / deploy.rb
Created June 26, 2017 06:31 — forked from noma4i/deploy.rb
Deploy Phoenix Elixir by mina
require 'mina/bundler'
require 'mina/git'
require 'mina/rbenv'
set :domain, 'your_domain.com'
set :deploy_to, '/home/deployer/app_name'
set :repository, '[email protected]:user_name/app_name'
set :branch, ENV["brunch"] || 'master'
set :app_name, "app_name"
@jastkand
jastkand / Dockerfile
Last active October 29, 2016 06:06
hackney handshake failure
FROM erlang:19.1
ENV APP_HOME /hackney
WORKDIR $APP_HOME
ADD . $APP_HOME
RUN rebar3 tree
CMD ["rebar3", "shell"]
@jastkand
jastkand / README.md
Last active December 22, 2015 11:45
Как выкладывать iOS сборки на сервер

Сервер обязательно должен быть с SSL

Необходимо загрузить файл сборки на сервер в какой-либо каталог и сохранить ссылку на этот файл. Пусть ссылка на сборку будет https://mysite.com/builds/my-app.ipa

Создать на сервере plist-файл с следующим содержанием

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
@jastkand
jastkand / capybara-cheetsheet.md
Created August 20, 2015 15:14
Capybara Cheetsheet

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')

@jastkand
jastkand / howto.md
Last active August 29, 2015 14:21
Upgrade PostgreSQL from 9.3 to 9.4

Upgrade steps were taken from this article.

sudo service postgresql stop 9.3

sudo service postgresql stop 9.4

sudo su - postgres

/usr/lib/postgresql/9.4/bin/pg_upgrade -b /usr/lib/postgresql/9.3/bin/ -B /usr/lib/postgresql/9.4/bin/ -d /var/lib/postgresql/9.3/main -D /var/lib/postgresql/9.4/main -o ' -c config_file=/etc/postgresql/9.3/main/postgresql.conf' -O ' -c config_file=/etc/postgresql/9.4/main/postgresql.conf'
sudo apt-get install tofrodos
fromdos file_path.file
@jastkand
jastkand / pdf2avi.rb
Created November 17, 2013 16:17
Script that allows to convert pdf file to avi using ffmpeg
require 'RMagick'
require 'fileutils'
def clean_temp(dir)
FileUtils.rm_rf(dir) if File.exists?(dir)
end
pdf = Magick::ImageList.new("input.pdf")
dir = './temp'

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name: