Skip to content

Instantly share code, notes, and snippets.

@gonatan
gonatan / openstreetmap.html
Last active May 2, 2022 21:03
Openstreetmap example
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="icon" type="image/svg+xml"
href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 width=%22256%22 height=%22256%22 viewBox=%220 0 100 100%22><rect width=%22100%22 height=%22100%22 rx=%2220%22 fill=%22%234b485a%22></rect><path fill=%22%23fff%22 d=%22M37.70 49.98L37.70 49.98Q37.70 52.71 36.87 54.81Q36.05 56.91 34.58 58.33Q33.11 59.75 31.12 60.48Q29.12 61.22 26.78 61.22L26.78 61.22Q24.43 61.22 22.44 60.48Q20.44 59.75 18.99 58.33Q17.54 56.91 16.71 54.81Q15.89 52.71 15.89 49.98L15.89 49.98Q15.89 47.25 16.73 45.17Q17.57 43.09 19.04 41.67Q20.51 40.25 22.49 39.52Q24.47 38.78 26.78 38.78L26.78 38.78Q29.09 38.78 31.08 39.52Q33.08 40.25 34.55 41.67Q36.02 43.09 36.86 45.17Q37.70 47.25 37.70 49.98ZM32.03 49.98L32.03 49.98Q32.03 46.62 30.61 44.92Q29.19 43.23 26.78 43.23L26.78 43.23Q24.40 43.23 22.96 44.92Q21.53 46.62 21.53 49.98L21.53 49.98Q21.53 53.38 22.94 55.08Q24.36 56.77 26.78 56.77L26.78 56.77Q29.19 56.77 30.61 55.08Q32.03 53.38 32.03 4
<?php
$idart = cRegistry::getArticleId();
$idlang = cRegistry::getLanguageId();
$type = 'IMGEDITOR'; // Name des ContentTypen (siehe Tabelle con_type)
$idtype = 1; // Index des ContentTypen (kann dann aus CON_VALUE bestimmt werden)
$contentTypes = []; // kann leer bleiben
// Auslesen der für den ContentTyp gespeicherten Daten
$articleLanguage = new cApiArticleLanguage();
<?php
/**
* @package Plugin
* @subpackage FormAssistant
* @author marcus.gnass
* @copyright four for business AG
* @link http://www.4fb.de
*/
// assert CONTENIDO framework
/**
* @link based on https://stackoverflow.com/a/19361915
*
* @param int $number
* @param int $length
* @param int $decimals
* @param string $decimalSep
* @param string $thousandSep
*
* @return bool|int|string
@gonatan
gonatan / shebang.py
Last active September 8, 2019 16:03
#!/usr/bin/python
# -*- coding: utf-8 -*-
@gonatan
gonatan / hello-fatfree.sh
Last active August 20, 2019 18:09
Fatfree "Hello world!" example
mkdir my-app && cd my-app
composer require bcosca/fatfree-core
echo "<?php require 'vendor/autoload.php';" > index.php
echo "Base::instance()->config('config.ini')->run();" >> index.php
echo "[routes]" > config.ini
echo "GET /=Controller->index" >> config.ini
echo "<?php class Controller {public function index($f3) {echo 'Hello fatfree!';}}" > Controller.php
@gonatan
gonatan / rgb2html.php
Last active December 22, 2017 11:17
rgb2html
<?php
function rgb2html($r, $g = -1, $b = -1)
{
if (is_array($r) && sizeof($r) == 3)
list($r, $g, $b) = $r;
$r = intval($r);
$g = intval($g);
$b = intval($b);
@gonatan
gonatan / git-commands.sh
Last active February 17, 2022 11:58
Git commands
# fetch data from remote
git fetch # fetch
git fetch --all --prune # fetch deleted branches
# undoing stuff
git reset <file> # undo 'git add' before commit
git reset --soft HEAD~1 # undo last 'git commit' and keep changes
git reset --hard HEAD~1 # undo last 'git commit' and loose changes
git reset --merge ORIG_HEAD # undo 'git merge' before push
git checkout HEAD <file> # revert after a merge conflict corruption