Skip to content

Instantly share code, notes, and snippets.

View nilshoerrmann's full-sized avatar

Nils Hörrmann nilshoerrmann

View GitHub Profile
@lukaskleinschmidt
lukaskleinschmidt / bootstrap.php
Created March 2, 2020 09:17
Kirby Thumbnails
<?php
// bootstrap/kirby.php
include dirname(__DIR__) . '/vendor/autoload.php';
$kirby = new Kirby([
'roots' => [
'base' => $base = dirname(__DIR__),
'index' => $base . '/public',
'content' => $base . '/content',
/**
* ellipsisify
* @param {string} filename - The filename to be truncated.
* @param {number} lengthThreshold - (optional) The minimum length of filename to truncate.
*/
export const ellipsisify = (filename, lengthThreshold = 20) => {
// just return the filename if it's less than 20 characters long
if (filename.length < lengthThreshold) return filename;
@brendo
brendo / Symphony Project Structure.md
Last active August 20, 2016 14:11
A modular approach for Symphony.

Core

symphony/workspace

The everyday developer will clone the workspace to create their project. This repository accepts Issues, Wiki and Pull Requests. All resources in here are custom to the specific project, all the dependencies will be resolved into /vendor. There are a few boilerplate files such conductor and index.php.

Favour convention approach, commands, datasources, events and sections are autodiscovered where possible, however some configuration may be required for the service container (if the items have dependencies). Needs fleshing out.

It will include:

@anandthakker
anandthakker / index.html
Last active January 17, 2016 10:41
Hover styles with Mapbox GL
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title></title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.11.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.11.0/mapbox-gl.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
@brendo
brendo / Symphony Scratchpad.md
Created September 11, 2015 15:14
Musing about Symphony, rebuilt with modern concepts and tools

Symphony

Baseline

  • PHP 5.6+ (also tested on HHVM, PHP 7)
  • Code style PSR-2
  • Autoloading to PSR-4
  • Logging will be abstracted to PSR-3
  • Requests / Responses should follow PSR-7
  • Must have test coverage (consider a combination of Behat/PHPSpec, or even just PHP Unit)
@hallahan
hallahan / featuresAt-mapbox-gl-js.md
Last active May 8, 2016 14:08
I'm going through the code execution of `featuresAt` in Mapbox GL JS. This is to take notes and understand how all of this works.

How FeaturesAt Works in MapboxGL JS

I'm going through the code execution of featuresAt in Mapbox GL JS. This is to take notes and understand how all of this works.

Initiating the feature search based on the example on Mapbox GL API Docs...

map.on('click', function(e) {
@e-n-f
e-n-f / tilemill2.md
Last active January 4, 2016 05:09
How to get a shapefile into TileMill 2

How to get a shapefile into TileMill 2

Getting the shapefile onto your computer

You probably already have a shapefile. If not, I downloaded one from Natural Earth:

$ curl -L -O http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_admin_0_countries.zip
@nrenner
nrenner / index.html
Created December 30, 2013 17:16
rivers leaflet-tilelayer-vector master (v0.8-dev)
<!DOCTYPE html>
<html lang="en"><head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0"/>
<title>Leaflet vector tile map of rivers - master (v0.8-dev)</title>
<link rel="stylesheet" href="http://nrenner.github.io/leaflet-tilelayer-vector/bower_components/leaflet/leaflet.css" />
<script src="http://nrenner.github.io/leaflet-tilelayer-vector/bower_components/leaflet/leaflet.js"></script>
<script src="http://www.somebits.com/rivers/lib/leaflet-hash.js"></script>
@designermonkey
designermonkey / next_proposal.md
Last active December 16, 2015 04:58
Draft proposal for the Symphony Next project.
  • Draft Number: 1
  • Date: 2013-04-14
  • Author: John Porter @designermonkey

Symphony Next

This is all still a little new to me, so forgive me if this sounds naive, or you all have already thought about this and it's obvious, but I've been thinking about how we actually build Next. (I like this as a project codename).

Proposing the Application

@mjackson
mjackson / color-conversion-algorithms.js
Last active June 8, 2024 01:27
RGB, HSV, and HSL color conversion algorithms in JavaScript
/**
* Converts an RGB color value to HSL. Conversion formula
* adapted from http://en.wikipedia.org/wiki/HSL_color_space.
* Assumes r, g, and b are contained in the set [0, 255] and
* returns h, s, and l in the set [0, 1].
*
* @param Number r The red color value
* @param Number g The green color value
* @param Number b The blue color value
* @return Array The HSL representation