Skip to content

Instantly share code, notes, and snippets.

Prisacari Dmitrii icamys

View GitHub Profile
View .jshintrc
{
// JSHint Default Configuration File (as on JSHint website)
// See http://jshint.com/docs/ for more details
// File is modified by icamys
"maxerr" : 2, // {int} Maximum error before stopping
// Enforcing
"bitwise" : false, // true: Prohibit bitwise operators (&, |, ^, etc.)
"camelcase" : false, // true: Identifiers must be in camelCase
View .jscsrc
{
"requireCurlyBraces": [
"if",
"else",
"for",
"while",
"do",
"try",
"catch"
],
@icamys
icamys / nginx_tarantool_lua.Dockerfile
Last active Jul 6, 2017
Dockerfile: nginx + tarantool upstream module + nginx Lua module (Luajit)
View nginx_tarantool_lua.Dockerfile
# Image includes:
# - nginx
# - nginx_upstream_module (for tarantool)
# - nginx_lua_module (required by luajit)
# - nginx_devel_kit (required by luajit)
# - luajit
# - luarocks
# - lua rock "lua-cjson" (is necessary to work with tarantool response, can be extended with env variable)
FROM alpine:3.4
@icamys
icamys / tarantool_devtools.lua
Last active Aug 10, 2017
Tarantool devtools
View tarantool_devtools.lua
----------------------
-- Development tools
local fiber = require('fiber')
local source_update_fiber_name = 'source_update_fiber'
local M = {}
function string.starts(String,Start)
return string.sub(String,1,string.len(Start))==Start
View gist:a44e681da232105ec8b8e2175c80f4c3
import json
with open('output-test.json') as data_file:
input_records = json.load(data_file)
command = 'INSERT INTO dle_post_video (player_id, post_id, code) VALUES ({values})'
player_snippet = '<iframe src="{url}" width="667" height="370" frameborder="0" allowfullscreen></iframe>'
bulk = []
max_bulk_size = 20
@icamys
icamys / recursive-staircase.go
Created Jan 2, 2018
recursive-staircase solution
View recursive-staircase.go
package main
import (
"fmt"
"bufio"
"os"
"strings"
"strconv"
)
View wp_rest_create_post.sh
# 1. Install this plugin in wordpress:
# https://github.com/WP-API/Basic-Auth
# 2. Create wordpress user with username 'admin' and password 'admin'
# 3. Download an image and save it as 'google.jpg'
# 4. Upload image to wordpress REST API
curl \
-H "cache-control: no-cache" \
@icamys
icamys / DuskServeCommand.php
Created Apr 12, 2018
Serve the laravel application and run Dusk tests
View DuskServeCommand.php
<?php
namespace App\Console\Commands;
use RuntimeException;
use Laravel\Dusk\Console\DuskCommand;
use Symfony\Component\Process\Process;
class DuskServeCommand extends DuskCommand
{
@icamys
icamys / DuskTestCase::captureFailureFor.php
Created Jun 7, 2018
Laravel Dusk: method that makes full-size screenshot in Chrome browser of failed tests
View DuskTestCase::captureFailureFor.php
protected function captureFailuresFor($browsers)
{
$browsers->each(function (Browser $browser, $key) {
$body = $browser->driver->findElement(WebDriverBy::tagName('body'));
if (!empty($body)) {
$currentSize = $body->getSize();
$size = new WebDriverDimension($currentSize->getWidth(), $currentSize->getHeight());
$browser->driver->manage()->window()->setSize($size);
}
$browser->screenshot('failure-'.$this->getName().'-'.$key);
@icamys
icamys / reverse_bin.py
Last active Jul 16, 2018
Reverse integer in binary form
View reverse_bin.py
import sys
def leading_zeros(x: int):
n = 32
y = x >> 16
if y != 0:
n = n - 16
x = y
You can’t perform that action at this time.