Skip to content

Instantly share code, notes, and snippets.

Avatar
🎉
estrenando repositorios privados

Jesus Franco tzkmx

🎉
estrenando repositorios privados
View GitHub Profile
@tzkmx
tzkmx / ResponsiveImage.jsx
Created Dec 2, 2020
custom responsive picture item using pixboost service
View ResponsiveImage.jsx
import React from 'react'
const host = 'https://media.jefrancomix.work'
const apiKey = 'pixboost'
const imageBoosted = (relativeUrl, resize = false) => {
return 'https://pixboost.com/api/2/img/' +
host +
relativeUrl +
(resize
@tzkmx
tzkmx / input.scss
Created Nov 25, 2020
Generated by SassMeister.com.
View input.scss
@mixin full-height {
height: 100%;
margin: 0;
}
@mixin flex-center-x-y {
display: flex;
justify-content: center;
align-items: center;
}
html, body {
@tzkmx
tzkmx / Countdown.jsx
Last active Nov 24, 2020
useCountdown hook
View Countdown.jsx
import React from 'react'
import { useCountdown } from 'hooks/useCountdown'
export function Countdown ({ launch }) {
const { days, hours, minutes, seconds } = useCountdown(launch)
return (
<div className='Countdown'>
<div className='count'>
<div className='time D'>&nbsp;{days}</div>
@tzkmx
tzkmx / weakset-refs.js
Created Nov 9, 2020
WeakSet as potential call stack overflow prevention?
View weakset-refs.js
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet
// Execute a callback on everything stored inside an object
function execRecursively(fn, subject, _refs = null){
if(!_refs)
_refs = new WeakSet();
// Avoid infinite recursion
if(_refs.has(subject))
return;
@tzkmx
tzkmx / notification-handler.java
Last active Oct 15, 2020
Background Push Notification
View notification-handler.java
public class NotificationService extends FirebaseMessagingService {
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);
Notification notification = new NotificationCompat.Builder(this)
.setContentTitle(remoteMessage.getData().get("title"))
.setContentText(remoteMessage.getData().get("body"))
.setSmallIcon(R.mipmap.ic_launcher)
.build();
NotificationManagerCompat manager = NotificationManagerCompat.from(getApplicationContext());
@tzkmx
tzkmx / sequelize-migration-with-updates.js
Created Aug 20, 2020
Sequelize Migration With Updates
View sequelize-migration-with-updates.js
'use strict';
const tags = {
Negocios: 'business',
Social: 'social',
Familiar: 'familiar',
Personal: 'personal'
};
module.exports = {
View listFiles.js
const minio = require('minio')
const config = {
endPoint: 'XXXX.digitaloceanspaces.com',
port: 443,
useSSL: true,
accessKey: 'XXXXX',
secretKey: 'XXXXXX'
}
@tzkmx
tzkmx / .env.example
Last active Jun 25, 2020
Minimal sending of Laravel Emails
View .env.example
MAIL_DRIVER=smtp
MAIL_HOST=smtp.sendgrid.net
MAIL_PORT=587
MAIL_USERNAME=apikey
MAIL_PASSWORD=SG.xxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxx
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="hey@example.net"
MAIL_FROM_NAME="Hey Dude/tte"
@tzkmx
tzkmx / middleware.php
Last active May 28, 2020
Guzzle Middleware debug Headers & Body on Request and Response
View middleware.php
<?php
use GuzzleHttp\Client;
use GuzzleHttp\Handler\CurlHandler;
use GuzzleHttp\Handler\CurlMultiHandler;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Middleware;
use Illuminate\Support\Facades\Log;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
@tzkmx
tzkmx / attention.md
Last active May 28, 2020
Monitoreo reproducción video a los 5 segundos (Google Tag Manager, play event at 5 seconds started)
View attention.md

Real event analytics is fired by platform tag (Universal Analytics)

  • uses custom Data Layer Variables set by monitor script
  • uses custom event, verifies category is set to value by monitor
  • only invoked once

LICENSE: WTFPL

You can’t perform that action at this time.