Skip to content

Instantly share code, notes, and snippets.

@kzykhys
kzykhys / swap.php
Created January 21, 2013 11:04
Swap values of two variables
<?php
$x = 1;
$y = 2;
list($x, $y) = array($y, $x);
var_dump($x, $y);
@kzykhys
kzykhys / flip.php
Last active December 11, 2015 10:18
Flip variable between 0 and 1
<?php
$i = 0;
$i = ($i - 1) * -1;
var_dump($i);
@kzykhys
kzykhys / printWord.js
Last active August 4, 2022 02:51
Print MS Word in Node.js
/*
* Print Word document on Windows
*
* 1. Get the Word executable path
* > ftype Word.Document.8
* 2. Print silently
* > %WORD% /q /n /mfileprintdefault /mfileexit %FILE%
*/
var child_process = require('child_process');
@kzykhys
kzykhys / Install_PHP_Nginx_Command.md
Last active December 21, 2015 13:59
Nginx + PHP Example (Ubuntu 12.04 + PHP5.5.3 + Nginx1.5.3)

1 line command to install latest PHP and Nginx.

Prerequisites

  • Fresh installed Ubuntu 12.04
  • cURL installed: sudo apt-get install curl

Install

@kzykhys
kzykhys / phpunit.xml.dist
Created August 26, 2013 00:47
General PHPUnit configuration for my projects. (Original file from Symfony2)
<?xml version="1.0" encoding="UTF-8"?>
<!-- http://www.phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit
backupGlobals = "false"
backupStaticAttributes = "false"
colors = "true"
convertErrorsToExceptions = "true"
convertNoticesToExceptions = "true"
convertWarningsToExceptions = "true"
@kzykhys
kzykhys / .travis.yml
Created September 3, 2013 09:38
General Travis CI configuration for my PHP projects
language: php
php:
- 5.5
- 5.4
before_script:
- curl -s http://getcomposer.org/installer | php
- php composer.phar install --dev --no-interaction
- php composer.phar require satooshi/php-coveralls:dev-master
@kzykhys
kzykhys / ciconia-gfm-diagnose.txt
Created November 13, 2013 03:53
All triggered events on Ciconia
$ bin/ciconia --gfm --diagnose --verbose README.md
+------------+----------------------------------------------------------+----------+-----------+
| Event | Callback | Duration | MEM Usage |
+------------+----------------------------------------------------------+----------+-----------+
| | render() | - | - |
| initialize | Core\WhitespaceExtension:initialize | 1 | 2621440 |
| detab | Core\WhitespaceExtension:detab | 0 | 2621440 |
| initialize | Gfm\FencedCodeBlockExtension:processFencedCodeBlock | 4 | 2621440 |
| detab | Core\WhitespaceExtension:detab | 0 | 2621440 |
| detab | Core\WhitespaceExtension:detab | 0 | 2621440 |
@kzykhys
kzykhys / core-blockquotes1.html.txt
Last active December 29, 2015 23:58
Markdown cheatsheet for kzykhys/Ciconia
<blockquote>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Nulla neque nisl, fringilla sed blandit non, pretium eu odio.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Nulla neque nisl, fringilla sed blandit non, pretium eu odio.</p>
</blockquote>