Skip to content

Instantly share code, notes, and snippets.

View crmaxx's full-sized avatar

Maxim Zhukov crmaxx

  • Russia, Vladimir
View GitHub Profile
@crmaxx
crmaxx / gist:4347813
Last active December 9, 2015 23:59 — forked from Amitesh/gist:1160428
paperclip-file-rename
#http://blog.wyeworks.com/2009/7/13/paperclip-file-rename
Paperclip.interpolates :default_image_type do |attachment, style|
attachment.instance.get_user_default_profile_image
end
Paperclip.interpolates :normalized_avatar_file_name do |attachment, style|
attachment.instance.normalized_avatar_file_name
end
@crmaxx
crmaxx / 0-readme.md
Last active September 29, 2016 08:25 — forked from alanstevens/install-rvm.sh
Amazon AWS EC2 production for Ruby on Rails

Amazon AWS EC2 production for Ruby on Rails

Prepare cloud

Speed up ssh login

echo 'UseDNS no # if slow connection' >> /etc/ssh/sshd_config
echo 'PrintMotd yes # if you need motd messages' >> /etc/ssh/sshd_config

From /etc/pam.d/login && /etc/pam.d/sshd delete all strings included

session optional pam_motd.so
# Support for Rspec / Capybara subdomain integration testing
# Make sure this file is required by spec_helper.rb
#
# Sample subdomain test:
# it "should test subdomain" do
# switch_to_subdomain("mysubdomain")
# visit root_path
# end
DEFAULT_HOST = "lvh.me"
# install and make run basic bootstrap date-picker functionality described here http://www.eyecon.ro/bootstrap-datepicker/
# app/assets/javascript/datepicker.js.coffee
$(document).on 'pageChanged', ->
# datepicker for simple_form & Ransack
$(".custom_datepicker_selector").datepicker().on 'changeDate', (en) ->
correct_format = en.date.getFullYear() + '-' + ('0' + (en.date.getMonth() + 1)).slice(-2) + '-' + ('0' + en.date.getDate()).slice(-2) # date format yyyy-mm-dd
$(this).parent().find("input[type=hidden]").val(correct_format)

Apple Push Notification Service and Rails 3.0

Key Points

  • Push notifications were introduced in iOS 3.0 and in OS X version 10.7.
  • APNs has a feedback service that maintains a per-application list of devices for which there were failed-delivery attempts. The provider should connect with the feedback service to see what devices have persistent failures to refrain from sending push notifications to them.
  • A notification is a short message consisting of two major pieces of data: the device token and the payload

Provider Responsibilities

source :rubygems
gem 'raad'
gem 'puma'
gem 'sinatra'

#Суть задания Необходимо реализовать отдельным приложением парсер данных о чартерных рейсах с сайтов туроператоров, на ваш выбор:

  1. Лабиринт - http://online.labirint.travel/freight_monitor (Греция; город прибытия - KOS)
  2. NEC Travel - http://online.nectravel.ru/freight_monitor (Турция; город прибытия - ISTANBUL)

Парсеры данных именно этих операторов давно и успешно реализованы нами и такая задача считается тривиальной.

####Объяснение что и откуда можно брать в итоговой таблице туроператора: Пояснения в таблице

%% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*-
%% ex: ts=4 sw=4 et
%% @author Kevin Smith <kevin@opscode.com>
%% @copyright 2011 Opscode, Inc.
-module(example).
-behaviour(gen_server).
-export([start_link/0]).
#!/usr/bin/env bash
echo -e "\033[32m => Updating reps info.." && tput sgr0
apt-get -y update
echo -e "\033[32m => Installing depends.." && tput sgr0
apt-get -y install build-essential tklib zlib1g-dev libssl-dev libreadline-gplv2-dev libxml2 libxml2-dev libxslt1-dev libyaml-dev libffi-dev libgdbm-dev
echo -e "\033[32m => Upgrading dist.." && tput sgr0
apt-get -y upgrade
cd /tmp
echo -e "\033[32m => Installing ruby-1.9.3-p392.." && tput sgr0
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p392.tar.bz2
@crmaxx
crmaxx / pyzabora.py
Last active December 16, 2015 22:29 — forked from superdaigo/zabbix-alert-smtp.sh
Zabbix Alert Scripts
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import cx_Oracle
USER='USER'
PASSWORD='PASSWORD'
SID='SID'