Skip to content

Instantly share code, notes, and snippets.

Nikolaos Dimopoulos niden

Block or report user

Report or block niden

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@niden
niden / php_evaluation_order.md
Created Apr 15, 2019 — forked from nikic/php_evaluation_order.md
Analysis of some weird evaluation order in PHP
View php_evaluation_order.md

Order of evaluation in PHP

Yesterday I found some people on my [favorite reddit][lolphp] wonder about the output of the following code:

<?php

$a = 1;
$c = $a + $a++;
View .htaccess
AddDefaultCharset UTF-8
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)\.(\d+)\.(bmp|css|cur|gif|ico|jpe?g|js|png|svgz?|webp|webmanifest)$ $1.$3 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^((?s).*)$ index.php?_url=/$1 [QSA,L]
@niden
niden / makephalcon.bat
Created Mar 30, 2017
Build scripts 7.0
View makephalcon.bat
@set version=%1
@set zip_exe="c:\program files\7-zip\7z.exe"
@set cphalcon=E:\Work\phalcon\cphalcon\build\php7\32bits
@set version70=7.0.5
cd \
@echo -------------------------------------------------
@echo Deleting old files
@echo -------------------------------------------------
@niden
niden / commit-msg
Last active Jan 29, 2017
Git hooks
View commit-msg
#!/bin/bash
# This way you can customize which branches should be skipped when
# prepending commit message.
if [ -z "$BRANCHES_TO_SKIP" ]; then
BRANCHES_TO_SKIP=(master develop test)
fi
BRANCH_NAME=$(git symbolic-ref --short HEAD)
BRANCH_NAME="${BRANCH_NAME##*/}"
BRANCH_EXCLUDED=$(printf "%s\n" "${BRANCHES_TO_SKIP[@]}" | grep -c "^$BRANCH_NAME$")
BRANCH_IN_COMMIT=$(grep -c "\[$BRANCH_NAME\]" $1)
@niden
niden / send.php
Last active Jan 21, 2016
Send file
View send.php
// Send it out to the client
$response = new PhResponse();
$response
->setContentType('application/pdf')
->setHeader('Content-Description', 'File Transfer')
->setHeader('Content-Disposition', sprintf('attachment; filename=%s.pdf', $filename))
->setHeader('Content-Transfer-Encoding', 'binary')
->setHeader('Connection', 'Keep-Alive')
->setHeader('Expires', 0)
->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0')
View Linux Static IP
## Configure eth0
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static
View CIDR.php
<?php
/**
* CIDR.php
*
* Utility Functions for IPv4 ip addresses.
* Supports PHP 5.3+ (32 & 64 bit)
* @author Jonavon Wilcox <jowilcox@vt.edu>
* @revision Carlos Guimarães <cvsguimaraes@gmail.com>
* @version Wed Mar 12 13:00:00 EDT 2014
*/
@niden
niden / keybase.md
Last active Oct 20, 2018
keybase.md
View keybase.md

Keybase proof

I hereby claim:

  • I am niden on github.
  • I am niden_net (https://keybase.io/niden_net) on keybase.
  • I have a public key ASDJ0qujHbHFnf2WFjcFH90ibJjMHHsRkgN18z8FuWQA4Ao

To claim this, I am signing this object:

View PhalconPHPFaceBook.php
composer.json
-------------
{
"require": {
"facebook/php-sdk" : "*"
}
}
Phalcon Bootstrap index.php
View Bootstrap.php
<?php
/**
* \NDN\Api\Bootstrap
* Bootstrap.php
*
* Bootstraps the API application
*
* @author Nikos Dimopoulos <nikos@niden.net>
* @since 2012-12-03
* @category Library
You can’t perform that action at this time.