Skip to content

Instantly share code, notes, and snippets.

@dmitrybitman
dmitrybitman / pre-commit
Created March 5, 2012 11:56
php code sniffer pre-commit
#!/bin/bash
# PHP CodeSniffer pre-commit hook for git
#
# @author Soenke Ruempler <soenke@ruempler.eu>
# @author Sebastian Kaspari <s.kaspari@googlemail.com>
#
# see the README
PHPCS_BIN=/usr/bin/phpcs
PHPCS_CODING_STANDARD="$(git rev-parse --show-toplevel)/doc/CodeStandard.xml"
@dmitrybitman
dmitrybitman / ruleset.xml
Created March 5, 2012 11:55
php code sniffer + zend
<?xml version="1.0"?>
<ruleset name="Zend">
<description>A coding standard based on an early Zend Framework coding standard. Note that this standard is out of date.</description>
<!-- Include some sniffs from all around the place -->
<rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
<rule ref="Generic.Functions.OpeningFunctionBraceBsdAllman"/>
<rule ref="Generic.PHP.DisallowShortOpenTag"/>
<rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
<rule ref="PEAR.Classes.ClassDeclaration"/>
<script type="text/javascript">
var uvOptions = {};
(function() {
var uv = document.createElement('script'); uv.type = 'text/javascript'; uv.async = true;
uv.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'widget.uservoice.com/5xyK2WAy2dTtybZ6c5gCeQ.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(uv, s);
})();
</script>
#!/usr/bin/perl -w
use strict;
use List::Util qw(sum min max);
use POSIX;
my %data = ();
my $max = 3000;
my $min = 0;
my $step = 50;
my $stepsCount = ($max - $min) / $step;
#!/usr/bin/perl -w
use strict;
my $splitre = qr/\sU:(\S+).*?\sLT:(\d+)/;
my %re = (
'vk' => '^http://([^/]+.)?(vkontakte\.ru|vk\.com)[/$]',
'odkl' => '^http://([^/]+.)?(odnoklassniki\.ru|odkl.ru)[/$]',
'my' => '^http://([^/]+.)?(my.mail.ru|mir.mail.ru)[/$]'
);
my %sites = map { $_ => qr{$re{$_}} } keys(%re);