This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
abstract class AbstractWindow | |
{ | |
protected $_title; | |
public function __construct($title = null) | |
{ | |
$this->_title = $title; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Psr\Log\LogLevel; | |
class PsrLogAdapter extends \Psr\Log\AbstractLogger | |
{ | |
private $_levelMap = array( | |
LogLevel::EMERGENCY => CLogger::LEVEL_ERROR, | |
LogLevel::ALERT => CLogger::LEVEL_ERROR, | |
LogLevel::CRITICAL => CLogger::LEVEL_ERROR, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" ?> | |
<schema name="symfony" version="1.0"> | |
<uniqueKey>id</uniqueKey> | |
<fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/> | |
<fieldType name="string" class="solr.StrField" sortMissingLast="true" /> | |
<field name="_version_" type="long" indexed="true" stored="true"/> | |
<field name="_root_" type="string" indexed="true" stored="false"/> | |
<field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function dropDirectory($path) { | |
// drop included files and directories | |
foreach(new \DirectoryIterator($path) as $file) { | |
if($file->isDot()) { | |
continue; | |
} | |
// drop dir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function array_rand_weight(array $array) | |
{ | |
reset($array); | |
$pointer = mt_rand(0, array_sum($array)); | |
if(!$pointer) { | |
return key($array); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// new lines | |
// echo "\033[{$line};{$column}H"; | |
// \r - goto start of line | |
$foregroundColors = array( | |
'white' => '1;37', | |
'black' => '0;30', | |
'dark_gray' => '1;30', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Compile and execute: | |
* g++ pointer.c -o pointer && ./pointer | |
*/ | |
#include <iostream> | |
#include <typeinfo> | |
using namespace std; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CCList=( | |
"GBR:GB" | |
"USA:US" | |
"CAN:CA" | |
"NLD:NL" | |
"NZL:NZ" | |
"ZAF:ZA" | |
"IRL:IE" | |
"CZE:CZ" | |
"AUS:AU" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
// create server | |
var server = http.createServer(); | |
// dispatch requests | |
server.on('request', function(request, response) { | |
response.writeHead(200, 'OK'); | |
response.write('Requested ' + request.url); | |
response.end(); |