Skip to content

Instantly share code, notes, and snippets.

@przor3n
przor3n / gist:c048015a9ff625a08a81
Created January 7, 2016 09:45
Year range for select
'years' => range(date('Y'), 2014)
@przor3n
przor3n / gist:beb98100d8e618c698af
Created January 6, 2016 20:01
Git - ignore local files
The .git/info/exclude file has the same format as any .gitignore file. Another option is to set core.excludesFile to the name of a file containing global patterns.
Note, if you already have unstaged changes you must run the following after editing your ignore-patterns:
git update-index --assume-unchanged [<file>...]
Note on $GIT_DIR: This is a notation used all over the git manual simply to indicate the path to the git repository. If the environment variable is set, then it will override the location of whichever repo you're in, which probably isn't what you want.
Link: http://stackoverflow.com/questions/1753070/git-ignore-files-only-locally
@przor3n
przor3n / gist:0268724892b81bac1cbd
Created January 4, 2016 15:12
yield and iterator_to_array as a dynamic generator
private function getSearchTypeList()
{
foreach ($this->choices as $choice) {
yield $choice => 'type.' . $choice;
}
}
//then
iterator_to_array($this->getSearchTypeList())
@przor3n
przor3n / gist:7e6e864f8a5d396115f8
Created December 14, 2015 13:39
Redirect to route in routes.yml
SomeRoute:
pattern: /someroute
defaults:
_controller: SomeBundle:Controller:action
AnotherRoute:
pattern: /anotherroute
defaults:
_controller: FrameworkBundle:Redirect:redirect
route: SomeRoute