An incoming mail processing microframework in Ruby: https://github.com/titanous/mailman
A Really Ruby Mail Library:
//****************************************************************************** | |
Функция ЭтоЦифра(стр, позиция=1) | |
Возврат ?(Найти("0123456789", Сред(стр, позиция, 1))>0, 1, 0); | |
КонецФункции | |
//****************************************************************************** | |
Функция EAN13A5CodeGenerate(ШК1) Экспорт | |
ШК=СокрЛП(Прав(ШК1, 5)); | |
Если СтрДлина(Шк)<>5 Тогда | |
Возврат ""; |
# $:.unshift(File.expand_path('./lib', ENV['rvm_path'])) # Для работы rvm | |
require 'rvm' | |
require 'rvm/capistrano' | |
require 'bundler/capistrano' | |
require 'puma/capistrano' | |
set :application, "myapp" | |
set :rails_env, "production" | |
ssh_options[:port] = 777 | |
set :port, 777 |
context default | |
#========================= | |
# Keywords | |
keyword whole arguments magenta | |
keyword whole break magenta | |
keyword whole caller magenta | |
keyword whole case magenta | |
keyword whole catch magenta | |
keyword whole constructor magenta |
# html highlighting with tags in caps always. if you want everything in lowercase | |
# use tr | |
# i got upto IMG in the netscape comprehensive tags reference. thereafter will get | |
# done later - paul | |
caseinsensitive | |
context default |
# iterate 0 to n | |
for e in [0..n] | |
console.log e | |
# iterate in array with element (itm) and index (i) | |
sort_weigth = (arr) -> | |
w = 0 | |
for itm, i in arr | |
w += (itm == 0 ? 0 : 1) * Math.pow(10, arr.length - i) |
SELECT `db_entity_id`,`role_type_id`,`rights_set`,`parent_id` | |
FROM `db_entity_role_rights` | |
LEFT JOIN `db_entities` | |
ON `db_entity_role_rights`.`db_entity_id`=`db_entities`.`id` |
f = (x) -> | |
y(x) | |
arr = arr.sort (a, b) -> | |
f(a) - f(b) |
#connect to redis database (place at config/initializers/redis.rb) | |
$redis = Redis.new(host: 'localhost', port: 6379, db: 1) | |
#read hash values from json file: | |
ru_json = File.read("ru-RU.json") | |
en_json = File.read("en.json") | |
cn_json = File.read("zh-CN.json") | |
ar_json = File.read("ar-EG.json") | |
#Set hash value in db: |
n=10 | |
(1..n).inject(:*) || 1 | |
## 1 ######### 2 #### 3 | |
#1. this is a enum object | |
#2. Do an operation (*) with accumulated result and next element - 1..3: res = 1 * 2 * 3 | |
#3. this is a foolprof - if an enum object is nil, result alway be the 1 |
An incoming mail processing microframework in Ruby: https://github.com/titanous/mailman
A Really Ruby Mail Library: