Skip to content

Instantly share code, notes, and snippets.

View jaxtheking's full-sized avatar

Gianluca Pinoci jaxtheking

View GitHub Profile
@cyberwani
cyberwani / wordpress-upload-base64.php
Created September 13, 2019 10:19
Upload a base64 string as image to the WordPress media library
<?php
/**
* Save the image on the server.
*/
function save_image( $base64_img, $title ) {
// Upload dir.
$upload_dir = wp_upload_dir();
$upload_path = str_replace( '/', DIRECTORY_SEPARATOR, $upload_dir['path'] ) . DIRECTORY_SEPARATOR;
@mortenege
mortenege / websockets_using_apache_reverse_proxy.md
Created March 4, 2018 07:10
WebSockets using Apache Reverse Proxy

WebSockets using Apache Reverse Proxy

This post will cover how to configure our already running server [1, 2] to proxy websocket connections to a backend of our choice. We will continue using Vagrant to provision the guest machine.

Step 1

Clone or download a simple websocket server into our vagrantfolder (and extract if an archive).

Step 2

Modify 001-mysite.conf to include our websocket redirect.

@vladimirtsyupko
vladimirtsyupko / gist:10964772
Created April 17, 2014 08:32
Git force pull to overwrite local files
git fetch --all
git reset --hard origin/master
git pull origin master
@erickarbe
erickarbe / gist:2698356
Created May 15, 2012 01:04
Get Instagram Pics by tag via PHP
<?php
$client_id = "xxx"; //your client-id here
$tag = "kittens"; //your tag here
$cachefile = "instagram_cache/$tag.cache";
if (file_exists($cachefile) && time()-filemtime($cachefile)<3600) {
$contents = file_get_contents($cachefile);
} else {