Skip to content

Instantly share code, notes, and snippets.

View alfredotranchedone's full-sized avatar

Alfredo Tranchedone alfredotranchedone

View GitHub Profile
@alfredotranchedone
alfredotranchedone / BetterWMS
Last active November 3, 2023 04:29 — forked from rclark/Issues.md
L.TileLayer.BetterWMS.js extend L.TileLayer.WMS
There are a bunch of reasons why this is convoluted, mostly in building the URL to make the request:
1. You have to rely on an AJAX request, this example uses jQuery
2. To make a GetFeatureInfo request, you must provide a BBOX for a image, and the pixel coordinates for the part of the image that you want info from. A couple of squirrely lines of Leaflet code can give you that.
3. Output formats. The `info_format` parameter in the request. We don't know *a priori* which will be supported by a WMS that we might make a request to. See [Geoserver's docs](http://docs.geoserver.org/stable/en/user/services/wms/reference.html#getfeatureinfo) for what formats are available from Geoserver. That won't be the same from WMS to WMS, however.
4. WMS services return XML docs when there's a mistake in the request or in processing. This sends an HTTP 200, which jQuery doesn't think is an error.
5. added a php proxy and 2 new options (CORS workaround)

##Create an alias to MAMP's PHP installation

To do this, we can simply create an alias for our bash profile. We'll be doing this is nano, though you can do it in vim or a number of other editors as well.

Within the terminal, run:

nano ~/.bash_profile

This will open nano with the contents, at the top in a blank line add the following line:

@alfredotranchedone
alfredotranchedone / LARAVEL- create-app.sh
Last active August 29, 2015 14:07
Simple utility to create a fresh Laravel installation. Laravel is required! ;)
#!/bin/bash
# set base directory for Laravel apps (WITH trailing slashes)
# ex: "/Users/Foo/apache/httpdocs/"
BASE_DIR="/PATH/TO/WEBSERVER/"
function quit {
exit
}
Server {
Port = 80
SourceRoot = /Users/dan/hhvm-test/public/
}
VirtualHost {
* {
Pattern = .*
RewriteRules {
* {
@alfredotranchedone
alfredotranchedone / Install Composer using MAMP's PHP.md
Created October 5, 2017 14:25 — forked from irazasyed/Install Composer using MAMP's PHP.md
Instructions on how to change preinstalled Mac OS X PHP to MAMP's PHP Installation and then install Composer Package Management

Change default Mac OS X PHP to MAMP's PHP Installation and Install Composer Package Management


Instructions to Change PHP Installation


First, Lets find out what version of PHP we're running (To find out if it's the default version).

To do that, Within the terminal, Fire this command:

which php

@alfredotranchedone
alfredotranchedone / get_file.php
Created December 6, 2017 12:45
Get file via exec(wget)
<!DOCTYPE html>
<html>
<head>
<title>Upload file from URL</title>
</head>
<body>
<?php
$BASE_URL = strtok($_SERVER['REQUEST_URI'],'?');
if (isset($_POST['url'])){
@alfredotranchedone
alfredotranchedone / mysql-docker.sh
Created March 28, 2019 22:00 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
<IfModule mod_expires.c>
ExpiresActive On
# Images
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/webp "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 year"
ExpiresByType image/x-icon "access plus 1 year"
<ifModule mod_headers.c>
Header set Connection keep-alive
</ifModule>