Skip to content

Instantly share code, notes, and snippets.

View andreasnymark's full-sized avatar

Andreas Nymark andreasnymark

View GitHub Profile
@jmsole
jmsole / kernproof.py
Last active April 29, 2023 19:52
Kern proof generator with Drawbot and drawbotgrid
from drawBotGrid import BaselineGrid, columnBaselineGridTextBox
import os
import datetime
import itertools
import unicodedata
# When you add more fonts, it stacks the strings for each
# weight to enable easy comparisons.
fonts = ('Helvetica Neue Thin', 'Helvetica Neue', 'Helvetica Neue Bold')
#fonts = ('Helvetica Neue Thin', 'Helvetica Neue')
@brendandawes
brendandawes / Processing Starting Template
Last active March 28, 2018 14:56
This is the boiler plate template I have setup each time I start a new Processing project. It includes my Dawesome Toolkit library as well as basic stuff for saving .png and .pdf files and exporting frames that you can compile into video. If you're a Vim user you can set this up to automatically be populated when you create a blank .pde file - t…
import dawesometoolkit.*;
import processing.pdf.*;
final String PROJECT = "project-x";
final int BACKGROUND_COLOR = #000000;
final int SECONDS_TO_CAPTURE = 60;
final int VIDEO_FRAME_RATE = 60;
int videoFramesCaptured = 0;
boolean recordVideo = false;
@bladeSk
bladeSk / SQLite-PHP-quickstart.php
Last active July 14, 2024 02:39
SQLite3 PHP Quickstart Tutorial
<?php
// This file walks you through the most common features of PHP's SQLite3 API.
// The code is runnable in its entirety and results in an `analytics.sqlite` file.
// Create a new database, if the file doesn't exist and open it for reading/writing.
// The extension of the file is arbitrary.
$db = new SQLite3('analytics.sqlite', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
// Errors are emitted as warnings by default, enable proper error handling.
@ivomynttinen
ivomynttinen / srcset.php
Last active February 7, 2017 06:51
Kirby CMS Tag for srcset images. Supports the attributes "retina" (file name of the @2x resource), "alt" (alt text on img), "class" (additional class on the img element). Place under /site/tags/
<?php
kirbytext::$tags['srcset'] = array(
'attr' => array(
'retina',
'alt',
'class'
),
'html' => function($tag) {
@paulirish
paulirish / what-forces-layout.md
Last active July 25, 2024 07:49
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@imjasonh
imjasonh / markdown.css
Last active May 24, 2024 22:56
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
@ian-cox
ian-cox / fields.php
Created February 13, 2015 20:19
Adding panel fields to front end Kirby templates
<?php if($user = $site->user() and $user->hasRole('admin')):?>
<form autocomplete="off" class="form" method="post" action="/panel/api/pages/update/<?php echo kirby()->request()->path();?>">
<label class="label" for="form-field-title">Title</label>
<input autocomplete="on" class="input" id= "form-field-title" name="title" required="" type="title" value="<?php echo $page->title() ?>">
<input type="submit" value="Save">
</form>
<?php endif;?>
@addyosmani
addyosmani / README.md
Last active July 24, 2024 10:54 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

@bastianallgeier
bastianallgeier / statify.php
Last active October 4, 2022 17:12
A first draft for a script, which converts a Kirby site into a static site. It's a rough first draft, so don't expect it to be perfect. Play with it, if you like it!
<?php
/**
* Instructions:
*
* 1. Put this into the document root of your Kirby site
* 2. Make sure to setup the base url for your site correctly
* 3. Run this script with `php statify.php` or open it in your browser
* 4. Upload all files and folders from static to your server
* 5. Test your site
@bitmorse
bitmorse / lastexport.py
Created March 20, 2013 00:51
lastfm scrobble exporter (from https://gitorious.org/fmthings/lasttolibre/blobs/master/lastexport.py // changed the script to try more often on failure )
#!/usr/bin/env python
#-*- coding: utf-8 -*-
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of