Skip to content

Instantly share code, notes, and snippets.

View neoascetic's full-sized avatar
🏖️
Sabbatical

Pavel neoascetic

🏖️
Sabbatical
View GitHub Profile
@neoascetic
neoascetic / nestedtransactor.php
Last active August 1, 2016 13:04
[Laravel] Nested transactions wrapper class
<?php
/**
* Class for Laravel 3.x that provides ability to use nested transactions via SAVEPOINTs
* (inspired from http://www.kennynet.co.uk/2008/12/02/php-pdo-nested-transactions/).
* For now, only the default connection is supported.
*
* Useful in testing, when you want to start a transaction before running a test
* and revert all its changes after it finished.
*
@neoascetic
neoascetic / btests.php
Last active October 13, 2015 20:18
[Laravel] Better PHPUnit integration for Laravel 3.x
<?php
/**
* To get Code Coverage support, install `xdebug` module.
*
* Usage:
*
* php artisan btests directory with/suffix.test.php or/without --env=test
*
*/
@neoascetic
neoascetic / object_history.html
Created October 30, 2012 02:19
[Django] Show recent user actions in his "History" view
{# Put this file into "admin/auth/user" folder under your templates directory #}
{% extends "admin/object_history.html" %}
{% load log i18n %}
{% block extrastyle %}
{{ block.super }}
<style>#log { width: 100%; } #log tbody th { width: 16em; }</style>
{% endblock %}
@neoascetic
neoascetic / sass-lint-junit-xml-reporter.rb
Created December 23, 2014 18:06
[SCSS] JUnit formatter for scss-lint
module SCSSLint
# Reports lints in an JUnit (XML) format.
class Reporter::JUnitReporter < Reporter
def report_lints
output = "<?xml version=\"1.0\"?>\n"
output << "<testsuite name=\"SCSS\" tests=\"#{lints.count}\" failures=\"#{lints.count}\">\n"
lints.group_by(&:filename).each do |filename, file_lints|
output << "<testcase name=#{filename.encode(xml: :attr)} failures=\"#{file_lints.count}\">\n"
@neoascetic
neoascetic / prefix.less
Last active August 29, 2015 14:07
[less] vendor prefixer mixin
// code from https://github.com/neoascetic/compless
// >> .prefix(box-shadow, 5px);
// -webkit-box-shadow: 5px;
// -moz-box-shadow: 5px;
// -ms-box-shadow: 5px;
// -o-box-shadow: 5px;
// box-shadow: 5px;
//
// >> .prefix(box-shadow, 5px, webkit ms);