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 / Culqi class para Vue.js
Created February 13, 2018 21:02
Clase para obtener un evento asíncrono de Culqi
<template>
<div class="card">
<form action="#" class="form-monkey form-buy-membreship" id="culqi-card-form">
<div class="row">
<div class="block-form">
<div class="col-sm-6">
<div class="form-group">
<label for="card[email]">Email</label>
<input type="text" class="form-control" placeholder="Correo electrónico"
v-model="user.email"
@cvega93
cvega93 / ratingstars.php
Created February 23, 2018 23:10
Loop rating stars with blade + Google Markup Microdata
//use Fontawesome
@for ($x = 1; $x <= $name->ratingAverage; $x++)
<i class="fa fa-star"></i>
@endfor
@if (strpos($name->ratingAverage, '.'))
<i class="fa fa-star-half-o"></i>
@php
$x++;
@endphp
@endif
@cvega93
cvega93 / acortarUrl.php
Created March 12, 2018 14:57
Acortar enlace con Bitly
$urlCurrent = $_SERVER["REQUEST_SCHEME"] . '://' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
function acortar_url($url)
{
$usuario = "o_89kncra68";
$apikey = "R_4f27f66b97292542888d9530443f2cd4";
$temp = "http://api.bit.ly/v3/shorten?login=" . $usuario . "&apiKey=" . $apikey . "&uri=" . $url . "&format=txt";
return file_get_contents($temp);
}
@cvega93
cvega93 / ubigeos_peru.sql
Created March 16, 2018 15:31
Perú, base de datos de Ciudades, Provincias y Distritos
-- --------------------------------------------------------
-- Host: 127.0.0.1
-- Versión del servidor: 5.7.17-0ubuntu0.16.04.2 - (Ubuntu)
-- SO del servidor: Linux
-- HeidiSQL Versión: 9.4.0.5125
-- --------------------------------------------------------
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
@cvega93
cvega93 / sitemapController.php
Last active April 4, 2018 23:36
Sitemap generation example
# Code example to generate sitemap with https://github.com/dwightwatson/sitemap
<?php
namespace App\Http\Controllers\Admin;
use App\Services\DebateService;
use App\Http\Controllers\Controller;
use App\Services\GroupService;
use App\Services\InvitationService;
@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();
@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 / 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 / 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];