sudo apt-get update
sudo apt-get install python python-setuptools python-pip python-dev libxslt1-dev libxml2-dev libmysqlclient-dev
sudo pip install -U virtualenv
virtualenv /clients/sentry/
source /clients/sentry/bin/activate
sudo apt-get update
sudo apt-get install python python-setuptools python-pip python-dev libxslt1-dev libxml2-dev libmysqlclient-dev
sudo pip install -U virtualenv
virtualenv /clients/sentry/
source /clients/sentry/bin/activate
So one of the painful points of using docker
on OS X is that you need to run a virtualbox VM, which often suffers from performance issues. With xhyve, a OS X virtualization system, and docker-machine-xhyve you can now have docker
use the native OS X hypervisor to run containers.
No more dealing with virtualbox shenanigans!
In this script, I've also set up a way to autoconfigure terminal sessions to load docker's environment vars (dependent on docker-machine
) so you do not have to run eval $(docker-machine env whatever)
every time you open a new terminal window.
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
# Credit http://stackoverflow.com/a/2514279 | |
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r |
sudo apt-get update | |
sudo apt-get install python-virtualenv | |
sudo apt-get install python-dev | |
sudo apt-get install postgresql | |
sudo apt-get install postgresql-server-dev-9.3 | |
sudo apt-get install redis-server | |
sudo -u postgres createuser -s sentry | |
sudo -u postgres psql -c "alter user sentry with password 'sentry';" |
location /resize { | |
alias /tmp/nginx/resize; | |
set $width 150; | |
set $height 100; | |
set $dimens ""; | |
if ($uri ~* "^/resize_(\d+)x(\d+)/(.*)" ) { | |
set $width $1; | |
set $height $2; | |
set $image_path $3; |
<?php | |
/* | |
echo plural_form(42, array('арбуз', 'арбуза', 'арбузов')); | |
*/ | |
function plural_form($n, $forms) { | |
return $n%10==1&&$n%100!=11?$forms[0]:($n%10>=2&&$n%10<=4&&($n%100<10||$n%100>=20)?$forms[1]:$forms[2]); | |
} |
Это БЭМ-ориентированные хелперы над стандартным XJST-синтаксисом. Сюда входит:
apply
по какой-то mode (apply(this._mode = 'bla')
)applyCtx
(синтаксический сахар для applyNext(this.ctx = { some: 'new' })
)This is just a small post in response to [this tweet][tweet] by Julien Pauli (who by the way is the release manager for PHP 5.5). In the tweet he claims that objects use more memory than arrays in PHP. Even though it can be like that, it's not true in most cases. (Note: This only applies to PHP 5.4 or newer.)
The reason why it's easy to assume that objects are larger than arrays is because objects can be seen as an array of properties and a bit of additional information (like the class it belongs to). And as array + additional info > array
it obviously follows that objects are larger. The thing is that in most cases PHP can optimize the array
part of it away. So how does that work?
The key here is that objects usually have a predefined set of keys, whereas arrays don't: