This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env rackup -Ilib:../lib -s thin | |
# async message handling | |
# using gem https://github.com/raggi/async_sinatra | |
require 'sinatra/async' | |
require "em-http-request" | |
require 'open-uri' | |
require "em-synchrony" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'test/unit' | |
require 'rack/test' | |
require 'sinatra/async' | |
class MyAppTest < Test::Unit::TestCase | |
include Rack::Test::Methods | |
def app | |
Sinatra::Application | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%h1 Импорт перевода | |
.tabbable | |
- [email protected]_values.group_by(&:language_id) | |
%ul#myTab.nav.nav-tabs | |
- t="active" | |
- data.each do |language_id, values| | |
%li{class:"#{t}"} | |
- t='' | |
%a{href:"#lang_#{language_id}", "data-toggle"=>:tab}= language_id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module TranslationProcessor | |
extend ActiveSupport::Concern | |
ALLOWED_FILES = ['common', "city", "energy", "farm", "market", "poker_common", "poker_mobile", "poker_flash"] | |
KEY_DOWNLOAD_AT = "__downloaded_at_do_not_edit__" | |
def parse_yml | |
if denied_name? | |
e = "#{path} was not allowed. allowed files should start with #{ALLOWED_FILES.join(",")}" | |
raise CarrierWave::ProcessingError, I18n.translate(:"errors.messages.translation_yml_processing_error", :e => e) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TranslationStructure | |
attr_accessible :filename, :username, :comment | |
@filename | |
@languages | |
def initialize(filename, username, comment='') | |
@filename=filename | |
@username=username | |
@comment=comment | |
@languages={} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This is the model class for table "{{user}}". | |
* The followings are the available columns in table '{{user}}': | |
* @property integer $id | |
* @property string $login | |
* @property string $pass | |
* @property string $name | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.expand_path(File.join(File.dirname(__FILE__),'..', 'config', 'environment')) | |
require 'evma_httpserver' | |
class HttpServer < EventMachine::Connection | |
include EventMachine::HttpServer | |
def process_http_request | |
@content = Rack::Utils.parse_query(@http_post_content) | |
#or СGI.parse | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//protected/config/main.php | |
return array( | |
//.. | |
'components'=>array( | |
//... | |
"clientScript"=>array( | |
"class"=>"myClientScript", | |
), | |
//.. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SftpUploader | |
def upload!(local_filename, remote_filename) | |
raise "#{local_filename} not readable" unless File.exist?(local_filename) | |
connect do |sftp| | |
dirs = File.dirname(remote_filename).split('/') | |
dir_to_create = credentials.path | |
dirs.each do |dir| | |
dir_to_create = File.join(dir_to_create, dir) | |
sftp.mkdir(dir_to_create) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#для работы этого кода нужно установить гем 'savon' | |
#для этого выполните: gem install savon | |
#или пропишите в Gemfile: gem 'savon' | |
class TurboSMS | |
LOGIN = '...' # не забудьте активировать SOAP шлюз в личном кабинете и создать логин/пароль | |
PASSWORD = '...' | |
SENDER = 'MySite' #не забудьте добавить эту подпись в личном кабинете | |
def get_balance |
OlderNewer