Skip to content

Instantly share code, notes, and snippets.

<?php
namespace App\ApiBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use FOS\RestBundle\Controller\Annotations\View;
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
use Symfony\Component\HttpFoundation\Request;

Добавление эталона товара в вишлист

Запрос:

    {
        "jsonrpc": "2.0",
        "method": "wishlist.add",
        "params": {
            "product_id": 1
 },

Awesome PHP Libraries

A list of amazingly awesome PHP libraries that you should consider using (and some other shiny extras).

@memphys
memphys / .htaccess
Created July 19, 2012 11:47
Capifony files templates for Symfony2 deployment
<IfModule mod_rewrite.c>
ErrorDocument 503 /system/maintenance.html
RewriteEngine On
RewriteCond %{REQUEST_URI} !.(css|gif|jpg|png)$
RewriteCond %{DOCUMENT_ROOT}/maintenance.html -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
RewriteRule ^.*$ - [redirect=503,last]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
@memphys
memphys / gist:2354458
Created April 10, 2012 21:03 — forked from panicsteve/gist:1641705
Form letter template for acquired startups
Dear soon-to-be-former user,
We've got some fantastic news! Well, it's great news for us anyway. You, on
the other hand, are fucked.
We've just been acquired by:
[ ] Facebook
[ ] Google
[ ] Twitter
@memphys
memphys / commands.sh
Created April 3, 2012 21:53
usefull bash commands
# find folder or file recursively and delete it
$ find . -name ".git" -exec rm -rf '{}' \;
# compress and archive
$ tar -zcvf archive-name.tar.gz directory-name
# uncompress and unarchive
$ tar -zxvf archive-name.tar.gz
# show changed files through svn revisions
@memphys
memphys / shortcuts.md
Created March 28, 2012 12:22
Bash Shortcuts For Maximum Productivity

source: http://www.skorks.com/2009/09/bash-shortcuts-for-maximum-productivity/

Command Editing Shortcuts

  • Ctrl + a – go to the start of the command line
  • Ctrl + e – go to the end of the command line
  • Ctrl + k – delete from cursor to the end of the command line
  • Ctrl + u – delete from cursor to the start of the command line
  • Ctrl + w – delete from cursor to start of word (i.e. delete backwards one word)
  • Ctrl + y – paste word or text that was cut using one of the deletion shortcuts (such as the one above) after the cursor
@memphys
memphys / deploy.sh
Created March 12, 2012 06:31
Easy deployment with git and ssh
git archive --format=tar origin/master | gzip -9c | ssh user@yourserver.com "cd /var/www; tar xvzf -"
@memphys
memphys / deploy.rb
Created November 8, 2011 13:06
Capistrano config for simple php project
set :application, "application_name"
default_run_options[:pty] = true
set :scm, :git
set :repository, "git@github.com:memphys/application_name.git"
# setting ssh port and option to use ssh-keys stored on local machine
set :ssh_options, {:forward_agent => true, :port => 8822}
@memphys
memphys / commands.sh
Created October 25, 2011 09:23
GAE I18n
# Creating dir for translation files
mkdir -p /path/to/myapp/conf/locale
cd /path/to/myapp
# Creating language file by scanning app directory for text marked for translation.
# It will appear in /path/to/conf/locale/en/LC_MESSAGES/django.po
# Run command for each needed language
PYTHONPATH=/path/to/googleappengine/lib/django/
/path/to/googleappengine/lib/django/django/bin/make-messages.py -l en