Skip to content

Instantly share code, notes, and snippets.

@fc-arny
fc-arny / jquery.plugin.base.coffee
Last active December 23, 2015 09:39
Abstract class for jquery plugin
$ = jQuery
# An abstract class that provide jQuery plugin setup functionalities.
class window.PluginBase
# Redefine this dictionary to specify default options
@defaultOptions: {}
# The default constructor calls the initialize method and set the jQuery element.
# Remember to call super in subclasses if you want to maintain this behaviour.
@fc-arny
fc-arny / alert.scss
Created October 31, 2013 23:10
jQuery plugin for showing flash messages Styles for alert took from 'Twitter Bootstrap' PluginBase stay here - https://gist.github.com/fc-arny/6616088
.alert {
padding: 10px;
left: 50%;
margin-left: -300px;
padding-right: 35px;
position: fixed;
top: 10px;
width: 600px;
z-index: 9999;
border: 1px solid transparent;
@fc-arny
fc-arny / data.rake
Created December 20, 2013 15:20
Rake task for Importing cities, countries, airports, airlines
namespace :data do
namespace :import do
task :cities do
country_codes = Hash[Country.all.map {|c| [c.iata_code, c.id]}]
import_csv_to 'cities' do |row|
country_code, city_name, city_name_en, city_lat, city_long = [*row]
country_id = country_codes[country_code] || nil
if city_name
# An experiment for a capistrano 'stage' that can actually be used to
# deploy multiple feature branches at once.
# Intended to be installed config/deploy/feature_demo , when using cap
# multi-stage support: add 'feature_demo' to 'stages' in `config/deploy.rb` too.
# Run from a git feature branch `cap feature_demo deploy` to deploy to
# single machine we have all our feature demos on.
# Name of feature branch will be taken from current git checkout.
require File.join(File.dirname(__FILE__), 'deploy/nginx')
require File.join(File.dirname(__FILE__), 'deploy/log')
default_run_options[:pty] = true
set :ssh_options, { :forward_agent => true }
set :application, "appname"
set :repository, "git@giturl"
set :scm, :git
@fc-arny
fc-arny / retryable_typhoeus.rb
Last active September 4, 2015 00:19 — forked from kunalmodi/retryable_typhoeus.rb
Retry Typhoeus
module RetryableTyphoeus
require 'typhoeus'
include Typhoeus
DEFAULT_RETRIES = 1
class Request < Typhoeus::Request
def original_on_complete=(proc)
@original_on_complete = proc
@fc-arny
fc-arny / gist:4bf6c9368997ba83eb3e
Created October 30, 2015 14:52 — forked from JakubOboza/gist:2008958
faye as subdomain
upstream faye {
server 127.0.0.1:9292;
}
upstream webrick{
server 127.0.0.1:3000;
}
server {
listen 80 default;
@fc-arny
fc-arny / gist:5e1a12b83f11f3673ebd
Created December 17, 2015 16:28 — forked from jessedearing/gist:2351836
Create self-signed SSL certificate for Nginx
#!/bin/bash
echo "Generating an SSL private key to sign your certificate..."
openssl genrsa -des3 -out myssl.key 1024
echo "Generating a Certificate Signing Request..."
openssl req -new -key myssl.key -out myssl.csr
echo "Removing passphrase from key (for nginx)..."
cp myssl.key myssl.key.org
openssl rsa -in myssl.key.org -out myssl.key
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Pony Test</title>
</head>
<body>
<h1>Задание:</h1>
<ul>
<li>Необходимо сделать фильтр товаров для магазина игрушечных пони</li>