Skip to content

Instantly share code, notes, and snippets.

View Eseperio's full-sized avatar

E.Alamo Eseperio

View GitHub Profile
@Eseperio
Eseperio / browser-backward-compatibility.md
Created October 12, 2017 16:53
How to enable browser backward compatibility with three words

DON'T DO IT

Making your project browser backward compatible is a big mistake.

Is a big problem for:

Users

They will keep old software running with all security issues that this involve

Developers

They will spend a lot of time and money trying to make something work for a few number of users that does not care about secutity and updates (remember WannaCry and all those XP os running after product EOL ?)

Helpdesk departments

If you accustom to people that even in a IE8 internet works then, when something does not work they will ask the corresponding IT department complaining about why it does not work, spending a lot of human resources and money.

@Eseperio
Eseperio / formFixtureGeneratorTool.js
Last active February 13, 2018 17:14
Creates I->submitForm method from existing form.
/**
* Parse all forms and returns a valid PHP code to use with codeception acceptance tests.
*/
var formFixtureGenerator = {
init: function () {
if (typeof jQuery !== "function") {
console.error("Jquery required");
}
let data = this.extract();
@Eseperio
Eseperio / bullying-php.md
Last active May 4, 2018 11:11
Stop bullying PHP

PHP is good, and let me tell you why.

  • PHP is easy to understand for a newbie. Thanks to that many people that have never been in programming can make real their ideas, and thanks to this you have a lot of services on internet.
  • PHP is getting better everyday and have one of the largest pools of users in the world.
  • Often i heard people talk about how many bugs have, but the reality is that you cannot use only the numbers of bugs as a reference. Other less buggy languages are not. They have not been tested enough to find all the hidden bugs, because the amount of applications that use them is lower.
  • PHP is open source and does not deppend on a corporate that one day can disappear (don´t believe me? Remember Lehman Brothers)

Using a common comparison: Compare a car with a jet. Jet can travel faster, further, but requires a lot of knowledge.

Markdown sample

This is a sample file created to fit my needs in development.

Sometimes

Sometimes you need some words with a different format, like italic or bold, like the first word.

Third header, and overline

Some people think a blockquote is enough to tell something important.

@Eseperio
Eseperio / sample_migration.php
Last active April 2, 2019 16:28
This is an example of a migration to move translated messages from Yii php files to lajax yii2-translate
<?php
use lajax\translatemanager\models\LanguageSource;
use lajax\translatemanager\models\LanguageTranslate;
use yii\db\Migration;
/**
* Class m190402_151021_move_translations_to_db
*/
class m190402_151021_move_translations_to_db extends Migration
@Eseperio
Eseperio / extract-file-extensions-from-wikipedia.js
Last active July 16, 2019 09:34
A snippet to extract all file extension names from wikipedia pages.
/**
* This snippet is used to extract all file extension names from wikipedia pages.
*
* Usage: Copy this snippet and paste on Chrome console. Do it for each extensions page available.
* After that, get the json using `localStorage.getItem('extensions')`
* @see https://en.wikipedia.org/wiki/List_of_filename_extensions
* @type {string}
*/
var memorySlot='extensions';
@Eseperio
Eseperio / all-file-extensions.json
Created July 16, 2019 09:50
List of all file extensions with description (listed on wikipedia) in JSON format.
{
"0": {
"descriptions": [
"Compressed harddisk data"
]
},
"1": {
"descriptions": [
"Fax",
"Roff/nroff/troff/groff source for manual page"
@Eseperio
Eseperio / Logger.js
Last active May 5, 2021 11:27
Simple prefixed javascript logger
export class Logger {
static prefix = "[YourAppNameHere] ";
static log(...args) {
console.log(Logger.prefix, ...args);
}
static warn(...args) {
console.warn(Logger.prefix, ...args);
}
@Eseperio
Eseperio / _auto-color.scss
Last active May 5, 2021 17:56
Css color based on letter.
$alphabet: "1","2","3","4","5","6","7","8","A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z";
$colors: #69d2e7, #a7dbd8, #e0e4cc, #f38630, #fa6900, #fe4365, #fc9d9a, #f9cdad, #c8c8a9, #83af9b, #ecd078, #d95b43, #c02942, #542437, #53777a, #556270, #4ecdc4, #c7f464, #ff6b6b, #c44d58, #774f38, #e08e79, #f1d4af, #ece5ce, #c5e0dc, #e8ddcb, #cdb380, #036564, #033649, #031634, #490a3d, #bd1550, #e97f02, #f8ca00, #8a9b0f, #594f4f, #547980, #45ada8, #9de0ad, #e5fcc2, #00a0b0, #6a4a3c, #cc333f, #eb6841, #edc951, #e94e77, #d68189, #c6a49a, #c6e5d9, #f4ead5, #3fb8af, #7fc7af, #dad8a7, #ff9e9d, #ff3d7f, #d9ceb2, #948c75, #d5ded9, #7a6a53, #99b2b7, #ffffff, #cbe86b, #f2e9e1, #1c140d, #cbe86b, #efffcd, #dce9be, #555152, #2e2633, #99173c, #343838, #005f6b, #008c9e, #00b4cc, #00dffc, #413e4a, #73626e, #b38184, #f0b49e, #
@Eseperio
Eseperio / readme.md
Last active August 26, 2021 08:52
AWS Transcribe JSON to Script with php

Snippet to convert AWS transcribe into a scripted text

Be careful: This script has been created to be used under a command controller in Yii2. 

You can easily port to any php by adapting last three lines