Skip to content

Instantly share code, notes, and snippets.

Avatar

Bryan Didur bryandidur

View GitHub Profile
@bryandidur
bryandidur / typescript-generics.md
Created Feb 15, 2020
Examples of Typescript Generics
View typescript-generics.md
/*
|-----------------------------------------------------
| Example 1: basic use of generics
|-----------------------------------------------------
| 'T' represents a dinamyc type passed to the function
|
*/
// function identity<T>(arg: T): T {
//   return arg;
@bryandidur
bryandidur / overwriting-terminal-output.md
Last active Sep 19, 2019
Overwriting Terminal Output PHP
View overwriting-terminal-output.md
/**
 * Print a text and overwrite it (on the output) on a next call (terminal use only).
 *
 * @param  string $text
 * @return void
 */
function print_overwriting(string $text): void
{
    static $isFirstCall = true;
@bryandidur
bryandidur / laravel-commands-scheduling.md
Last active Aug 27, 2019
Examples on how to schedule Laravel commands passing arguments & options
View laravel-commands-scheduling.md

Passing arguments

$schedule->command('namespace:command-name', ['arg1', 'arg2'])->everyMinute();

Passing options

$schedule->command('namespace:command-name', ['--option1', '--option2'])->everyMinute();

Auto scheduling (The command scheduling itself)

@bryandidur
bryandidur / file-input.md
Last active Sep 16, 2019
File input validation Vue component
View file-input.md
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Client LAB</title>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.10/vue.min.js"></script>
</head>
<body>
@bryandidur
bryandidur / model-component.md
Last active Sep 16, 2019
Vue model between component
View model-component.md
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Client LAB</title>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.10/vue.min.js"></script>
</head>
<body>
@bryandidur
bryandidur / swipeable.md
Last active Jun 2, 2019
Swipe Callback Vue Component
View swipeable.md

Add the Hammer JS library to your project (https://hammerjs.github.io)

<script src="http://hammerjs.github.io/dist/hammer.min.js"></script>

Code

@bryandidur
bryandidur / animated-text.md
Last active May 27, 2019
Animated Text Vue Component
View animated-text.md

Add the Animate CSS library to your project (https://daneden.github.io/animate.css/)

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.0/animate.min.css">

Code

@bryandidur
bryandidur / pulse-button.md
Last active May 27, 2019
Pulse Button Vue Component
View pulse-button.md

Code

Vue.component('pulse-button', {
    props: {
        text: {
            type: String,
            default: '',
        },
        classes: {
View git-basic-commands.md

1) Initialize a GIT repository

cd /path/to/your/project

git init

2) Add files to the 'staging area'

git add `filename.ext` // Add a single file