Skip to content

Instantly share code, notes, and snippets.

View manzhikov's full-sized avatar
🏠
Working from home

Ildar Manzhikov manzhikov

🏠
Working from home
View GitHub Profile
# As used with CanCan and Devise
class ApplicationController < ActionController::Base
protect_from_forgery
include ErrorResponseActions
rescue_from CanCan::AccessDenied, :with => :authorization_error
rescue_from ActiveRecord::RecordNotFound, :with => :resource_not_found
before_filter :authenticate!
@manzhikov
manzhikov / digital_ocean_setup.md
Created April 30, 2016 00:11 — forked from ChuckJHardy/digital_ocean_setup.md
DigitalOcean Ubuntu 14.04 x64 + Rails 4 + Nginx + Unicorn + PostgreSQL + Capistrano 3 Setup Instructions

DigitalOcean Ubuntu 14.04 x64 + Rails 4 + Nginx + Unicorn + PostgreSQL + Capistrano 3

SSH into Root

$ ssh root@123.123.123.123

Change Root Password

@manzhikov
manzhikov / install-comodo-ssl-cert-for-nginx.rst
Created June 30, 2016 20:33 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@manzhikov
manzhikov / encoding-video.md
Created June 6, 2017 12:03 — forked from Vestride/encoding-video.md
Encoding video for the web

Encoding Video

Installing

Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aacc --with-opus
@manzhikov
manzhikov / nginx-tls.conf
Created July 26, 2017 03:13 — forked from gavinhungry/nginx-tls.conf
Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
#
# Name: nginx-tls.conf
# Auth: Gavin Lloyd <gavinhungry@gmail.com>
# Desc: Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
#
# Enables SPDY, PFS, HSTS and OCSP stapling. Configuration options not related
# to SSL/TLS are omitted here.
#
# Example: https://www.ssllabs.com/ssltest/analyze.html?d=gavinhungry.io
#
@manzhikov
manzhikov / snail.rb
Created August 19, 2017 21:42 — forked from dliberalesso/snail.rb
Sort an array of arrays like a snail (clockwise spiral sorting) with Ruby.
def snail(array)
result = Array.new
n = array.length
runs = n.downto(0).each_cons(2).to_a.flatten
delta = [[1,0], [0,1], [-1,0], [0,-1]].cycle
x, y = -1, 0
for run in runs
dx,dy = delta.next
run.times do |i|
x += dx
@manzhikov
manzhikov / shapefileConversion.md
Created November 29, 2017 18:49 — forked from YKCzoli/shapefileConversion.md
Step through of converting shapefile to geojson with qgis.

Converting shapefiles to geojson

####Assumptions

Get the data

We will use the Electoral District and Polling Division shapefiles found on the Elections Ontario site:

@manzhikov
manzhikov / bitbucket-pipelines.yml
Created March 2, 2019 17:50 — forked from tstrohmeier/bitbucket-pipelines.yml
AWS ECS: Script for creating a new revision of a task definition and update a service
# enable Docker for your repository
options:
docker: true
pipelines:
branches:
development:
- step:
# python image with aws-cli installed
@manzhikov
manzhikov / capybara_fill_stripe_elements.rb
Last active August 26, 2019 21:55 — forked from iloveitaly/capybara_fill_stripe_elements.rb
Fill in a Stripe Elements (https://stripe.com/docs/elements) credit card field using capybara
def fill_stripe_elements(card: '4242424242424242', expiry: '1234', cvc: '123', postal: '12345')
using_wait_time(10) {
frame = find('#card-element > div > iframe')
within_frame(frame) do
card.to_s.chars.each do |piece|
find_field('cardnumber').send_keys(piece)
end
find_field('exp-date').send_keys expiry
find_field('cvc').send_keys cvc
@manzhikov
manzhikov / Capybara.md
Created March 16, 2020 13:30 — forked from tomas-stefano/Capybara.md
Capybara cheatsheet

Capybara Actions

# Anchor
click_link 'Save'

# Button
click_button 'awesome'

# Both above