Skip to content

Instantly share code, notes, and snippets.

View JanSuchanek's full-sized avatar

Jan Suchánek JanSuchanek

View GitHub Profile
@JanSuchanek
JanSuchanek / cli-index.php
Created December 19, 2016 15:14
Run some app from terminal (Open Cart, Wp etc.)
<?php
class ServerRequest
{
private $request;
public function __construct($server)
{
$this->request = $server;
}
<?php defined('SYSPATH') or die('No direct script access.');
/**
* MySQL "Closure Table" for Kohana based on Bill Karwin design.
*
* @link http://www.slideshare.net/billkarwin/models-for-hierarchical-data
* @TODO improve
*
* sql schema:
* CREATE TABLE `closures` (
* `id` int(11) NOT NULL AUTO_INCREMENT,
<?php
/**
* This file is part of the Kdyby (http://www.kdyby.org)
*
* Copyright (c) 2008, 2012 Filip Procházka (filip@prochazka.su)
*
* For the full copyright and license information, please view the file license.txt that was distributed with this source code.
*/
<?php
namespace Model;
class Mapper extends \LeanMapper\DefaultMapper implements ITranslatingMapper
{
/**
* @return string
*/
@JanSuchanek
JanSuchanek / file.sql
Created February 25, 2014 22:06 — forked from emmanuel/file.sql
-- Retrieve descendants
-- ====================
-- retrieve descendants of #4
SELECT c.*
FROM Comments AS c
JOIN TreePaths AS t ON c.comment_id = t.descendant
WHERE t.ancestor = 4;
-- Retrieve ancestors
$.nette.ext('fileUpload', {
init: function(rh){
that = this;
$("form.fileUpload input[type=file]").on("change", this.onChangeFiles);
$("form.fileUpload").on("submit", this.onUploadSubmit);
},
before: function(jqXHR, settings){
var xhr = $.ajaxSettings.xhr();
xhr.upload.onprogress = function(e){
if(e.lengthComputable){
<?php
namespace Kedrigern\Price;
header('Content-Type: text/html; charset=utf-8');
class PriceEntity {
private $acceptable = array(
"CZK", "EUR", "USD"
<?php
namespace Kedrigern\Price;
header('Content-Type: text/html; charset=utf-8');
class PriceEntity {
private $acceptable = array(
"CZK", "EUR", "USD"