Skip to content

Instantly share code, notes, and snippets.

View maxalmonte14's full-sized avatar

Max maxalmonte14

View GitHub Profile
@splosch
splosch / md5_device_fingerprint.js
Last active March 6, 2018 20:50
Browser and device fingerprinting - a MD5 checksum generator to identify a device-browser-combination
(function(window, document, JSON){
"use strict";
var SEP = '|', ua, opera, ie;
/*
* Collect Browser & Device Data
*/
var Collector = {
/*
* MD5 Checksum calculation
*/
@ratiw
ratiw / Set DB_CONNECTION to use sqlite in-memory database when testing.md
Last active January 1, 2020 05:24
Set DB_CONNECTION to use sqlite in-memory database when testing

#Set DB_CONNECTION to use sqlite in-memory database when testing

  • Open `phpunit.xml' file in the current project
  • Add the following environment variables to the appropriate section
  <env name="DB_CONNECTION" value="sqlite">
  <env name="DB_DATABASE" value=":memory:">
  • in config\database.php file, change the default sqlite connection to
  'connections' => [
@jrobinsonc
jrobinsonc / number-format.js
Last active July 23, 2021 22:09
Funcion para darle formato a un número. #javascript #numbers
function number_format(amount, decimals) {
amount += ''; // por si pasan un numero en vez de un string
amount = parseFloat(amount.replace(/[^0-9\.]/g, '')); // elimino cualquier cosa que no sea numero o punto
decimals = decimals || 0; // por si la variable no fue fue pasada
// si no es un numero o es igual a cero retorno el mismo cero
if (isNaN(amount) || amount === 0)
return parseFloat(0).toFixed(decimals);
@mathiasverraes
mathiasverraes / zeromq.md
Last active September 23, 2021 13:29
zeromq php7
git clone git://github.com/mkoppanen/php-zmq.git
cd php-zmq
phpize && ./configure
make && make install

Finally add the following line to your php.ini:

@midascodebreaker
midascodebreaker / laravel-per-project-installation.md
Last active March 15, 2022 10:09
Laravel Homestead per Project Installation on Windows 10
Prerequisite:
  • Php7
  • Composer
  • Gulp
  • Npm
  • Vagrant
  • Virtual Box
  • Laravel Installer
@jwage
jwage / .php_cs
Last active May 3, 2023 06:42
php-cs-fixer git pre commit hook
<?php
return Symfony\CS\Config\Config::create()
->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL)
->fixers([
'short_array_syntax',
'ordered_use',
])
;

gif-from-tweet

There are so many great GIFs out there and I want to have copies of them. Twitter makes that harder than it should be by converting them to MP4 and not providing access to the source material. To make it easier, I made a bash pipeline that takes a tweet URL and a filename, extracts the MP4 from that tweet and uses ffmpeg to convert back to GIF.

Dependencies

  • ffmpeg
    • macOS: brew install ffmpeg
    • Ubuntu/Debian: apt install ffmpeg
@son-link
son-link / uptogit
Created March 28, 2011 17:37
Script para automatizar la actualización de un repositorio git
#!/bin/bash
# UpToGit 0.1
# Actualiza facilmente tu repositorio Git
# (CC) 2011 Alfonso Saavedra "Son Link"
# http://sonlinkblog.blogspot.com
# Bajo licencia GNU/GPL
# Modo de uso: copia o mueve este script a /usr/bin o /usr/local/bin y desde el directorio donde se encuentre la copia de un repo git, ejecútalo de esta manera:
# uptogit <ficheros>
@crittermike
crittermike / wget.sh
Last active March 26, 2024 22:49
Download an entire website with wget, along with assets.
# One liner
wget --recursive --page-requisites --adjust-extension --span-hosts --convert-links --restrict-file-names=windows --domains yoursite.com --no-parent yoursite.com
# Explained
wget \
--recursive \ # Download the whole site.
--page-requisites \ # Get all assets/elements (CSS/JS/images).
--adjust-extension \ # Save files with .html on the end.
--span-hosts \ # Include necessary assets from offsite as well.
--convert-links \ # Update links to still work in the static version.