Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title> - jsFiddle demo</title>
<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/foundation/5.2.1/css/foundation.min.css">
<script type='text/javascript' src="//ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script type='text/javascript' src="//cdnjs.cloudflare.com/ajax/libs/foundation/5.2.1/js/foundation/foundation.min.js"></script>
<script type='text/javascript' src="//cdnjs.cloudflare.com/ajax/libs/foundation/5.2.1/js/foundation/foundation.reveal.js"></script>
<script type='text/javascript'>//<![CDATA[
class ActiveRecord extends CActiveRecord
{
public static function model($sClassName = NULL)
{
if ($sClassName == NULL)
$sClassName = get_called_class();
$oModel = parent::model($sClassName);
$oModel->resetScope();
$oModel->setDbCriteria(new CDbCriteria($oModel->defaultScope()));
@Blizzke
Blizzke / ErrorHandlerTrait.php
Created June 29, 2015 13:41
Alternative to error catching before bootstrap
<?php
/**
* Error Handler allows errors to be logged to the audit_error table.
*/
namespace bedezign\yii2\audit\components\base;
use bedezign\yii2\audit\Audit;
use bedezign\yii2\audit\models\AuditError;
use Exception;
public function addBatchData($batchData, $compact = true)
{
$columns = ['entry_id', 'type', 'data'];
$rows = [];
foreach ($batchData as $type => $data) {
$rows[] = [$this->id, $type, [Helper::serialize($data, $compact), \PDO::PARAM_LOB]];
}
static::getDb()->createCommand()->batchInsert(AuditData::tableName(), $columns, $rows)->execute();
}
@Blizzke
Blizzke / gist:c46f614640be10ecf2d3
Created July 16, 2015 09:55
Heroku split dependencies composer.json

Hello,

Our demo application running on heroku uses the default composer.json for our project. Unfortunately the project contains functionality that is optional in use for the user, but would be nice to be able to demo in the site.

So we're having a bit of a dilemma: Take for example our soap logging functionality. We would like to demo it, but including the extension as a dependency in the composer.json would force all our users to have it too, which is not what we want. We've added yii2-swiftmailer already as a dependency (which is also optional) to demonstrate the mail capabilities.

Is there another way to indicate to to Heroku that it should install the soap extension? Eg a require-heroku in the composer.json or some settings in a .heroku.yml? We would really like to avoid having to add another branch to maintain specifically for that purpose.

ERROR::FINDSUBTITLES::Exception generated in thread FINDSUBTITLES: Index must be int or string
DEBUG::FINDSUBTITLES::'
Traceback (most recent call last):
File "/volume1/@appstore/sickbeard-custom/var/SickBeard/sickbeard/scheduler.py", line 109, in run
self.action.run(self.force)
File "/volume1/@appstore/sickbeard-custom/var/SickBeard/sickbeard/subtitles.py", line 446, in run
\'searchcount\'] < 7 and now - datetime.datetime.strptime(epToSub[b\'lastsearch\'],
IndexError: Index must be int or string'
# -*- mode: ruby -*-
# vi: set ft=ruby :
HOSTNAME = "irrelevant.dev" # VM/nginx hostname
IP = "172.16.190.10" # One of the IPs of your host only virtualbox network
SSHPORT = 12222 # Set to a custom port, not taken on your machine
Vagrant.configure(2) do |config|
config.vm.box = "internal-dvp"
config.vm.box_url = "http://internal.url/base.box"
$ docker-compose logs
Attaching to v119maandcom_info_1, v119maandcom_web_1, v119maandcom_phphaproxy_1, v119maandcom_worker_1, v119maandcom_mariadb_1, v119maandcom_phpha_1, v119maandcom_phpfiles_1, v119maandcom_mysql_1, v119maandcom_percona_1, v119maandcom_mailcatcher_1, v119maandcom_mongodb_1, v119maandcom_redisphpsessionhandler_1
mongodb_1 | 2016-01-30T10:49:24.323+0000 I CONTROL [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=dd279018b1ba
mongodb_1 | 2016-01-30T10:49:24.324+0000 I CONTROL [initandlisten] db version v3.2.0
mongodb_1 | 2016-01-30T10:49:24.324+0000 I CONTROL [initandlisten] git version: 45d947729a0315accb6d4f15a6b06be6d9c19fe7
mongodb_1 | 2016-01-30T10:49:24.324+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1e 11 Feb 2013
mongodb_1 | 2016-01-30T10:49:24.324+0000 I CONTROL [initandlisten] allocator: tcmalloc
mongodb_1 | 2016-01-30T10:49:24.324+0000 I CONTR
@Blizzke
Blizzke / docker-alias.php
Last active October 10, 2016 11:58
The new Docker OSX opens up all ports on localhost. This means you'll have to add port numbers to urls etc. This hackisch gist creates an aliased IP on the `lo` interface and links the source ports from all containers to it. This means that you can use port 80 or so for a website and 3306 for mysql even if those are in use on the host.
<?php
/**
* The new docker for OSX opens all ports on the OSX lo0 interface.
* This means you are forced to use urls like http://localhost:32580/ for your site.
* This script adds an alias IP to the lo0 interface (one you configure via the environment / .env file or by
* modifying the configuration below).
* Based on docker-compose "rules" it tries to guess the network created for the current folder so that
* it can use the docker inspect functionality to obtain all related containers and the ports they provide.
* Finally it uses the `socat`-tool to proxy ports on that virtual IP to the original port on localhost.
*/
@Blizzke
Blizzke / Dockerfile.m4
Created August 31, 2018 05:22
Dockerfile "includes"
FROM debian
include(base.m4)
RUN APT_GO \
&& APT_INSTALL screen \
&& APT_CLEANUP