Skip to content

Instantly share code, notes, and snippets.

@mandymozart
mandymozart / CCMidiTest
Created June 14, 2012 12:34
Controller Change MidiTest with RWMidi for Korg NanoKontrol & NanoPad (y axis malfunctioning
import rwmidi.*;
MidiInput nanoCntrl, nanoPad;
void setup() {
// Midi
// Show available MIDI output devices here
MidiInputDevice devices[] = RWMidi.getInputDevices();
for (int i = 0; i < devices.length; i++) {
println(i + ": " + devices[i].getName());
@Warry
Warry / Article.md
Created December 11, 2012 00:11
How to make faster scroll effects?

How to make faster scroll effects?

  • Avoid too many reflows (the browser to recalculate everything)
  • Use advanced CSS3 for graphic card rendering
  • Precalculate sizes and positions

Beware of reflows

The reflow appens as many times as there are frames per seconds. It recalculate all positions that change in order to diplay them. Basically, when you scroll you execute a function where you move things between two reflows. But there are functions that triggers reflows such as jQuery offset, scroll... So there are two things to take care about when you dynamically change objects in javascript to avoid too many reflows:

@ofca
ofca / $.3.js
Last active March 2, 2025 15:05
// based on https://gist.github.com/Potfur/5576225 & https://github.com/james2doyle/saltjs
// more info: https://plus.google.com/109231487156400680487/posts/63eZzzrBSb6
window.$ = function(s) {
var c = {
'#': 'ById',
'.': 'sByClassName',
'@': 'sByName',
'=': 'sByTagName'}[s[0]];
return document[c?'getElement'+c:'querySelectorAll'](s.slice(1))
};
@willurd
willurd / web-servers.md
Last active May 13, 2025 13:11
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@TastyToast
TastyToast / urlify.js
Created September 9, 2013 23:50
Change links to urls
function urlify(text){
var urlRegex = /(([a-z]+:\/\/)?(([a-z0-9\-]+\.)+([a-z]{2}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel|local|internal))(:[0-9]{1,5})?(\/[a-z0-9_\-\.~]+)*(\/([a-z0-9_\-\.]*)(\?[a-z0-9+_\-\.%=&amp;]*)?)?(#[a-zA-Z0-9!$&'()*+.=-_~:@/?]*)?)(\s+|$)/gi;
return text.replace(urlRegex, function(url){
return '<a href="' + url + '">' + url + '</a>';
});
};
@bomberstudios
bomberstudios / sketch-plugins.md
Last active February 26, 2024 07:02
A list of Sketch plugins hosted at GitHub, in no particular order.
@julianshapiro
julianshapiro / RAF.js
Last active May 11, 2024 15:21
requestAnimationFrame Polyfill
var requestAnimationFrame = window.requestAnimationFrame || (function() {
var timeLast = 0;
return window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) {
var timeCurrent = (new Date()).getTime(),
timeDelta;
/* Dynamically set the delay on a per-tick basis to more closely match 60fps. */
/* Technique by Erik Moller. MIT license: https://gist.github.com/paulirish/1579671. */
timeDelta = Math.max(0, 16 - (timeCurrent - timeLast));
@evantahler
evantahler / dmx.js
Last active July 26, 2018 19:59
enttec open dmx + nodejs
#!/usr/bin/env node
// A simple DMX example which will turn all the lights on and off every second
// You can use this as a fork within another application as well (cluster-awareness)
////////////
// dmx.js //
////////////
var ftdi = require('ftdi');
@jongacnik
jongacnik / readme.md
Last active August 29, 2015 14:01
Route Mapping Module

Route Mapping Module

Small regex based router (maybe route checker is a better name) whose main purpose is just to map routes to functions. Built with the intention of using with jQuery pjax, so on pjax:complete check to see if the new route has specific code that needs to be executed. If you don't want to use with pjax, just leave the event option blank (or plop in any event you want the router to be bound to). There's jQuery dependency in here, but could be rejiggered to be without pretty easy.

Check out the router.usage.js file for config.

Regex matching logic from miniroutes!

@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