// jQuery
$(document).ready(function() {
// code
})
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (process.client) { | |
| if (window.Conekta) { | |
| window.Conekta.setPublicKey('key_AVyNyZZdY5AsiEEvhpm5crA') | |
| } | |
| } | |
| export default class ConektaService { | |
| static createToken (tokenParams) { | |
| const response = new Promise((resolve, reject) => { | |
| if (!window.Conekta.card.validateNumber(tokenParams.card.number)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function base64ToImage($imageData, $path){ | |
| $data = 'data:image/png;base64,AAAFBfj42Pj4'; | |
| list($type, $imageData) = explode(';', $imageData); | |
| list(,$extension) = explode('/',$type); | |
| list(,$imageData) = explode(',', $imageData); | |
| $fileName = uniqid().'.'.$extension; | |
| $imageData = base64_decode($imageData); | |
| file_put_contents($path."/".$fileName, $imageData); | |
| return $fileName; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Example to refresh tokens using https://github.com/auth0/node-jsonwebtoken | |
| * It was requested to be introduced at as part of the jsonwebtoken library, | |
| * since we feel it does not add too much value but it will add code to mantain | |
| * we won't include it. | |
| * | |
| * I create this gist just to help those who want to auto-refresh JWTs. | |
| */ | |
| const jwt = require('jsonwebtoken'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import fs from 'fs' | |
| import streamifier from 'streamifier' | |
| import cloudinary from 'cloudinary' | |
| cloudinary.config({ | |
| cloud_name: process.env.CLOUDINARY_NAME, | |
| api_key: process.env.CLOUDINARY_API_KEY, | |
| api_secret: process.env.CLOUDINARY_API_SECRET | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import fs from 'fs' | |
| const $app = process.env.APP_PATH | |
| const $src = process.env.SRC_PATH | |
| export function view(path) { | |
| const file = `${$app}/views/${path}.pug` | |
| if (fs.existsSync(file)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function toBytes(value){ | |
| var unit = value.substr(-2) | |
| var size = value.replace(unit, '') | |
| var result | |
| switch(unit){ | |
| case 'kb': result = size * 1000; break; | |
| case 'mb': result = size * 1000000; break; | |
| case 'gb': result = size * 1000000000; break; | |
| case 'tb': result = size * 1000000000000; break; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| window.addEventListener('load', function(){ | |
| forms = document.getElementsByTagName('form') | |
| for (form of forms) { | |
| form.addEventListener('keydown', function(e) { | |
| if (e.keyCode == 13 && e.metaKey) { | |
| $button = form.querySelector('button[type="submit"]') | |
| $button.click() | |
| return false | |
| } | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $screen-xs-max: 480px | |
| $screen-sm-min: 481px | |
| $screen-sm-max: 960px | |
| $screen-md-min: 961px | |
| $screen-md-max: 1280px | |
| $screen-lg-min: 1281px | |
| @mixin xs($max-width: true) | |
| @if $max-width | |
| @media only screen and (max-width: $screen-xs-max) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .col { | |
| -webkit-box-flex: 1; | |
| -ms-flex-positive: 1; | |
| flex-grow: 1; | |
| -ms-flex-preferred-size: 0; | |
| flex-basis: 0; | |
| max-width: 100%; | |
| } | |
| .start-xs { |