Skip to content

Instantly share code, notes, and snippets.

Avatar

Alexandr Voronkin avoronkin

  • Saint-Petersburg
View GitHub Profile
View lotto.js
function getTickets(){
var tickets = []
$('.bingo_ticket').each(function () {
var $ticket = $(this)
var numbers = []
$ticket.find('.numbers td').each(function () {
View kkt.json
{
"Command": "PrintCheck",
"SignCalculation": "Сoming",
"Key": "BB720A776848",
"IP": "192.168.8.250",
"Port": "7777",
"Protocol": "TCP",
"MainData": [{
"Cashier": "TEST T.T"
}],
View waterfall.js
function waterfall (fns = []) {
return async (...args) => {
return fns.reduce((p, fn) => p.then(args => fn.apply(this, args)), Promise.resolve.call(this, args))
}
}
View nginx_requests_per_hour.sh
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
View app_require.js
global.app_require = function(name) {
return require(__dirname + '/' + name);
}
var fs = require('fs'),
config = app_require('config'),
common = app_require('utils/common');
View pilotTest.js
//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');
View RlsController.php
<?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 Mar 19, 2014
tail recursion with throw ...
View gist:9637027
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
MODX Evolution xml import+transliteration
View xml_import_trans
<?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
MODX Evolution simple tag list
View simple_tags
<?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;";
You can’t perform that action at this time.