Skip to content

Instantly share code, notes, and snippets.

View p01's full-sized avatar

Mathieu 'p01' Henri p01

View GitHub Profile
@p01
p01 / example.js
Created June 2, 2011 20:09 — forked from stdclass/example.js
Make RGB Colors Lighter / Darker
/*
* Make RGB-Colors lighter / darker
*/
var color = function(c,n,i,d){for(i=3;i--;c[i]=d<0?0:d>255?255:d|0)d=c[i]+n;return c}
/**
* @param array RGB Colors
* @param number Amount
*/
@p01
p01 / LICENSE.txt
Created July 30, 2011 11:27 — forked from 140bytes/LICENSE.txt
isPrimeNumber in 41 bytes
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Mathieu 'p01' Henri <http://www.p01.org/releases/>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@p01
p01 / LICENSE.txt
Created August 5, 2011 07:30 — forked from 140bytes/LICENSE.txt
Levenshtein Distance
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Mathieu 'p01' Henri <http://www.p01.org/releases/>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@p01
p01 / LICENSE.txt
Last active March 9, 2024 13:40 — forked from 140bytes/LICENSE.txt
Sudoku Solver in 140bytes
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Mathieu 'p01' Henri - http://www.p01.org/releases/
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@p01
p01 / LICENSE.txt
Created October 3, 2011 21:55 — forked from Prinzhorn/LICENSE.txt
American Soundex in 146 bytes
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@p01
p01 / LICENSE.txt
Created October 6, 2011 17:11 — forked from 140bytes/LICENSE.txt
Mandelbrot fractal with zoom & panning in 133 bytes
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Mathieu 'p01' Henri - http://www.p01.org/releases/
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@p01
p01 / LICENSE.txt
Created October 13, 2011 19:29 — forked from 140bytes/LICENSE.txt
Music SoftSynth
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Mathieu 'p01' Henri http://www.p01.org/releases/
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@p01
p01 / prodScreenshot.user.js
Created August 24, 2012 14:46
pouet.net.user.js - prodScreenshot.user.js
// ==UserScript==
// @name prodScreenshot
// @description Add the corresponding thumbnail inside each link to a prod.
// @include http://pouet.net/*
// @exclude http://pouet.net/
// @exclude http://pouet.net/index.php*
// @include http://www.pouet.net/*
// @exclude http://www.pouet.net/
// @exclude http://www.pouet.net/index.php*
// ==/UserScript==
@p01
p01 / quack.js
Created January 12, 2014 16:11
Conditional breakpoint after X iterations of a loop
// Example of conditional breakpoint ( in code ) after X iterations
for(var i=0, __iterations_left_before_break=50; (--__iterations_left_before_break||debugger),i<1e5;i++)
{
// body of the loop
}
/*
To do the same in devtool, you can put a breakpoint on the first statement of the loop,
right-click on the breakpoint > Edit condition.
@p01
p01 / viewer_snippet.js
Last active August 29, 2015 14:01
PDF.js profile slow pages
/*
* Copy this gist into a snippet of the Sources panel of the DevTool and run it to profile slow pages
* Alternatively the PDFView.PROFILE_THRESHOLD can be set in `ms`
*/
// threshold in ms to keep/discard CPU profile
PDFView.PROFILE_THRESHOLD = 500;
PDFView.renderHighestPriority = function pdfViewRenderHighestPriority_patched(currentlyVisiblePages) {
if (PDFView.idleTimeout) {