Skip to content

Instantly share code, notes, and snippets.

View promatik's full-sized avatar
🌊

António Almeida promatik

🌊
View GitHub Profile
@promatik
promatik / ajax.js
Created January 16, 2018 11:59
Javascript AJAX call
ajax = (url, data, success, error, method) => {
var params = typeof data == 'string' ? data : Object.keys(data).map(
k => encodeURIComponent(k) + '=' + encodeURIComponent(data[k])
).join('&');
if(method === undefined)
method = "POST";
var xhr = new XMLHttpRequest();
xhr.open(method, url);
@promatik
promatik / territories.sql
Last active February 20, 2020 09:16
Portuguese Administrative Area (Distritos, concelhos e freguesias Portuguesas)
--
-- Table Structure
--
CREATE TABLE `territories` (
`id` varchar(6) COLLATE utf8mb4_unicode_ci NOT NULL,
`name` varchar(127) COLLATE utf8mb4_unicode_ci NOT NULL,
`level` enum('1','2','3') COLLATE utf8mb4_unicode_ci NOT NULL,
`parent_id` varchar(6) COLLATE utf8mb4_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
@promatik
promatik / relation_table.blade.php
Created July 29, 2018 14:48
Backpack CRUD Relation table
<?php
if($field['value'] == "")
return;
$crud->route = $field['route'];
?>
<div @include('crud::inc.field_wrapper_attributes') >
<h3 style="margin-top:0">{!! $field['label'] !!}</h3>
<div class="array-container form-group">