Skip to content

Instantly share code, notes, and snippets.

View yayoc's full-sized avatar
🌏
🚨🐠☄️🌈ॐ؞ৢ؞ؙؖ⁽⁾🧤🐠☄️˜ัิีึื์๎้็๋๊⦁ ☀️🐘ཫ་῍̩̖̬ ̎ ̎✧🌺ᕦ(;*Σ📊⏣ OO📼🍄●⦁   ●  ⦁  ●

yayoc yayoc

🌏
🚨🐠☄️🌈ॐ؞ৢ؞ؙؖ⁽⁾🧤🐠☄️˜ัิีึื์๎้็๋๊⦁ ☀️🐘ཫ་῍̩̖̬ ̎ ̎✧🌺ᕦ(;*Σ📊⏣ OO📼🍄●⦁   ●  ⦁  ●
View GitHub Profile
@sholsinger
sholsinger / inArray.vbs
Created April 26, 2011 20:52
VBScript tool for checking if a value is in an array.
' returns the index of obj in array. obj can be anything. Returns -1 if not found.
Function inArray(arr, obj)
On Error Resume Next
Dim x: x = -1
If isArray(arr) Then
For i = 0 To UBound(arr)
If arr(i) = obj Then
x = i
Exit For
@gabro
gabro / validation.flow.js
Last active February 24, 2020 16:38
Dynamic object validation using $ObjMap in Flow
/* @flow */
// A simplified representation of types using phantom types (so that we store the Type information both at value and type level)
class Type<T> {};
class StringT extends Type<string> {}
class NumberT extends Type<number> {}
// A schema for a User
const User = {
name: new StringT(),
@megamaddu
megamaddu / scroll-manager.js
Last active May 9, 2021 14:17
Scroll Manager for React Router v4
import React from 'react'
import { func, node, number, object, shape, string } from 'prop-types'
import { withRouter } from 'react-router'
import debounceFn from 'lodash/debounce'
class ScrollManager extends React.Component {
static propTypes = {
children: node.isRequired,
history: shape({
action: string.isRequired,
@fabrizioc1
fabrizioc1 / akamai_debug_headers.txt
Last active May 24, 2023 08:23
Akamai debug headers
Pragma: akamai-x-cache-on, akamai-x-cache-remote-on, akamai-x-check-cacheable, akamai-x-get-cache-key, akamai-x-get-extracted-values, akamai-x-get-nonces, akamai-x-get-ssl-client-session-id, akamai-x-get-true-cache-key, akamai-x-serial-no
@creationix
creationix / jsonparse.js
Created February 13, 2012 23:20
event-only version of jsonparse
// Named constants with unique integer values
var C = {};
// Tokenizer States
var START = C.START = 0x11;
var TRUE1 = C.TRUE1 = 0x21;
var TRUE2 = C.TRUE2 = 0x22;
var TRUE3 = C.TRUE3 = 0x23;
var FALSE1 = C.FALSE1 = 0x31;
var FALSE2 = C.FALSE2 = 0x32;
var FALSE3 = C.FALSE3 = 0x33;
@suicide
suicide / artifactory-get.sh
Last active September 10, 2023 14:27
Downloads latest artifact version from artifactory
#!/bin/bash
# downloads latest version of an artifact from artifactory
set -e
usage(){
echo "Usage: $*" >&2
exit 64
}
@sgronblo
sgronblo / Roman.hs
Last active January 7, 2024 18:23
Roman numeral parser in Haskell using Parsec
#!/usr/bin/env stack
-- stack --resolver lts-7.9 --install-ghc script --package QuickCheck --package either --package parsec
module Roman where
import Control.Applicative hiding ((<|>))
import Data.Either.Combinators
import Text.Parsec.Prim
import Text.Parsec.Combinator
import Text.Parsec.Error
@sebmarkbage
sebmarkbage / Enhance.js
Last active January 31, 2024 18:33
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
@chrismdp
chrismdp / s3.sh
Last active March 5, 2024 12:57
Uploading to S3 in 18 lines of Shell (used to upload builds for http://soltrader.net)
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
{
path=$1
@soulmachine
soulmachine / jwt-expiration.md
Last active April 9, 2024 04:12
How to deal with JWT expiration?

First of all, please note that token expiration and revoking are two different things.

  1. Expiration only happens for web apps, not for native mobile apps, because native apps never expire.
  2. Revoking only happens when (1) uses click the logout button on the website or native Apps;(2) users reset their passwords; (3) users revoke their tokens explicitly in the administration panel.

1. How to hadle JWT expiration

A JWT token that never expires is dangerous if the token is stolen then someone can always access the user's data.

Quoted from JWT RFC: