Skip to content

Instantly share code, notes, and snippets.

@christianhent
christianhent / map.php
Last active December 16, 2017 05:47
creates the zoomhome-control and add it to the map
<script>
// ... existing map code
// ...
map.fitBounds(geoJson.getBounds());
// create the zoomhome-control and add it to the map
var zoomHome = L.Control.zoomHome();
zoomHome.addTo(map);
</script>
@christianhent
christianhent / map.php
Last active December 16, 2017 05:49
includes the relevant JS and CSS references into your layout
<?php
// CSS, goes directly below leaflet.css
$doc->addStyleSheet('media/plg_content_zatracks/css/leaflet.zoomhome.css');
// JS, goes directly below leaflet.js
$doc->addScript('media/plg_content_zatracks/js/leaflet.zoomhome.min.js');
?>
@christianhent
christianhent / map.php
Last active December 16, 2017 06:06
includes Font-Awesome from CDN
<?php
// includes Font-Awesome, goes directly above leaflet.css
$doc->addStyleSheet('https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css');
?>
@christianhent
christianhent / map.php
Last active December 17, 2017 04:48
shows a CartoDB layer with Leaflet
<script>
//
var tile = new L.TileLayer('http://a.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png', {
maxZoom: 18,
attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> ' +
'contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">' +
'CC-BY-SA</a>. Tiles &copy; <a href="http://carto.com/">' +
'CARTO</a>'
});
</script>
@christianhent
christianhent / truffle_ganache.md
Last active August 11, 2021 11:29
Ganache & Truffle Console cheat sheet

Ganache & Truffle Console cheat sheet

ERC20 Token contract

YourToken.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

import "@openzeppelin/contracts/access/Ownable.sol";

#include <Thread.h>
int pwmPins[] = {3, 5, 6, 9, 10, 11};
int pwmCount = 6;
int brightness = 0; // how bright the LED is
int fadeAmount = 5; // how many points to fade the LED by
int ioPins[] = {1, 0, A5, A4, A3, A2, A1, A0, 2, 4, 7, 8, 12, 13};
int ioCount = 14;
int chaseDirection = 1;

ESP32.LINKSTATION 2

linkstation.mp4

What it is and how it works

An ESP32 WiFi cryptomonitor to display cryptocurrency prices based on quotes obtained via cryptocompare.com API. The code built on top of the Arduino framework is even for beginners easy to customize.