- http://stackoverflow.com/questions/804115 (
rebasevsmerge). - https://www.atlassian.com/git/tutorials/merging-vs-rebasing (
rebasevsmerge) - https://www.atlassian.com/git/tutorials/undoing-changes/ (
resetvscheckoutvsrevert) - http://stackoverflow.com/questions/2221658 (HEAD^ vs HEAD~) (See
git rev-parse) - http://stackoverflow.com/questions/292357 (
pullvsfetch) - http://stackoverflow.com/questions/39651 (
stashvsbranch) - http://stackoverflow.com/questions/8358035 (
resetvscheckoutvsrevert)
| server { | |
| charset utf-8; | |
| #listen <YOUR_IP>:80; | |
| server_name <YOUR_DOMAIN> www.<YOUR_DOMAIN>; | |
| root /PATH/TO/YOUR/PRESTASHOP/INSTALLATION; | |
| index index.php; | |
| access_log /var/log/nginx/domains/<YOUT_DOMAIN>.log combined; |
| product_add_to_cart : function(){ | |
| var ajx_data = {}; | |
| var ajx_grab = {}; | |
| $(document).on('change','.single-product .variations_form select',function(e){ | |
| var $this = $(this); | |
| var pro_id = $(".single-product .variations_form").attr('data-product_id'); | |
| var attribute_name = $this.attr('data-attribute_name'); | |
| var attribute_value = $this.val(); | |
| var post_ajxurl = window.location+"?wc-ajax=get_variation"; |
Using the REST API to upload a file to WordPress is
quite simple. All you need is to send the file in a
POST-Request to the wp/v2/media route.
There are two ways of sending a file. The first method simply sends the file in the body of the request. The following PHP script shows the basic principle:
I recently got a new Macbook Pro and wanted to document how I setup my PHP environment. I like full control of how PHP is built and I usually build it from source. I do this because I often add custom extensions and modules not found in the common PHP OSX installers. If your looking for a easier method than building from source try https://php-osx.liip.ch/.
NOTE: This post assumes you are running a fresh install of MacOS Sierra 10.12.16 with System Integrity Protection disabled. If you don't know how to disable it just boot into recovery mode and open a terminal and type
csrutil disable, or google search it :) This post also assumes you are using Zsh instead of Bash shell. If you are using Bash you can replace anytime you see~/.zshrcwith~/.bashrc.
First lets get some of the prerequisites. Start by grabbing the command line tools neccessary:
xcode-select --install| #!/bin/bash | |
| set -euo pipefail | |
| IFS=$'\n\t' | |
| # Ubuntu Server | |
| export DEBIAN_FRONTEND=noninteractive | |
| echo -e "\e[96m Adding php PPA \e[39m" | |
| sudo add-apt-repository -y ppa:ondrej/php |
To install a custom package or modify an existing docker image we need to
- run a docker a container from the image we wish to modify
- modify the docker container
- commit the changes to the container as a docker image
- test changes made to image
| <?php | |
| use Swagger\Annotations as SWG; | |
| /** | |
| * @SWG\Swagger( | |
| * basePath="/v1", | |
| * host="api.local", | |
| * schemes={"http"}, | |
| * produces={"application/json"}, |
Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle
The API we are creating in this gist will follow these rules :
- The API only returns JSON responses
- All API routes require authentication
- Authentication is handled via OAuth2 with
passwordGrant Type only (no need for Authorization pages and such). - API versioning is managed via a subdomain (e.g.
v1.api.example.com)
The API will be written in PHP with the Symfony 2 framework. The following SF2 bundles are used :