Skip to content

Instantly share code, notes, and snippets.

View matysanchez's full-sized avatar
AI and Web Engineer

Matías Sanchez Moises matysanchez

AI and Web Engineer
View GitHub Profile
@matysanchez
matysanchez / github_update.php
Created October 26, 2019 05:06
Easy setup to create a CD process for any VM using GitHub webhooks
<?php
$command = exec('sudo ./update.sh');
print_r($command);
?>
@matysanchez
matysanchez / functions.php
Last active October 14, 2019 19:49
Easy way to add versioning to WordPress assets using the file timestamp as a version
<?php
// This function will add ?ver=XXXX at the end of the file
function AddTimestampToAssets( $assetURI ) {
// Get the FULL Relative URL
$relativeURL = getcwd() . '/' . ltrim( (str_replace( home_url(), '', $assetURI )), '/' );
// Check if the $relativeURL contains "?ver=", if so remove it
if ( strpos ($relativeURL, "?ver=") )
$relativeURL = explode("?ver=", $relativeURL)[0];
@matysanchez
matysanchez / controller.php
Last active September 2, 2016 08:28
Upload remote image with Lithium #li3
<?php
namespace app\controllers;
use app\models\Uploads;
class UploadsController extends \lithium\action\Controller {
public function index() {
$upload = Uploads::first($this->request->id);
return compact('upload');