Skip to content

Instantly share code, notes, and snippets.

View IvanAlekseevichPopov's full-sized avatar
🏠
Working from home

Ivan Alekseevich Popov IvanAlekseevichPopov

🏠
Working from home
  • Saint-Petersburg Russia
View GitHub Profile
@IvanAlekseevichPopov
IvanAlekseevichPopov / sublime
Last active March 16, 2017 10:31
sublime settings
Packets:
package Control
BracketHighlighter
SideBarEnhancements
Theme - Spacegray
jsFormat
GoSublime
Fonts:
https://drive.google.com/open?id=0B91XXENgXqcRcXByZWNPSHFVbmc
@IvanAlekseevichPopov
IvanAlekseevichPopov / .basrc.bash
Last active July 16, 2017 15:04
.bashrc with GOPATH, history comfortable and Instantly stored
alias go="~/go/bin/go"
export GOROOT=/home/ivan/go
export GOPATH=/home/ivan/go/packages
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
export HISTTIMEFORMAT="%h %d %H:%M:%S "
export HISTFILESIZE=10000
shopt -s histappend
PROMPT_COMMAND='history -a'
\* @JMSAnnotation\\Type\("(.*?)"\)
\* @JMSAnnotation\\Type\("integer"\)\n\t \* @JmsAnnotation\\Sinse\("1.0"\)
use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation\Since;
if ($request_uri ~* "\/\/") {
rewrite ^/(.*) $scheme://$host/$1 permanent;
}
$this->get('request')->getBasePath();
$this->get('kernel')->getRootDir();
$this->getContainer()->getParameter('kernel.root_dir')
$this->container->getParameter('kernel.root_dir')
twig:
# ...
paths:
"%kernel.root_dir%/../vendor/acme/foo-bar/templates": foo_bar
$bar = $foo ?? 'default';
@IvanAlekseevichPopov
IvanAlekseevichPopov / UserAddressBookArchiveManager.php
Last active March 17, 2017 13:32
dateTime set in QueryBuilder
<?php
$qb = $this->container->get('doctrine.orm.entity_manager')->createQueryBuilder();
$qb->update(UserAddressBookArchive::class, 'ab')
->set('ab.parsedAt', ':current_date')
->where($qb->expr()->in('ab.id', $ids))
->setParameter(':current_date', new \DateTime('NOW'), Type::DATETIME)
->getQuery()
->execute();
fmt.Printf("%T\n", val) //Type of val
@IvanAlekseevichPopov
IvanAlekseevichPopov / timer.js
Created March 28, 2017 13:52
Изолированная версия переменной js
var someVar = 'hello';
setTimeout((function(someVar) {
return function() { alert(someVar); }
})(someVar), 1000);
var someVar = 'goodbye';