This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import math | |
import fractions | |
def pi_fraction(gap): | |
"""Print the fraction within gap of pi that has the smallest denominator. | |
>>> pi_fraction(0.01) | |
22 / 7 = 3.142857142857143 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createStore, combineReducers, Reducer } from "redux"; | |
/////////////////////////////////////////////////////////////////////// | |
// action types | |
// first, define all the action types | |
const ADD_TODO = "ADD_TODO"; | |
const COMPLETE_TODO = "COMPLETE_TODO"; | |
const REMOVE_TODO = "REMOVE_TODO"; | |
const SET_VISIBILITY_FILTER = "SET_VISIBILITY_FILTER"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Searchbar</title> | |
<script type="module" src="https://cdn.jsdelivr.net/npm/@ionic/core@4.11.10/dist/ionic/ionic.esm.js"></script> | |
<script nomodule src="https://cdn.jsdelivr.net/npm/@ionic/core@4.11.10/dist/ionic/ionic.js"></script> | |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@ionic/core@4.11.10/css/ionic.bundle.css"/> | |
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* | |
This is an F# interactive script to generate a JWT. You can use it as a reference for when you are generating JWT on | |
your server for a client, for example. It is hard coded for symmetric signing (HS256), but can be modified for | |
asymmetric signing RS256, see notes. | |
*) | |
#r "nuget: System.IdentityModel.Tokens.Jwt" | |
open System | |
open System.Text // for Encoding | |
open System.IdentityModel.Tokens.Jwt // For JwtSecurityToken (Install it from Nuget) | |
open System.Security.Claims // For Claim, ClaimTypes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Below are two tokens to be used with the article "JWT Authentication and Authorization for your | |
# Giraffe API" at https://carpenoctem.dev/blog/fsharp-giraffe-jwt-auth/ | |
# {"alg":"HS256","typ":"JWT"} | |
# { | |
# "CustomClaim": "value", | |
# "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name": "Jane Adminton", | |
# "http://schemas.microsoft.com/ws/2008/06/identity/claims/role": "Admin", | |
# "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/dateofbirth": "2003/10/31", | |
# "exp": 1705468508, |