Skip to content

Instantly share code, notes, and snippets.

View sahibalejandro's full-sized avatar
😎
Doing cool stuff!

Sahib sahibalejandro

😎
Doing cool stuff!
View GitHub Profile
@sahibalejandro
sahibalejandro / script.sh
Last active September 13, 2023 06:38
Generate PFX file from Let's Encrypt PEM files for Azure Application Service
# STEP 1
# Frist, generate PEM files using certbot docker image
docker run --rm -it -v ".:/etc/letsencrypt" certbot/certbot certonly --manual --preferred-challenges dns -d "domain.com" -d "*.domain.com"
# Follow the certbot instructions
# Remember that multiple TXT records with the same host are allowed
# so you can add TXT record for naked and wildcard validations.
# STEP 2
# Generate FPX file using Ubuntu docker image
@sahibalejandro
sahibalejandro / addBusinessTime.js
Created August 31, 2019 08:20
Business Time Challenge
function addBusinessTime(holiday, time, duration) {
let finalTime = new Date(time.getTime());
finalTime.setSeconds(finalTime.getSeconds() + duration);
// First lets cover all possible cases when the start time is before the
// holiday start.
if (time.getTime() <= holiday.start.getTime()) {
// If duration is negative or final time still before the holiday starts
// then there is nothing to do, simply return the final time.
if (duration <= 0 || (finalTime.getTime() <= holiday.start.getTime())) {
@sahibalejandro
sahibalejandro / vue-form-object-custom-axios.js
Created October 1, 2018 16:13
Form Object: Attach custom axios instance.
import axios from 'axios';
import Form from 'form-object';
axios.defaults.headers.common['Authorization'] = AUTH_TOKEN;
Form.defaults.axios = axios;
@sahibalejandro
sahibalejandro / init.vim
Last active October 17, 2018 04:42
nvim config file
call plug#begin()
" Editing
Plug 'mattn/emmet-vim'
Plug 'tpope/vim-surround'
Plug 'jiangmiao/auto-pairs'
Plug 'easymotion/vim-easymotion'
Plug 'sgur/vim-editorconfig'
" Code completion
Plug 'sahibalejandro/vim-php'
<!-- Assign a class when the error is present -->
<input type="email" v-model="user.email" :class="{ 'has-error': form.errors.has('email') }" />
<!-- Display the error message when it's present -->
<p class="error" v-show="form.errors.has('email')" v-text="form.errors.get('email')"></p>
<div class="progress">
<div class"progress-bar" :style="{ width: form.progress + '%' }"></div>
</div>
<button type="submit" :disabled="form.isPending">Submit</submit>
<template>
<form @submit.prevent="submit">
<input type="email" v-model="user.email"/>
</form>
</template>
<script>
import Form from 'form-object';
export default {
@sahibalejandro
sahibalejandro / macvim-font-smoothing.sh
Last active December 15, 2016 22:59
MacVim font smoothing
defaults write org.vim.MacVim AppleFontSmoothing -int 0
@sahibalejandro
sahibalejandro / Emails.php
Created June 14, 2016 22:02
Trait for test emails using mailcatcher
<?php
namespace App\Testing;
use GuzzleHttp\Client;
trait Emails
{
/**
* Assert last email from mailcatcher is sent from a specified address.