Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael Schmidt-Voigt M165437

View GitHub Profile
@M165437
M165437 / 2017_11_10_194951_add_mime_type_to_media_table.php
Created Nov 10, 2017
Laravel migration for update from v4 to v5 of Spatie Medialibrary
View 2017_11_10_194951_add_mime_type_to_media_table.php
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\Storage;
class AddMimeTypeToMediaTable extends Migration
{
@M165437
M165437 / ScheduleList.php
Last active Oct 16, 2020
PHP Artisan command that lists all scheduled tasks: php artisan schedule:list (Credit: https://stackoverflow.com/a/35559970/2714126)
View ScheduleList.php
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Console\Scheduling\Schedule;
class ScheduleList extends Command
{
/**
@M165437
M165437 / db-connect-test.php
Last active Aug 3, 2020 — forked from chales/db-connect-test.php
Script for a quick PHP MySQL DB connection test.
View db-connect-test.php
<?php
# Fill our vars and run on cli
# $ php -f db-connect-test.php
$dbname = 'name';
$dbuser = 'user';
$dbpass = 'pass';
$dbhost = 'host';
$link = mysqli_connect($dbhost, $dbuser, $dbpass) or die("Unable to Connect to '$dbhost'");
@M165437
M165437 / saveImageToPhone.js
Created Apr 4, 2014
A function that saves images to the image library on the phone with the help of Cordova/Phonegap plugin Canvas2ImagePlugin
View saveImageToPhone.js
/**
* Saves image to phone library/gallery
* with help of Cordova/Phonegap [Canvas2ImagePlugin][1]
* based on the function [getImageDataURL][2] by Raul Sanchez
*
* @param {String} url Location of the image file
* @param {Function} success Callback function
* @param {Function} error Error handler
*
* @example
@M165437
M165437 / tms2osm.js
Last active Aug 29, 2015
TMS to OpenStreetMap/Google Maps tile naming – node.js script that inverts row order/y axis
View tms2osm.js
/**
* TMS to OSM/Google Maps tile naming – node.js script that inverts row order/y axis
* assumes subfolders ./tiles/{z}/{x}/{y}.png
*/
(function() {
// ShellJS
require('shelljs/global');
You can’t perform that action at this time.