Skip to content

Instantly share code, notes, and snippets.

Avatar
🎉
estrenando repositorios privados

Jesus Franco tzkmx

🎉
estrenando repositorios privados
View GitHub Profile
@tzkmx
tzkmx / .js
Created Mar 11, 2021 — forked from dusterio/.js
Decrypting Laravel's session cookie with JavaScript and Cloudflare
View .js
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 Mar 9, 2021
Simple static response for Azure Function LetsEncrypt Domain Verification
View function.json
{
"bindings": [
{
"authLevel": "Anonymous",
"type": "httpTrigger",
"direction": "in",
"name": "req",
"route": ".well-known/acme-challenge/{hash}",
"methods": [
"get"
@tzkmx
tzkmx / b58.php
Created Mar 6, 2021
experimentos base58
View b58.php
<?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 Apr 29, 2021
examples azure web app configuration extension
View enableHttpVerbs.xml
<?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 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 = {