Skip to content

Instantly share code, notes, and snippets.

🎉
estrenando repositorios privados

Jesus Franco tzkmx

🎉
estrenando repositorios privados
Block or report user

Report or block tzkmx

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@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

@tzkmx
tzkmx / fetchCsrfTooken.ts
Last active May 6, 2020
useCsrfToken hook for csrf token stored in meta of document
View fetchCsrfTooken.ts
import { useRef, useEffect, useState } from 'react'
export function useCsrfToken(cookie: boolean = true): [string, (string) => void] {
const head = useRef(document.head)
const [csrfToken, setCsrfToken] = useState<string>('')
function updateCsrfToken (newToken) {
head.current.getElementsByTagName('meta')['csrf-token'].content = newToken
setCsrfToken(newToken)
}
View GenericValue.php
<?php
namespace App\Generics;
class NamedValue
{
protected $id;
protected $name;
public function __construct(int $id, string $name)
{
@tzkmx
tzkmx / requests-async-sequential.ts
Last active Apr 21, 2020
Learning to use iterable of fetch Promises
View requests-async-sequential.ts
interface MiniRequest {
url: string
body?: any
}
async function runSeq(requests: MiniRequest[]) {
for await (const result of buildIterable(requests)) {
console.log(result)
}
}
@tzkmx
tzkmx / Migration.php
Created Apr 17, 2020
Dynamic model table name
View Migration.php
<?php
use Illuminate\Database\Eloquent\Model;
class Migration extends Model
{
public function getTable()
{
$ns = config('ns.ns');
return (empty($ns)
? ''
@tzkmx
tzkmx / wp_verify_auth_cookie.php
Created Mar 10, 2020
WIP: verify wordpress cookie "outside" wordpress
View wp_verify_auth_cookie.php
@tzkmx
tzkmx / reto.js
Last active Feb 8, 2020
advent of code 1
View reto.js
/**
* @since Nodeschool Laboratoria 2020
* @author Karen github.com/akaren29
* @author Jesus github.com/tzkmx
*/
function aQuePisoLlega(instruction) {
return cuantosSube(instruction) - cuantosBaja(instruction)
}
function cuantosSube(inst) {
@tzkmx
tzkmx / UpdatedAfterTrait.php
Created Feb 5, 2020
filter Eloquent Collection higher order with argument
View UpdatedAfterTrait.php
<?php
namespace App\Model;
use Carbon\Carbon;
/**
* Trait UpdatedAfterTrait
* @package App\Model
* @method string getCreatedAtColumn
@tzkmx
tzkmx / FCM.php
Created Jan 9, 2020 — forked from aungwinthant/FCM.php
Firebase Cloud Messaging with Guzzle HTTP Client (Only For Topics)
View FCM.php
<?php
use GuzzleHttp\Client;
class FCM{
protected $endpoint;
protected $topic;
protected $data;
protected $notification;
You can’t perform that action at this time.