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 / 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 / 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) {
@volfegan
volfegan / circlesTunnelPerfectSpiral.pde
Last active December 28, 2019 03:09
Circles in Circles moving creates a perfect spiral
//reference code for solution of perfect Spiral:
//https://gist.github.com/chandeeland/b69156115e2b5842d83ca9eb3b2bbf2e
//failed trial:: https://gist.github.com/volfegan/e55decad6814e63fb450379c9bf13a61
//attempt to recreate: https://twitter.com/Borrachas/status/1204855395006763009
float a, b, x, y, d, h=600/2, r, s, shrink=0.94;
void setup() {
size(600, 600);
}
void draw() {
background(#EFF2D0);
@volfegan
volfegan / RainbowHeartLines.pde
Last active January 9, 2020 23:10
Heart curve created by colourful lines
//based on https://www.openprocessing.org/sketch/816944
//somewhat inspired by https://codepen.io/al-ro/pen/BaaBage?editors=1010
//resources http://mathworld.wolfram.com/HeartCurve.html
ArrayList<Node> arrayNodes = new ArrayList<Node>();
float scaleDiv = 50; //scale the size of the heart
void setup() {
size(720, 720);
colorMode(HSB, 100);
strokeWeight(2);
translate(width/2, height/2);