Skip to content

Instantly share code, notes, and snippets.

@damour
damour / Bootstrap vs jquery
Created February 3, 2013 08:07
Bootstrap v 2.2.2
<script type='text/javascript'>
$.fn.bootstrapBtn = $.fn.button.noConflict();
</script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script>
var $ = jQuery.noConflict();
</script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>
var jq17 = jQuery.noConflict();
</script>
@damour
damour / gist:4772699
Created February 12, 2013 19:37
Laravel 4 docs to pdf
git clone git://github.com/laravel/docs.git
cd docs
cat * > all.md
gimli -f all.md
@damour
damour / gist:4959422
Last active December 13, 2015 18:58
Регулярное выражение правильность украинских номеров (моб и городской 7-значный) PHP, javascript thanks http://habrahabr.ru/users/Kindman/
preg_match("/(?<!\w)(?:(?:(?:(?:\+?3)?8\W{0,5})?0\W{0,5})?[34569]\s?\d[^\w,;(\+]{0,5})?\d\W{0,5}\d\W{0,5}\d\W{0,5}\d\W{0,5}\d\W{0,5}\d\W{0,5}\d(?!(\W?\d))/x", $_POST['tel'], $output_array)
if (/(\w)(?:(?:(?:(?:\+?3)?8\W{0,5})?0\W{0,5})?[34569]\s?\d[^\w,;(\+]{0,5})?\d\W{0,5}\d\W{0,5}\d\W{0,5}\d\W{0,5}\d\W{0,5}\d\W{0,5}\d(?!(\W?\d))/.test($('#phone').val()) == false)
<?
//Controller:
if ($this->getRequest()->isXmlHttpRequest())
{
$response = new JsonResponse();
$response->setData(array(
'title' => $title,
'data' => $this->render('AcmeMainBundle:Default:index.html.twig'
)
@damour
damour / gist:5395843
Created April 16, 2013 13:23
create phpdoc
php bin/phpdoc.php run -d ./src -t ./web/api
@damour
damour / gist:5721235
Created June 6, 2013 12:47
поиск дубликатов в таблице
SELECT login, COUNT(login) AS cnt
FROM users GROUP BY login
HAVING ( COUNT(login)>1 );
$value_str = self::model()->find(
"category_id = :category_id AND feature_id = :feature_id",
array(
':category_id' => $category_id,
':feature_id' => $feature_id,
)
);
@damour
damour / gist:5773900
Created June 13, 2013 14:00
выйти из сеанса, не прерывая выполнения приложения
./programma
ctrl + Z
bg
disown -h
Когда нужно ее в foreground вернуть уже после нового входа на сервер по ssh :
fg
Список запущенных прог - команда jobs
194.28.87.71