Skip to content

Instantly share code, notes, and snippets.

@M165437
M165437 / tms2osm.js
Last active August 29, 2015 13:57
TMS to OpenStreetMap/Google Maps tile naming – node.js script that inverts row order/y axis
/**
* 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');
@M165437
M165437 / saveImageToPhone.js
Created April 4, 2014 19:46
A function that saves images to the image library on the phone with the help of Cordova/Phonegap plugin Canvas2ImagePlugin
/**
* 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 / 2017_11_10_194951_add_mime_type_to_media_table.php
Created November 10, 2017 20:55
Laravel migration for update from v4 to v5 of Spatie Medialibrary
<?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 November 27, 2022 12:20
PHP Artisan command that lists all scheduled tasks: php artisan schedule:list (Credit: https://stackoverflow.com/a/35559970/2714126)
<?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 May 26, 2023 05:34 — forked from chales/db-connect-test.php
Script for a quick PHP MySQL DB connection test.
<?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'");