Skip to content

Instantly share code, notes, and snippets.

Avatar

Rostyslav Mykhajliw necromant2005

View GitHub Profile
@necromant2005
necromant2005 / run.sh
Created Feb 6, 2019
Include script content directly to docker container without directory mounting
View run.sh
#!/bin/bash
_CONTENT=$(echo $1 | base64 --decode)
_FILENAME=`echo $2 | base64 --decode`
_CMD=`echo $3 | base64 --decode`
echo $_CONTENT > $_FILENAME
echo `$_CMD`
View pool.php
<?php
require __DIR__ . '/vendor/autoload.php';
use React\EventLoop\Factory as EventLoopFactory;
use WyriHaximus\React\ChildProcess\Pool\Pool\Fixed as FixedPool;
use WyriHaximus\React\ChildProcess\Pool\ProcessCollection\ArrayList as ProcessCollectionArrayList;
use React\ChildProcess\Process;
$tasks = [];
View pool.php
<?php
require __DIR__ . '/vendor/autoload.php';
use React\EventLoop\Factory as EventLoopFactory;
use WyriHaximus\React\ChildProcess\Pool\Pool\Fixed as FixedPool;
use WyriHaximus\React\ChildProcess\Pool\ProcessCollection\ArrayList as ProcessCollectionArrayList;
use React\ChildProcess\Process;
$tasks = [];
View RequestAwareIntreface zf2 - zf3
<?php
namespace Layout\View\Helper\Initializer;
use Layout\View\Helper\LandingHandler;
use Test\Framework\Environment\Stub\Mvc\Controller\PluginManager;
use Test\Framework\Environment\Stub\ServiceManager\ServiceManager;
use Test\Framework\TestCase\TestCase;
use Zend\Http\PhpEnvironment\Request;
View zf2 (zf3) AbstractFactory
<?php
namespace Layout\ServiceManager\AbstractFactory;
use Interop\Container\ContainerInterface;
use Zend\ServiceManager\AbstractFactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
class Factory implements AbstractFactoryInterface
{
const INJECTIONS = 'injections';
const PARAMETERS = 'parameters';
/**
@necromant2005
necromant2005 / Phalcon-Zephir.md
Created Mar 17, 2016 — forked from denji/Phalcon-Zephir.md
Zephir write your PHP Extension
View Phalcon-Zephir.md

About this article will do the following things:

  • Install & Setup
  • Write a simple Router
  • Zephir rewritten version
  • Extension installation and testing

Installation

View async.php
<?php
// async php client
$request = '';
$request .= "GET / HTTP/1.1\r\n";
$request .= "Host: google.com\r\n";
$request .= "Connection: Close\r\n\r\n";
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_set_nonblock($socket);
@necromant2005
necromant2005 / bind-consul.sh
Created Oct 12, 2015 — forked from wfaler/bind-consul.sh
use consul as DNS for local services, fronted by Bind for the rest
View bind-consul.sh
sudo apt-get install bind9 bind9utils bind9-doc
wget https://dl.bintray.com/mitchellh/consul/0.5.2_linux_amd64.zip
/etc/bind/named.conf.options:
options {
directory "/var/cache/bind";
recursion yes;
allow-query { localhost; };
forwarders {
@necromant2005
necromant2005 / consul.service
Last active Oct 12, 2015 — forked from yunano/consul.service
/etc/systemd/system/consul.service
View consul.service
[Unit]
Description=consul agent
Requires=network-online.target
After=network-online.target
[Service]
EnvironmentFile=-/etc/sysconfig/consul
Environment=GOMAXPROCS=2
Restart=on-failure
ExecStart=/usr/local/sbin/consul agent $OPTIONS -config-dir=/etc/consul.d
View criticalcss-bookmarklet-devtool-snippet.js
(function() {
var CSSCriticalPath = function(w, d, opts) {
var opt = opts || {};
var css = {};
var pushCSS = function(r) {
if(!!css[r.selectorText] === false) css[r.selectorText] = {};
var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/);
for(var i = 0; i < styles.length; i++) {
if(!!styles[i] === false) continue;
var pair = styles[i].split(": ");