Skip to content

Instantly share code, notes, and snippets.

View rformato's full-sized avatar

Renato Formato rformato

View GitHub Profile
@rformato
rformato / custom_code.js
Created January 11, 2024 17:45
Forever custom code
{}
@rformato
rformato / webpack proxy for wordpress
Last active February 9, 2024 13:50
webpack proxy for wordpress
config.devServer = {
proxy: {
//here we declare to proxy all the requests not handled by webpack. I this case everything webpack bundle is in
// dist/ and so we don't proxy it to let the webpack dev server handle it
'!**/dist/**': {
//set the URL of the wordpress site
target: 'http://mysite.test',
changeOrigin: true,
onProxyRes: function(proxyRes, req, res) {
if( proxyRes.headers &&
setup();
window.setTimeout(draw,0);
var draw = function() {
c.clearRect(0, 0, wc, hc);
c.fillStyle = "#1B2209"
c.fillRect(0, 0, wc, hc);
for(var i=0;i<numParticelle;i++) {
part[i].update();
part[i].draw();
}
window.setTimeout(draw,0);
}
var numParticelle = 100;
var colori = ["#00FFFF","#FFFF00","#FF00FF"];
var numColori = colori.length;
var part = new Array(numParticelle);
var hc,wc;
var resize = function() {
hc = $(window).height()-5;
wc = Math.max($(window).width(),800)-5;
$("#canvas").attr("width",wc).attr("height",hc);
}
$(window).resize(resize);
resize();
var c = $("#canvas")[0].getContext("2d");
var Particella = function(x, y, radius, col) {
this.dx = 0;
this.dy = 0;
this.dradius = 0;
this.rifx = 0;
this.rify = 0;
this.vel = 30;
this.vibracounter = 0;
this.x = x;
this.y = y;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>XL visual</title>
<link href="css/xlvisual.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<!--[if IE]>
<script type="text/javascript" src="js/excanvas_r71.js"></script>
<![endif]-->
var creaParticelle = function() {
var x,y = hc/2;
for(var i=0;i<numParticelle;i++) {
x = Math.random()*wc;
part[i] = new Particella(x,y, Math.random()*5.5+0.5, colori[Math.round(Math.random()*(numColori-1))]);
part[i].setRif(x,y);
}
}
var setup = function() {
@rformato
rformato / recherche_to_array.php
Created February 1, 2014 19:50
un test pour avoir una requete plus performante avec l'index fulltext
<?php
/***************************************************************************\
* SPIP, Systeme de publication pour l'internet *
* *
* Copyright (c) 2001-2011 *
* Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
* *
* Ce programme est un logiciel libre distribue sous licence GNU/GPL. *
* Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. *