Skip to content

Instantly share code, notes, and snippets.

View vpArth's full-sized avatar

Alexander Deider vpArth

  • https://github.com/skyeng
  • Russia, Novosibirsk
View GitHub Profile
@xanf
xanf / AjaxAuthenticationListener.php
Created June 8, 2011 19:20
AJAX auth errors listener for Symfony2
<?php
namespace Application\ProdrepHelperBundle\Component\Event;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
/**
*/
class AjaxAuthenticationListener
@uasi
uasi / rebaselock.pre-rebase.sh
Last active February 13, 2023 13:30
A pre-rebase hook that refuses to rebase if "branch.${BRANCH}.rebaselock" is true.
#!/bin/sh
#
# The "pre-rebase" hook is run just before "git rebase" starts doing
# its job, and can prevent the command from running by exiting with
# non-zero status.
#
# The hook is called with the following parameters:
#
# $1 -- the upstream the series was forked from.
# $2 -- the branch being rebased (or empty when rebasing the current branch).
timeit = function(fn) {
var a = (new Date()).valueOf();
fn();
console.log((new Date()).valueOf() - a);
}
this.renderWithJS = function() {
timeit(function() {
var d = ['<ul class="list-group">'];
var i, user;
@tassoevan
tassoevan / libxml29_compat.patch
Last active August 11, 2021 15:32
Install PHP 5.2.17 in phpbrew
--- ext/dom/node.c 2012-08-06 17:49:48.826716692 +0800
+++ ext/dom/node.c 2012-08-06 17:52:47.633484660 +0800
@@ -1895,9 +1895,17 @@ static void dom_canonicalization(INTERNA
RETVAL_FALSE;
} else {
if (mode == 0) {
+#ifdef LIBXML2_NEW_BUFFER
+ ret = xmlOutputBufferGetSize(buf);
+#else
ret = buf->buffer->use;