Skip to content

Instantly share code, notes, and snippets.

View volfegan's full-sized avatar
💭
Still Operational

Daniel Leite Lacerda volfegan

💭
Still Operational
View GitHub Profile
@volfegan
volfegan / is_url.js
Last active October 5, 2018 19:53
Validate an URL string using regular expression (javascript) return => true|false
function is_url(url_str) {
// Regular Expression for URL validation created by Diego Perini
//from https://gist.github.com/dperini/729294
// Author: Daniel L. Lacerda
// Created: 2018/09/21
// Updated: -
// License: MIT
let isValidURL = new RegExp(
@volfegan
volfegan / check_img_signature.php
Last active October 10, 2018 03:30
Simple php function to parse an image file and find if it has that image's signature (magic number) according to its extension
<?php
// Author: Daniel L. Lacerda
// Created: 2018/10/05
// Updated: -
// License: MIT
/*
* Reads the first bytes of the image file and checks its signature are true|false for that file extension
*
* @param actual $file
* @param string $fileExtension
@volfegan
volfegan / check_AVfile_signature.php
Created October 10, 2018 03:37
Simple php function to parse an audio or video file and find if it has the right signature (magic number) according to its extension
<?php
/*
* Reads some part of the bytes of an audio|video file and checks if its signature are true|false for that file extension
*
* @param actual $file
* @param string $fileExtension
* @return boolean
**/
function check_AVfile_signature($file, $fileExtension) {
@volfegan
volfegan / christmas.txt
Created December 24, 2018 14:55
ascii art christmas tree with cat shouting
~*~
/@\  ∧ ∧  / ̄ ̄ ̄ ̄ ̄
/%;@\ (,ºyº)< Boas Festas! Miau!
o/@,%\o ⊂ ;⊃ \_____
/%;`@,\ ~|/ \
'^^^H^^^` L J
@volfegan
volfegan / QuadTree_Collisions.pde
Created July 31, 2019 18:30
QuadTree_Collisions debugging starter code
// Daniel Shiffman
// http://codingtra.in
// http://patreon.com/codingtrain
//Videos
//Part 1:
//https://www.youtube.com/watch?v=OJxEcs0w_kE
//Part 2:
//https://www.youtube.com/watch?v=QQx_NmCIuCY
//This code is part 2 video of the challenge.
@volfegan
volfegan / constrainingPoint.pde
Created August 1, 2019 18:38
Point move per mouse and is constrained inside a circle (processing 3)
float x, y;
float easing = 0.05;
PVector circle = new PVector(250, 250);
int diameter = 300;
void setup() {
size(500, 500);
x = y = width/2;
noStroke();
smooth();
@volfegan
volfegan / NihongoText.pde
Last active August 4, 2019 17:05
Show Japanese text on processing
String neko = "ネコ"; // neko (even it is only showing boxes on IDE)
void setup() {
size(400, 300);
textSize(18);
fill(0);
textFont(createFont("NSimSun", 30));
float x_offset = textWidth(neko)/2;
text(neko, (width/2)-x_offset, height/2); //show text in the middle of the screen
}
@volfegan
volfegan / agentPixelManipulator.pde
Last active October 1, 2019 02:12
6 different Agents modify only one specific RGB unit either by +1 or -1. Basically creates random colour noise to the canvas
//@author u/thudly
//https://www.reddit.com/r/processing/comments/da6l10/munchers_and_poopers_a_very_inefficient_3d_noise/
//modified by Volfegan
int n = 12;
int wCount = 6 * n; // number of walkers. should be a multiple of 6
Walker[] walkers = new Walker[wCount];
boolean showFrameRate = true;
void setup() {
@volfegan
volfegan / desert.txt
Last active May 30, 2020 02:12
ASCII art desert view
. _ + . ______ . .
( /|\ . | \ . +
. ||||| _ | | | | || .
. ||||| | | _| | | | |_|| .
/\ ||||| . | | | | | | .
__||||_|||||____| |_|_____________\______________
. |||| ||||| /\ _____ _____ . .
|||| ||||| |||| . . . _______ . .
. \|`-'|||| |||| ________ . ,vvvvvvvvv.
\__ |||| |||| . |>>OASIS>>| .
@volfegan
volfegan / circlesTunnelSpiral.pde
Last active December 17, 2019 23:44
Circles in Circles moving to give the illusion of spirals
//visual output: https://twitter.com/VolfeganGeist/status/1205621889416208384
//reference code for some of the effects used: https://twitter.com/ky0ju_art/status/1175391601121611776
//attempt to recreate: https://twitter.com/Borrachas/status/1204855395006763009
float a, b, c=0, x, y, d, r=600*2, h=600/2, s=40;
void setup() {
size(600, 600);
}
void draw() {
background(#EFF2D0);
for (x=0; x<=r; x+=s*2) {