Skip to content

Instantly share code, notes, and snippets.

View avoronkin's full-sized avatar

Alexandr Voronkin avoronkin

  • Saint-Petersburg
View GitHub Profile
@avoronkin
avoronkin / lotto.js
Created September 19, 2019 20:52
lotto
function getTickets(){
var tickets = []
$('.bingo_ticket').each(function () {
var $ticket = $(this)
var numbers = []
$ticket.find('.numbers td').each(function () {
{
"Command": "PrintCheck",
"SignCalculation": "Сoming",
"Key": "BB720A776848",
"IP": "192.168.8.250",
"Port": "7777",
"Protocol": "TCP",
"MainData": [{
"Cashier": "TEST T.T"
}],
function waterfall (fns = []) {
return async (...args) => {
return fns.reduce((p, fn) => p.then(args => fn.apply(this, args)), Promise.resolve.call(this, args))
}
}
@avoronkin
avoronkin / nginx_requests_per_hour.sh
Last active December 5, 2017 05:05
nginx requests count
grep "05/Dec" /var/log/nginx/access.log | grep GET | cut -d[ -f2 | cut -d] -f1 | awk -F: '{print $2":00"}' | sort -n | uniq -c
@avoronkin
avoronkin / app_require.js
Created April 29, 2017 15:31
app_require
global.app_require = function(name) {
return require(__dirname + '/' + name);
}
var fs = require('fs'),
config = app_require('config'),
common = app_require('utils/common');
//http://www.antartica.cl/antartica/servlet/LibroServlet?action=searchLibros&busqueda=shirley
var host = 'http://www.antartica.cl';
var uri = '/antartica/servlet/LibroServlet?action=searchLibros&busqueda=';
var url = host + uri;
var cheerio = require('cheerio');
var utils = require('./utils');
var debug = require('debug')('bs:antartica.cl');
<?php
namespace Webmis\Controllers\Rls;
// use \Propel;
// use \PDO;
// use \BasePeer;
// use \Criteria;
use Silex\Application;
use Symfony\Component\HttpFoundation\Request;
// use Webmis\Models\DrugComponentQuery;
@avoronkin
avoronkin / gist:9637027
Created March 19, 2014 07:30
tail recursion with throw ...
function factorial(n) {
function recur(n, result) {
if (n == 0) {
throw result;
} else {
recur(n-1, result*n);
}
}
try {
recur(n, n);
@avoronkin
avoronkin / xml_import_trans
Created May 26, 2011 09:48
MODX Evolution xml import+transliteration
<?php
$parent = isset($parent) ? $parent : 0;//родительская папка
$published = isset($published) ? $published : 0;//публиковать?
$hidemenu = isset($hidemenu) ? $hidemenu : 0;//показывать в меню?
$template = isset($template) ? $template : 0;//ид нужного шаблона
//настройки транслитерации
if (!isset ($plugin_dir) ) { $plugin_dir = 'transalias'; }
if (!isset ($plugin_path) ) { $plugin_path = $modx->config['base_path'].'assets/plugins/'.$plugin_dir; }
if (!isset ($table_name)) { $table_name = 'russian'; }
@avoronkin
avoronkin / simple_tags
Created May 26, 2011 09:21
MODX Evolution simple tag list
<?php
//$landingID = 35;
$tb1 = $modx->getFullTableName("site_tmplvar_contentvalues");
$query = "SELECT value";
$query .= " FROM ".$tb1;
$query .= " WHERE tmplvarid=".$tvID;
$query .= " GROUP BY value";
$query .= " ORDER BY id DESC";
$query .= " LIMIT 50;";