Skip to content

Instantly share code, notes, and snippets.

View luizbills's full-sized avatar
I may be slow to respond.

Luiz Bills luizbills

I may be slow to respond.
View GitHub Profile
@luizbills
luizbills / code.js
Created July 17, 2025 01:12
Get the date in YYYY-MM-DD format
const date = () => {
const offset = (new Date()).getTimezoneOffset()
return new Date(Date.now() - (offset*60*1000)).toISOString().split('T')[0]
}
@luizbills
luizbills / readme.md
Last active July 15, 2025 14:41
Tutorial: Pixel Manipulation in Litecanvas

Pixel Manipulation in Litecanvas

Include these two functions

function loadPixels() {
  const imageData = ctx().getImageData(0, 0, W, H);
  const pixels = imageData.data
  pixels.parent = imageData
  return pixels
@luizbills
luizbills / code.js
Last active July 11, 2025 17:28
How to detect "double taps" (ou double click) in Litecanvas
litecanvas();
use(pluginDoubleTap)
const actor = {}
function init() {
actor.x = W/2
actor.y = H/2
@luizbills
luizbills / code.js
Created July 10, 2025 23:48
How to detect "swipe" gesture in Litecanvas
litecanvas();
const taps = new Map()
const actor = {}
function init() {
actor.x = W/2
actor.y = H/2
// on "swipe" move our actor
@luizbills
luizbills / code.js
Last active June 15, 2025 21:39
Abilty/skill cooldown in litecanvas
litecanvas()
const DURATION = 2 // cooldown duration in seconds
let cooldown = 0 // current cooldown (0 = off)
let buttonSize
function init() {
buttonSize = W/8
}
@luizbills
luizbills / code.php
Created May 21, 2025 14:01
Multiple admin emails for WordPress
<?php
/**
* Multiple administrator emails
* @author Luiz Bills
*/
add_filter( 'option_admin_email', function ( $value ) {
global $pagenow;
$ignored_pages = [ 'options-general.php' ];
if ( in_array( $pagenow, $ignored_pages, true ) ) {
@luizbills
luizbills / code.js
Last active July 12, 2025 15:48
"Flappy Bird" in Litecanvas
litecanvas({
width: 240,
height: 360,
// autoscale: false
});
let bird, pipes, score, gameOver, gravity, frames;
function reset() {
bird = { x: 50, y: H/2, vy: 0, size: 12 };
@luizbills
luizbills / code.js
Last active July 12, 2025 15:52
Confetti emitter for Litecanvas
// based on https://play.kaplayjs.com/?example=confetti
litecanvas({})
function tapped(tapx, tapy) {
addConfetti({
pos: vec(tapx, tapy),
heading: 0
})
}
@luizbills
luizbills / readme.md
Created March 11, 2025 14:25
Random webrings sites in bookmarklet

Create a new bookmark in your browser:

  • Name: Random Page
  • URL: javascript:%28%28%29%3D%3E%7Blet%20n%3D%5B%22https%3A//baccyflap.com/noai/%3Frnd%22%2C%22https%3A//geekring.net/site/6/random%22%2C%22https%3A//webring.dinhe.net/random%22%2C%22https%3A//webring.theoldnet.com/random/navigate%22%5D%3Bwindow.open%28n%5BMath.random%28%29*n.length%7C0%5D%29%7D%29%28%29%3B

Javascript code decoded:

@luizbills
luizbills / code.js
Created March 10, 2025 17:16
DOOM fire in Litecanvas
// based on https://fabiensanglard.net/doom_fire_psx/
const FIRE_WIDTH = 128;
const FIRE_HEIGHT = 128;
litecanvas({
width: FIRE_WIDTH,
})
const firePalette = [0,0,0,0,0,0,10,10,10,10,10,10,10,10,4,4,4,4,4,4,4,4,5,5,5,5,5,5,3,3,3,3],