Skip to content

Instantly share code, notes, and snippets.

View cvega93's full-sized avatar
🎯
Growth hacker

Cristian Vega cvega93

🎯
Growth hacker
  • Talently
  • Lima
View GitHub Profile
@cvega93
cvega93 / messagebirdWhatsapp.php
Last active February 11, 2021 16:49
Send Whatsapp with Messagebird & ActiveCampaign Example - PHP
<?php
namespace App\Http\Services\User;
//Service Base
use App\Http\Services\ServiceBase;
use Illuminate\Support\Facades\Log;
/**
* Handles complex login and uses the model repo to connect to the db
Conectar Mysql a Datastudio con MySql remote connection
#Modificar la configuración de Mysql para escuchar cualquier IP
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
#Busca:
bind-address = 127.0.0.1
#Cambialo por
@cvega93
cvega93 / sitemapGenerator.js
Created October 12, 2019 22:52
Links generator for @nuxtjs/sitemap
env_file = process.env.NODE_ENV ? process.env.NODE_ENV: 'local';
const env = require('./enviroments/'+env_file);
const axios = require('axios');
var routes;
let generatePlaces = async function () {
// Rutas a generar
@cvega93
cvega93 / deploy_git.sh
Last active May 28, 2020 16:22 — forked from raco/deploy_git.sh
Easy automatic deploy bash for dummies
#!/bin/sh
projectname=$1;
#Para usar ejecutar sh deploy_git.sh [Nombre proyecto] [Scripts a ejecutar luego de deploy]
cd /var/www;
mkdir $projectname;
cd /var;
mkdir repo;
cd repo;
@cvega93
cvega93 / stars.vue
Created March 26, 2019 17:40
Stars component for Vue.js
<template>
<span>
<slot name="ratio"></slot>
<i class="fa fa-star" aria-hidden="true" v-for="(i, index) in completeStarts()" :key="index"></i>
<i class="fa fa-star-half-o" aria-hidden="true" v-if="haveHalfStart()"></i>
<i class="fa fa-star-o" aria-hidden="true" v-for="(x, index) in incompleteStarts()" :key="index + 5"></i>
<slot></slot>
</span>
</template>
@cvega93
cvega93 / topaste.html
Created March 7, 2019 02:54
Translate Leadpages countdown to any language
<script>
//Paste this in After Body
//Search labels
const labels = document.querySelectorAll('.time-name');
//Setup labels translated
let translation = ['Días', 'Horas','Minutos','Segundos'];
labels.forEach(function (label, index) {
//Replace each label
label.innerHTML = translation[index];
@cvega93
cvega93 / topaste.html
Created March 7, 2019 02:54
Translate Leadpages countdown to any language
<script>
//Paste this in After Body
//Search labels
const labels = document.querySelectorAll('.time-name');
//Setup labels translated
let translation = ['Días', 'Horas','Minutos','Segundos'];
labels.forEach(function (label, index) {
//Replace each label
label.innerHTML = translation[index];
@cvega93
cvega93 / allowCrossdomain.php
Last active February 20, 2019 19:05
Headers for crossdomain requests in PHP + Options validation. [Solve CORS error]
<?php
if (isset($_SERVER['HTTP_ORIGIN'])) {
// Decide if the origin in $_SERVER['HTTP_ORIGIN'] is one
// you want to allow, and if so:
header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
header('Access-Control-Allow-Credentials: true');
header('Access-Control-Max-Age: 86400'); // cache for 1 day
}
// Access-Control headers are received during OPTIONS requests
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
@cvega93
cvega93 / Integración de Culqi.js con VueJs y Nuxt.js
Last active July 14, 2020 16:15 — forked from hawkapparel/Integración de Culqi.js con VueJs y Nuxt.js
Integración de Culqi.js con VueJs y Nuxt.js - Actualizado 14/02/2019
/*
Actualizado al 14/02/2019
Consultas a v.cristianalfredo@gmail.com
*/
/* RECIBE LA RESPUESTA DE CULQI Y LA GUARDA EN UNA VARIABLE GLOBAL */
if(process.browser) {
window.culqi = function () {
window.__culqi_token = window.Culqi
};
@cvega93
cvega93 / facebook_sdk_helper.js
Created August 2, 2018 20:59
Promise based SDK Module
export default class {
constructor(options) {
this.req_scope = ['email', 'birth_day'];
this.scope = ['email'];
this.options = options;
if (process.browser) {
this._initFacebookSDK();
window.fbAsyncInit = function onSDKInit() {
FB.init(options);
FB.AppEvents.logPageView();