Skip to content

Instantly share code, notes, and snippets.

View vojtasvoboda's full-sized avatar
🏠
Working from home

Vojta Svoboda vojtasvoboda

🏠
Working from home
View GitHub Profile
<?php
class HomepagePresenter extends BasePresenter
{
/** @var EntriesModel */
protected $entriesModel;
/**
* Lazy getter for EntriesModel
* @return EntriesModel
@vojtasvoboda
vojtasvoboda / gist:66a47b7fa355ce37cdba
Created September 16, 2014 11:18
Check character
http://www.foo.bar/search?utf8=✓&query=test
@vojtasvoboda
vojtasvoboda / gist:4242adfe1d21130b164d
Created September 16, 2014 11:20
MySQL Foreign key checks off
SET foreign_key_checks = 0;
TRUNCATE database_table;
DROP database_table;
SET foreign_key_checks = 1;
@vojtasvoboda
vojtasvoboda / gist:03ce4c3496d5dc0d982f
Created September 16, 2014 11:22
MySQL Create database and user
; user_name can be same like database_name
CREATE DATABASE `database_name`;
CREATE USER 'user_name'@'%';
GRANT ALL PRIVILEGES ON `user_name`.* TO 'database_name'@‘%';
SET PASSWORD FOR 'user_name'@'%' = PASSWORD('user_password');
<?php
/**#@+ Timeline {@link Twitter::load()} */
const ME = 1;
const ME_AND_FRIENDS = 2;
const REPLIES = 3;
const ALL = 4;
/**#@-*/
/**#@+ Output format {@link Twitter::load()} */
@vojtasvoboda
vojtasvoboda / Plugin.php
Last active October 15, 2018 16:55
RainLab.Blog editor type change
<?php namespace Acme\Site;
use Event;
use Illuminate\Support\Facades\App;
use System\Classes\PluginBase;
/**
* Site Plugin Information File
*/
class Plugin extends PluginBase
<?php
include_once('vendor/autoload.php');
// debugger
use Tracy\Debugger;
Debugger::enable(Debugger::DEVELOPMENT, __DIR__ . '/log');
// load file
$content = file_get_contents(__DIR__ . '/data/data.xml');
@vojtasvoboda
vojtasvoboda / imagemin.sh
Last active April 23, 2016 22:34
Imagemin workaround
# Fix for: Fatal error: Cannot read property 'contents' of undefined
# Run at /node_modules/grunt-contrib-imagemin this command:
npm install --save imagemin@4.0.0
@vojtasvoboda
vojtasvoboda / config.php
Created January 4, 2016 10:32
Set ENV variables for OctoberCMS
<?php
return [
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
@vojtasvoboda
vojtasvoboda / Model.php
Created January 4, 2016 10:33
Register custom model validator in OctoberCMS
<?php
namespace Acme\Plugin\Models;
use Acme\Plugin\Validators\ExtendedValidator;
use Model as BaseModel;
use Illuminate\Support\Facades\Validator;
// registrate own validator
Validator::resolver(function($translator, $data, $rules, $messages) {