Skip to content

Instantly share code, notes, and snippets.

View AlexR1712's full-sized avatar
🏠
Working from home

Alexander J. Rodriguez D. AlexR1712

🏠
Working from home
View GitHub Profile
@AlexR1712
AlexR1712 / tumblr.js
Created October 7, 2017 18:47
Tumblr Post type Text, thumbnails
/* Created by AlexR1712 */
function getImg (str) {
var m,
urls = [],
rex = /<img[^>]+src="(http:\/\/[^">]+)"/g;
while ( m = rex.exec( str ) ) {
urls.push( m[1] );
}
return urls;
}
@AlexR1712
AlexR1712 / 0x00000.bin
Created October 12, 2017 19:21 — forked from ajfisher/0x00000.bin
ESP8266 Transparent bridge to J5
@AlexR1712
AlexR1712 / image.php
Created October 23, 2017 14:03
gaussian blur in one sector of the image PHP
<?php
$loadFile = 'https://c1.staticflickr.com/5/4094/4809804115_40f52c8f25_b.jpg';
$image = imagecreatefromstring(file_get_contents($loadFile));
if ($image !== false) {
$face = imagecrop($image, ['x' => 152, 'y' => 568, 'width' => 199, 'height' => 199]);
@AlexR1712
AlexR1712 / Enigma.php
Created October 26, 2017 01:48
PHP Enigma Machine
<?php namespace App\Services;
/**
* A PHP version of the Enigma machine.
* Wikipedia: http://en.wikipedia.org/wiki/Enigma_machine
*
* This might not be an accurate representation. I have never seen, nor used an enigma machine.
* This class was created by reading the article at http://enigma.louisedade.co.uk/howitworks.html.
*
* Usage:
stages:
- test
- build
- deploy
test:
stage: test
script: echo "Running tests"
build:
@AlexR1712
AlexR1712 / bancos
Created December 27, 2017 20:17 — forked from xombra/bancos
Codigo y Bancos correspondientes de Venezuela
Banco:
<select name="banco">
<option value=""></option>
<option value="0156">100%BANCO</option>
<option value="0196">ABN AMRO BANK</option>
<option value="0172">BANCAMIGA BANCO MICROFINANCIERO, C.A.</option>
<option value="0171">BANCO ACTIVO BANCO COMERCIAL, C.A.</option>
<option value="0166">BANCO AGRICOLA</option>
<option value="0175">BANCO BICENTENARIO</option>
<option value="0128">BANCO CARONI, C.A. BANCO UNIVERSAL</option>
@AlexR1712
AlexR1712 / printMousePos.js
Created January 18, 2018 14:27
print Mouse Position
function printMousePos(event) {
document.body.textContent =
"clientX: " + event.clientX +
" - clientY: " + event.clientY;
}
document.addEventListener("click", printMousePos);
@AlexR1712
AlexR1712 / getElemClicked.js
Last active January 18, 2018 14:34
Get element clicked
document.addEventListener('click', function(e) {
e = e || window.event;
var target = e.target || e.srcElement,
text = target.textContent || text.innerText;
}, false);
// Version Two
if (document.addEventListener){
document.addEventListener("click", function(event){
var targetElement = event.target || event.srcElement;
@AlexR1712
AlexR1712 / README.md
Created February 12, 2018 20:44
Sequelize + Express + Migrations + Seed Starter
@AlexR1712
AlexR1712 / levenshtein.php
Created March 19, 2018 21:26
levenshtein. without native function
<?php
// Distancia Levenshtein en PHP (Sin usar la funciona nativa)
function lev($s,$t) {
$m = strlen($s);
$n = strlen($t);
for($i=0;$i<=$m;$i++) $d[$i][0] = $i;
for($j=0;$j<=$n;$j++) $d[0][$j] = $j;