Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View dacastro4's full-sized avatar
:shipit:
Focusing

Daniel Castro dacastro4

:shipit:
Focusing
View GitHub Profile
@dacastro4
dacastro4 / helpers.php
Created December 19, 2018 18:37
Laravel 5 Helper Methods (PHP 7+)
<?php
/**
* Created by PhpStorm.
* User: danielcastro
* Date: 2/2/17
* Time: 2:06 PM
*
* Place under app/paht/to/file folder and add
* "files" : [
* "app/paht/to/file/helpers.php"
@dacastro4
dacastro4 / word-similarity.js
Last active March 28, 2022 18:45
Word Similarity
const editDistance = (s1, s2) => {
s1 = s1.toLowerCase();
s2 = s2.toLowerCase();
const costs = [];
for (let i = 0; i <= s1.length; i++) {
let lastValue = i;
for (let j = 0; j <= s2.length; j++) {
@dacastro4
dacastro4 / FormError.js
Created November 27, 2022 01:56
Laravel Vue Error Handling Class
export default class FormErrors {
errors = []
constructor(errors = []) {
this.errors = errors
}
/**
* Returns the first message from key
*