This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Logarithm tag weights | |
* | |
* @see http://zhekanax.ru/2009/06/25/tag-cloud-logarithm/ | |
* @see http://habrahabr.ru/blogs/webdev/30543/ | |
*/ | |
class Tag | |
{ | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Pager block example | |
* | |
* @author Svel <[email protected]> | |
* @url https://gist.github.com/gists/821450 | |
* @param sfDoctrinePager $pager | |
* @param string $route | |
* @param array $params | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8" ?> | |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
<xsl:output method="html" encoding="windows-1251" indent="yes" /> | |
<xsl:template name="break"> | |
<xsl:param name="text" /> | |
<xsl:choose> | |
<xsl:when test="contains($text,'
')"> | |
<xsl:value-of select="substring-before($text, '
')" disable-output-escaping="yes" /> | |
<br /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$handle = new PDO("mysql:host=localhost;dbname=dbname", | |
'username', 'password', | |
array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Inspired from https://www.braintreepayments.com/braintrust/our-git-workflow | |
# and some https://www.google.com/search?q=git%20workflow&hl=en searching | |
# | |
git checkout master | |
git merge --squash dev | |
msg="Version XXX";log=$(git log --format=" * %s" dev ^$(git log --merges -n 1 dev --format="%H")); echo -e "$msg\n\n$log" | git commit -F- | |
git checkout dev && git merge master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysqldump -u[USERNAME] -p[PASSWORD] -h[HOST] --add-drop-table --no-data [DATABASE] | grep ^DROP | mysql -u[USERNAME] -p[PASSWORD] -h[HOST] [DATABASE] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---# mysqldump -uUser -hHost -p database > database.sql | |
---# mysql -D database -uUser -p --init-command="set @@foreign_key_checks=0" < database.sql | |
SET FOREIGN_KEY_CHECKS=0 ; | |
use database ; | |
source database.sql ; | |
SET FOREIGN_KEY_CHECKS=1 ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* http://habrahabr.ru/post/52680/ | |
* http://stackoverflow.com/questions/453191/select-first-instance-only-with-xpath/ | |
*/ | |
$doc = new DomDocument('UTF-8', '1.0'); | |
$doc->load(__DIR__ . '/xml.xml'); | |
$path = new DomXPath($doc); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Обновляем ICU | |
нужен всякий gcc и проч. хлам для сборки ручками | |
wget http://download.icu-project.org/files/icu4c/54.1/icu4c-54_1-src.tgz | |
tar zxf icu4c-54_1-src.tgz | |
rm icu4c-54_1-src.tgz | |
cd icu/source/ | |
./configure --prefix=/usr/local/ | |
make | |
make install # sudo <...> |