Skip to content

Instantly share code, notes, and snippets.

View tzkmx's full-sized avatar
🎉
estrenando repositorios privados

Jesus Franco tzkmx

🎉
estrenando repositorios privados
View GitHub Profile
@tzkmx
tzkmx / .js
Created March 11, 2021 01:15 — forked from dusterio/.js
Decrypting Laravel's session cookie with JavaScript and Cloudflare
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
const string2buffer = string => {
let tempArray = new Uint8Array(string.length)
for(let i = string.length; i--) tempArray[i] = string.charCodeAt(i)
return tempArray.buffer
}
@tzkmx
tzkmx / function.json
Last active March 9, 2021 00:27
Simple static response for Azure Function LetsEncrypt Domain Verification
{
"bindings": [
{
"authLevel": "Anonymous",
"type": "httpTrigger",
"direction": "in",
"name": "req",
"route": ".well-known/acme-challenge/{hash}",
"methods": [
"get"
@tzkmx
tzkmx / b58.php
Created March 6, 2021 11:18
experimentos base58
<?php
define('ALPHABET', '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz');
function numT58($num)
{
$acc = '';
while ($num >= 58) {
$mod = $num % 58;
$num = intval(floor($num / 58));
@tzkmx
tzkmx / enableHttpVerbs.xml
Last active April 29, 2021 04:48
examples azure web app configuration extension
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<location path="" xdt:Locator="Match(path)">
<system.webServer>
<handlers>
<add name="PHP74x86_via_FastCGI" xdt:Locator="Match(name)" verb="GET,HEAD,POST,PUT,DELETE,PATCH" xdt:Transform="SetAttributes(verb)" />
</handlers>
</system.webServer>
</location>
</configuration>
@tzkmx
tzkmx / ResponsiveImage.jsx
Created December 2, 2020 08:33
custom responsive picture item using pixboost service
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 November 25, 2020 06:23
Generated by SassMeister.com.
@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 May 13, 2021 05:02
useCountdown hook
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 November 9, 2020 05:41
WeakSet as potential call stack overflow prevention?
// 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 October 15, 2020 22:48
Background Push Notification
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 August 20, 2020 00:09
Sequelize Migration With Updates
'use strict';
const tags = {
Negocios: 'business',
Social: 'social',
Familiar: 'familiar',
Personal: 'personal'
};
module.exports = {