Skip to content

Instantly share code, notes, and snippets.

View odil-io's full-sized avatar
🪐

Odilio Witteveen odil-io

🪐
View GitHub Profile
@odil-io
odil-io / upload-a-file.MD
Created January 2, 2020 11:06 — forked from ahmadawais/upload-a-file.MD
Upload a file using the WordPress REST API

Upload files

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:

@odil-io
odil-io / JS: DragTransform
Last active January 27, 2017 08:41 — forked from fta2012/DragTransform
Creeert een rechthoek waarvan je de hoeken kunt verslepen om een 3D effect transform te genereren voor een DOM element. Je kan in Chrome de gehele code plakken in de console. Vergeet niet de selector te veranderen!
var selector = 'img' // Replace this with the selector for the element you want to make transformable
jQuery.getScript('//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js', function() {
jQuery.getScript('//cdnjs.cloudflare.com/ajax/libs/numeric/1.2.6/numeric.min.js', function() {
(function() {
var $, applyTransform, getTransform, makeTransformable;
$ = jQuery;