Skip to content

Instantly share code, notes, and snippets.

View larscwallin's full-sized avatar

Lars Wallin larscwallin

View GitHub Profile
@Martin-Pitt
Martin-Pitt / pan-zoom-touch-and-trackpad.js
Last active December 22, 2023 02:16
Panning and Pinch-Zoom gesture handler for both touchscreens and trackpads; Works really well on a MacBook trackpad
// Target state
var tx = 0;
var ty = 0;
var scale = 1;
function visualiseTargetState() {
box.style.transform = `translate(${tx}px, ${ty}px) scale(${scale})`;
}
@josefnpat
josefnpat / readme.md
Last active April 7, 2024 11:39
Going from Lua 5.2 to PICO-8's Lua

This information applies to the PICO-8 0.1.6 release.

This document is here to help folks with a proficiency in Lua understand the limitations and discrepencies between Lua and PICO-8's Lua.

You can always view the manual or yellowafterlife's extended 0.1.1 manual.

General

  • anything written in uppercase the PICO-8 editor or .p8 is made lowercase by the editor. → editing the .p8 file directly can work
  • print(function() end) outputs the string function instead of the string function: 0x0000000.
anonymous
anonymous / AngularJS-and-FabricJS.markdown
Created March 26, 2015 18:43
AngularJS and FabricJS

AngularJS and FabricJS

An example of binding AngularJS to a FabricJS canvas by using a service as a way of mimicking $scope for FabricJS.

A Pen by Michael Calkins on CodePen.

License.

anonymous
anonymous / Fashion-Visualisation-with-mix-blend-mode.markdown
Created March 10, 2015 09:53
Fashion Visualisation with mix-blend-mode

Fashion Visualisation with mix-blend-mode

Shows different product options by using an SVG layer in mix-blend-mode to recolor an underlying image. Chrome users will need to enable experimental web features under chrome://flags Complete article

A Pen by Dudley Storey on CodePen.

License.

@WebReflection
WebReflection / CustomEvent.js
Last active June 7, 2018 18:29
CustomEvent for IE8 or other old browsers that do not implement it. `new CustomEvent('type', {bubbles:true, detail:{what:'ever'}})`
try{new CustomEvent('?')}catch(o_O){
/*!(C) Andrea Giammarchi -- WTFPL License*/
this.CustomEvent = function(
eventName,
defaultInitDict
){
// the infamous substitute
function CustomEvent(type, eventInitDict) {
var event = document.createEvent(eventName);
@wout
wout / gist:6352742
Created August 27, 2013 12:13
Textflow plugin for svg.js
// svg.textflow.js 0.8 - Copyright (c) 2013 Wout Fierens - Licensed under the MIT license
SVG.Textflow = function() {
this.constructor.call(this, SVG.create('text'))
/* define default style */
this.styles = {
'font-size': 16
, 'font-family': 'Helvetica, Arial, sans-serif'
, 'text-anchor': 'start'
@cacheleocode
cacheleocode / ibooks.js
Last active June 10, 2019 13:49
In iBookstore Asset Guide is a documented javascript library for interactivity in ebooks. After logging in, Select Deliver Your Content Module, Download the iBookstore Fixed Layout EPUB Example, Open the ePub with an editor or Unzip the ePub (I used Textwrangler). Open the JS Folder. There it is! From Textwrangler, I just copied and pasted the c…
/**
* iBooks JS Framework
* Compatibility: iBooks 1.5+
* Copyright © 2009-2011 Apple Inc. All rights reserved.
*
**/
/**
* @name iBooks
* @namespace
@larscwallin
larscwallin / simplx.dompdf.php
Created March 27, 2013 18:41
Simplx DOMPDF Snippet. Depends on http://dompdf.github.com/
<?php
/*
simplx.dompdf
*/
$filename = isset($filename) ? $filename : false;
$outputto = isset($outputto) ? $outputto : 'file';
@letorbi
letorbi / fontsmoothie.js
Last active January 15, 2022 17:39
This code enforces font-smothing for web fonts even if it's not enabled in the system settings. More info: http://pixelsvsbytes.com/blog/2013/02/nice-web-fonts-for-every-browser
// Font Smoothie copyright 2013,14,15 Torben Haase <http://pixelsvsbytes.com>
// Source-URL <https://gist.github.com/letorbi/5177771>
//
// Font Smoothie is free software: you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License as published by the Free
// Software Foundation, either version 3 of the License, or (at your option) any
// later version.
//
// Font Smoothie is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
@sergiolopes
sergiolopes / README.md
Last active February 11, 2024 23:57
A script to generate SVG sprites, including CSS and PNG fallbacks.