-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
211 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
title: social-embeds | ||
author: Mark Sellors | ||
version: 0.0.2 | ||
contributes: | ||
shortcodes: | ||
- gists.lua | ||
- loom.lua | ||
- twitter.lua | ||
- vimeo.lua | ||
- youtube.lua | ||
- mastodon.lua |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
function gist(args) | ||
if quarto.doc.isFormat('html') then | ||
local user = pandoc.utils.stringify(args[1]) | ||
local gist_id = pandoc.utils.stringify(args[2]) | ||
local file_fragment = '' | ||
if args[3] ~= nil then | ||
local file = pandoc.utils.stringify(args[3]) | ||
file_fragment = '?file=' .. file | ||
end | ||
|
||
-- Assemble HTML to be returned | ||
local html = '<script src="https://gist.github.com/' | ||
.. user | ||
.. '/' | ||
.. gist_id | ||
.. '.js' | ||
.. file_fragment | ||
.. '"></script>' | ||
|
||
return pandoc.RawInline('html', html) | ||
else | ||
return pandoc.Null() | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
function loom(args) | ||
if quarto.doc.isFormat('html') then | ||
local videoid = pandoc.utils.stringify(args[1]) | ||
|
||
-- Assemble HTML to be returned | ||
local html = '<div style="position: relative; padding-bottom: 56.25%; height: 0;"><iframe src="https://www.loom.com/embed/' | ||
.. videoid | ||
.. '" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></iframe></div>' | ||
|
||
return pandoc.RawInline('html', html) | ||
else | ||
return pandoc.Null() | ||
end | ||
end | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
function mastodon(args) | ||
if quarto.doc.isFormat('html') then | ||
local status_url = pandoc.utils.stringify(args[1]) | ||
print(status_url) | ||
-- Assemble HTML to be returned | ||
local html = '<div style="position: relative;"> <iframe src="'.. status_url ..'/embed" class="mastodon-embed" style="max-width: 100%; border: 0;" width="100%" height="500" allowfullscreen="allowfullscreen"></iframe><script src="https://mastodon.social/embed.js" async="async"></script></div> ' | ||
|
||
return pandoc.RawInline('html', html) | ||
else | ||
return pandoc.Null() | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
local function ensureHtmlDeps() | ||
quarto.doc.addHtmlDependency({ | ||
name = 'twitter', | ||
version = '0.0.1', | ||
scripts = { | ||
{ | ||
path = "", | ||
attribs = {src="https://platform.twitter.com/widgets.js"}, | ||
afterBody = true | ||
} | ||
} | ||
}) | ||
end | ||
|
||
local function isEmpty(s) | ||
return s == nil or s == '' | ||
end | ||
|
||
function tweet(args, kwargs) | ||
if quarto.doc.isFormat('html') then | ||
ensureHtmlDeps() | ||
|
||
if isEmpty(args[1]) then | ||
user = pandoc.utils.stringify(kwargs["user"]) | ||
status_id = pandoc.utils.stringify(kwargs["id"]) | ||
else | ||
user = pandoc.utils.stringify(args[1]) | ||
status_id = pandoc.utils.stringify(args[2]) | ||
end | ||
|
||
-- Assemble the twitter oembed API URL from the user inputs | ||
local tweet_embed = 'https://publish.twitter.com/oembed?url=https://twitter.com/' | ||
.. user | ||
.. '/status/' | ||
.. status_id | ||
.. '&align=center' | ||
|
||
print(tweet_embed) | ||
|
||
local mt, api_resp = pandoc.mediabag.fetch(tweet_embed) | ||
|
||
-- generate a random number to append to the html div ID to avoid re-use | ||
local id = math.random(10000, 99999) | ||
|
||
local tweet_data = '<div id="tweet-' | ||
.. id | ||
.. '"></div><script>tweet=' | ||
.. api_resp | ||
.. ';document.getElementById("tweet-' | ||
.. id | ||
.. '").innerHTML = tweet["html"];</script>' | ||
|
||
return pandoc.RawInline('html', tweet_data) | ||
else | ||
return pandoc.Null() | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
function vimeo(args) | ||
if quarto.doc.isFormat('html') then | ||
local videoid = pandoc.utils.stringify(args[1]) | ||
|
||
-- Assemble HTML to be returned | ||
local html = '<div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;"> <iframe src="https://player.vimeo.com/video/' | ||
.. videoid | ||
.. '" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" title="vimeo video" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> </div> ' | ||
|
||
return pandoc.RawInline('html', html) | ||
else | ||
return pandoc.Null() | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
function youtube(args) | ||
if quarto.doc.isFormat('html') then | ||
local videoid = pandoc.utils.stringify(args[1]) | ||
|
||
-- Assemble HTML to be returned | ||
local html = '<div id="youtube-frame" style="position: relative; padding-bottom: 56.25%; /* 16:9 */ height: 0;"><iframe width="100%" height="" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;" src="https://www.youtube.com/embed/' | ||
.. videoid | ||
.. '" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div>' | ||
|
||
return pandoc.RawInline('html', html) | ||
else | ||
return pandoc.Null() | ||
end | ||
end |
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
title: "工具箱" | ||
description: "这些工具解决了我的一些问题" | ||
--- | ||
|
||
# 资源管理 | ||
|
||
- RoyalTSX | ||
- Dokpoly | ||
- PicList/PicGo | ||
|
||
# 内容创作 | ||
|
||
- Bear | ||
- DEVONthink | ||
|
||
# 阅读 | ||
|
||
- wewe-rss | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
title: "$GRASS空投中的教训" | ||
date: "" | ||
categories: ["crypto"] | ||
--- | ||
|
||
在$GRASS开放领取前一天, 专门设置了提醒, 想在第一时间领, 提, 卖. | ||
|
||
![设置领取提醒](https://image.luozx.org/garden/46eeef46db3207d57b6b111e7142f93c) | ||
|
||
在开始领取之前有网络肯定会拥堵的心里预期, 但是没想到除了拥堵之外, 还有其他意外. | ||
|
||
虽然最终也领取到了, 但是这中间做了一些调整和教训, 完全可以复用在其他项目上. | ||
|
||
# Solscan无法直接合约调用 | ||
|
||
在领取失败后, 第一反应是去solscan上找对应合约, 从合约接口调用而不是通过Web页面. | ||
|
||
花了很长时间才发现Solana和Ethereum的不同, 在区块链浏览器上没办法看到合约代码, 也不能直接调用合约. | ||
|
||
# 优先使用私有网络 | ||
|
||
没办法通过直接调用合约接口, 就转向更换私有网络. | ||
一开始在Phantom上一直在寻找添加私有网络的地方. | ||
后来才发现Phantom并不支持添加私有网络.由于[安全原因](https://www.reddit.com/r/solana/comments/1afbb2p/comment/kqtr28w/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button)取消了此功能 | ||
|
||
|
||
# 准备备份钱包 | ||
|
||
开放空投没多久后, Phantom竟然宕机了: | ||
|
||
{{< tweet SolanaFloor 1850898928151175571 >}} | ||
|
||
|
||
在更换备份钱包, 使用私有网络后, 领取和转帐都很轻松就完成了. | ||
|
||
# Bottom Line | ||
|
||
人少的网络, 可能的接近合约接口的交互(脚本/直接调用接口) | ||
能够给最大限度增加领取成功的速度. |
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