Skip to content

Instantly share code, notes, and snippets.

// curl -k https://localhost:8000/
var https = require('https');
var fs = require('fs');
var options = {
key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')
};
https.createServer(options, function (req, res) {
@AoJ
AoJ / gist:962972
Created May 9, 2011 17:51 — forked from Mikulas/gist:955777
Logger
<?php
require "./Breto/libs/nette/loader.php";
class CustomDump
{
static public $file;
static function setFile($file) {
self::$file = $file;
@AoJ
AoJ / BaseModel.php
Created May 22, 2011 09:05 — forked from fprochazka/BaseModel.php
Psáno na aktuální Nette (master - 50c3c40)
<?php
abstract class BaseModel extends Nette\Object
{
/** @var NotORM */
protected $connection;
/**
@AoJ
AoJ / App-FileJournal.php
Created August 6, 2011 16:41
Nette permanent repository
<?php
// FileJournal for the permanent repository
// Copy contents of the "FileJournal.php" class, and do the changes mentioned bellow.
// FileJournal pro permanentní repozitář.
// Zkopírujte obsah souboru "FileJournal.php" a proveďte níže uvedené změny
namespace App;
class FileJournal {
@AoJ
AoJ / gist:1129502
Created August 6, 2011 16:43
Having fun with foreach cycles in PHP
Foreach always creates a working copy of the array, which results in double memory usage.
Here are some fun things along with one WTF thingie at the end.
We discovered these in WDF (www.wdf.cz) during today's afternoon.
Outline
-------------
<?php
$array = array(1, 2, 3, 4, 5);
foreach($array as $key => $value) {
unset($value);
@AoJ
AoJ / makeScrollable.js
Created September 11, 2011 18:22 — forked from paranoiq/makeScrollable.js
Scrollable table body
/**
* Make table body scrollable, with the table header always visible.
* If no min/max-height is given, table shrinks to fit the browser viewport.
*
* requirements:
* - jQuery framework required (tested with 1.6.2)
* - header must be wrapped in <thead> element
*
* warnings:
* - table <caption> is not supported
@AoJ
AoJ / LICENSE.txt
Created September 20, 2011 20:06 — forked from addyosmani/LICENSE.txt
140byt.es -- objectClone
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@AoJ
AoJ / BaseModel.php
Created October 20, 2011 20:23 — forked from fprochazka/BaseModel.php
Psáno na aktuální Nette (master - 50c3c40)
<?php
abstract class BaseModel extends Nette\Object
{
/** @var NotORM */
protected $connection;
/**
@AoJ
AoJ / example.php
Created October 30, 2011 21:52
class instance factory
<?php
$new_ = new new_;
echo $new_::Test('I', 'live', '!')->get();
echo $new_::NonExistsClass('I', "don't", 'live', '!')->get();
echo (string)$new_::NonExistsClass('I', "don't", 'live', '!');
$class = $new_::NonExistsClass('I', "don't", 'live', '!');
$class::test();
$class();
<?php
/**
* SplClassLoader implementation that implements the technical interoperability
* standards for PHP 5.3 namespaces and class names.
*
* http://groups.google.com/group/php-standards/web/final-proposal
*
* // Example which loads classes for the Doctrine Common package in the
* // Doctrine\Common namespace.