Skip to content

Instantly share code, notes, and snippets.

@aminin
aminin / subtree-split.sh
Last active March 16, 2018 16:00
Split project with multiple composer packages into subtrees
#!/usr/bin/env bash
# Search composer packages in SRC_PATH
# and split them into subtrees
#
# examples:
# bash subtree-split.sh
# SRC_PATH=bundles bash subtree-split.sh
#
# see:
@aminin
aminin / icu-install.sh
Last active October 11, 2019 15:57
Install ICU from source and build php-intl with the specific version of ICU
#!/usr/bin/env bash
if [[ -x $(which php) ]]; then
PHP_ICU_VERSION=$(php -r 'echo defined("INTL_ICU_VERSION") ? INTL_ICU_VERSION : "none";')
echo "PHP ICU version: $PHP_ICU_VERSION"
else
echo 'WARNING: PHP not installed'
PHP_ICU_VERSION=none
fi
@aminin
aminin / life.html
Last active July 8, 2016 22:44
LifeJS
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script src="life.js"></script>
</body>
</html>
@aminin
aminin / plumbing.html
Created October 27, 2015 20:06
Технические работы
<html>
<head>
<title>Технические работы</title>
<meta charset='utf-8' />
<style type="text/css">
html, body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
sudo apt-get remove scala-library scala
sudo wget www.scala-lang.org/files/archive/scala-2.11.7.deb
sudo dpkg -i scala-2.11.7.deb
sudo apt-get update
sudo apt-get install scala
wget http://scalasbt.artifactoryonline.com/scalasbt/sbt-native-packages/org/scala-sbt/sbt/0.13.1/sbt.deb
sudo dpkg -i sbt.deb
sudo apt-get update
sudo apt-get install sbt
@aminin
aminin / merge-annotations.php
Last active August 29, 2015 14:22
Merge orm annotations to existing classes
<?php
// Run after $ php app/console doctrine:mapping:convert annotation
$propertyRegExp = '~( \/\*\*[^/]+?\*\/)\s+(?:private)|(?:protected) \$(\w+)\;~';
$classRegExp = '~(\/\*\*[\s\S]+?\*\/)\s+(class \w+)~';
$to = '';
$from = '';
@aminin
aminin / run-symfony-with-xdebug.md
Last active May 4, 2019 15:33
Run symfony application with xdebug

PHP and IDE configuration

Assume we already configured xdebug (otherwise use google).

Symfony 2.x

Shell command

This code is very similar to the command executed internally by php app/console server:run.

@aminin
aminin / .gitignore
Last active August 29, 2015 14:10
satis repo
satis/
web/
composer.phar
@aminin
aminin / SeleniumServer.php
Created March 27, 2014 21:44
PhpUnit + Selenium WebDriver
<?php
class SeleniumServer
{
private $downloadUrl = 'http://selenium-release.storage.googleapis.com/2.40/selenium-server-standalone-2.40.0.jar';
private $jarLocation;
private $process;
public function __constuct($location = null, $downloadUrl = null)
{