Skip to content

Instantly share code, notes, and snippets.

View protorob's full-sized avatar

protorob

View GitHub Profile
@protorob
protorob / processwire_json_page_create.php
Last active April 9, 2018 13:24
Processwire Page Create From Webtic JSON
<?php
$movies = json_decode(file_get_contents('https://secure.webtic.it/frame/wtjsonservices.ashx?wtid=getFullScheduling&localid=1000'));
foreach ($movies->DS->Scheduling->Events as $movie) {
$p = new Page(); // create new page object
$p->template = 'single-movie'; // set template
$p->parent = wire('pages')->get('/programmazione/'); // set the parent
$p->name = $movie->Title; // give it a name used in the url for the page
$p->title = ucfirst($movie->Title); // set page title (not neccessary but recommended)
#!/bin/bash -e
# Start allways the same
wpuser='yourusername'
wpuseremail='yourname@yourdomain.tld'
wpuserpass=$(date +%s | sha256sum | base64 | head -c 10)
dpprefix=$(date +%s | sha256sum | base64 | head -c 6)
clear
<?php
$json = file_get_contents( dirname(__FILE__) . DIRECTORY_SEPARATOR . "prdmd.json");
$jsonToArray = json_decode($json, true);
$productTemplate =
'Title:
{{title}}
----
Identifier:
@protorob
protorob / artomultiplo-backups.sh
Created April 12, 2017 08:28
A rude way to create tarballs of your server files and then cancelling it
#!/bin/bash -e
#Giving a name to the file
echo "Name your file (Without .tar.gz - avoid dots and special characters): "
read -e filename
#Making a tar file with the directory excluding snapshot folder
env GZIP=-9 tar cvzf "$filename".tar.gz mywebsite.com/ --exclude="mywebsite.com/wp-content/uploads/snapshots"
#Moving the file to a public directory
<div class="cf7-custom-style">
<div class="grid-50">
[text* your-name placeholder "Name"]
</div>
<div class="grid-50">
[email* your-email placeholder "Email"]</div>
<div class="grid-100">
[text your-subject placeholder "Subject"]
</div>
<div class="grid-100">