Skip to content

Instantly share code, notes, and snippets.

View SergeR's full-sized avatar

Serge Rodovnichenko SergeR

  • Moscow, Russia
  • 12:01 (UTC +03:00)
View GitHub Profile
@oppara
oppara / gist:132274
Created June 18, 2009 23:13
php: mb_trim
function mb_trim( $str ) {
return mb_ereg_replace(
'^[[:space:]]*([\s\S]*?)[[:space:]]*$', '\1', $str );
}
@dahnielson
dahnielson / UUID.php
Last active April 5, 2024 21:14
Pure PHP UUID generator
<?php
/**
* UUID class
*
* The following class generates VALID RFC 4122 COMPLIANT
* Universally Unique IDentifiers (UUID) version 3, 4 and 5.
*
* UUIDs generated validates using OSSP UUID Tool, and output
* for named-based UUIDs are exactly the same. This is a pure
* PHP implementation.
@ceeram
ceeram / gist:3852324
Last active October 11, 2015 11:28
cakephp submodule
cd to app
git submodule add git://github.com/ceeram/cakephp.git Core
<optional>
cd Core
git checkout 2.4
cd ..
</optional>
//update webroot/index.php:
@hakre
hakre / README.md
Last active August 18, 2022 12:57
Iterators for PHP XMLReader for ease of parsing

Iterators for PHP XMLReader for Ease of Parsing

Change Log:

  • 0.1.12 maintenance release with fixes.

  • 0.1.11 maintenance release with fixes. added XMLReader::CDATA and XMLReader::WHITESPACE node support for XMLWritingIteration. added

// XPath CheatSheet
// To test XPath in your Chrome Debugger: $x('/html/body')
// http://www.jittuu.com/2012/2/14/Testing-XPath-In-Chrome/
// 0. XPath Examples.
// More: http://xpath.alephzarro.com/content/cheatsheet.html
'//hr[@class="edge" and position()=1]' // every first hr of 'edge' class
# откатываем последний коммит, но не удаляем изменения
git reset HEAD~ --soft
git add .
git stash
# переключаемся на нужную ветку
git checkout имя-верной-ветки
git stash pop
git add .
git commit -m "тут ваш комментарий"
# теперь изменения в нужной ветке
@LeaVerou
LeaVerou / dabblet.css
Last active March 28, 2024 06:22
Two column <dl> with two lines of CSS! Thank you Grid Layout!
/**
* Two column <dl> with two lines of CSS! Thank you Grid Layout!
* Limitation: Breaks if we have multiple consecutive <dt>s or <dd>s
*/
dl {
display: grid;
grid-template: auto / 10em 1fr;
}
@kerstvo
kerstvo / phpstorm-wa-live-templates.xml
Last active July 31, 2020 19:18
PHPStorm WA live templates
<template name="wa-fields" value="&lt;div class=&quot;block fields&quot;&gt;&#10;&#10; &lt;div class=&quot;field-group&quot;&gt;&#10; &lt;div class=&quot;field&quot;&gt;&#10; &lt;div class=&quot;name&quot;&gt;&lt;/div&gt;&#10; &lt;div class=&quot;value&quot;&gt;&lt;/div&gt;&#10; &lt;/div&gt;&#10; &lt;/div&gt;&#10;&#10; &lt;div class=&quot;field-group&quot;&gt;&#10; &lt;div class=&quot;field&quot;&gt;&#10; &lt;div class=&quot;value&quot;&gt;&#10; &lt;input type=&quot;button&quot; class=&quot;button&quot; value=&quot;Save&quot; /&gt;&#10; &lt;/div&gt;&#10; &lt;/div&gt;&#10; &lt;/div&gt;&#10; &#10;&lt;/div&gt;" description="fields" toReformat="true" toShortenFQNames="true">
<context>
<option name="HTML" value="true" />
<option name="PHP" value="true" />
<option name="Twig" value="true" />
<option name="Vue" value="true" />
</context>
</template>
<template name="wa-form-field" value="&lt;div class=&quot;field&quot;&gt;&#1