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
test("should print hello world", () => { | |
// Run the hello command and capture the output | |
const output = childProcess.execSync(`tcli hello`, { | |
encoding: "utf8", | |
}); | |
// Check that the output is correct | |
expect(output).to.equal("Hello, World!\n"); | |
}); |
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 { before, after, test } from "mocha"; | |
import * as path from "path"; | |
import * as childProcess from "child_process"; | |
before(() => { | |
childProcess.execSync(`npm install -g`, { cwd: path.join(__dirname, "..") }); | |
console.log("Installed CLI"); | |
}); | |
after(() => { |
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
export NVM_DIR="$HOME/.nvm" | |
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm | |
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion |
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
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh|bash |
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
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh|bash |
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 requests | |
class HashnodePoster: | |
def __init__(self, token, domain): | |
self._token = token | |
self._endpoint = "https://api.hashnode.com" | |
self._domain = domain | |
self._headers = {"Authorization": self._token} | |
self._session = self._create_hashnode_session() |
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 requests | |
class DevtoPoster: | |
def __init__(self, token, domain): | |
self._token = token | |
self._domain = domain | |
self._endpoint = "https://dev.to/api/" | |
self._headers = { | |
"Accept": "application/json", | |
"api-key": self._token, |
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
medium_post_content_html = markDownToHtml(medium_markdown_content) | |
medium = MediumPoster(MEDIUM_TOKEN, domain) | |
medium_url = medium.create_post_medium( | |
title, | |
medium_post_content_html, | |
canonicalUrl=wp_post_url, | |
tags=tags) | |
print(f'Find Medium Post: {medium_url}') |
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
def create_post_medium( | |
self, | |
title, | |
content, | |
publish_status="draft", | |
contentFormat="html", | |
tags=[], | |
notifyFollowers = False, | |
canonicalUrl=None | |
): |
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
def getUserID(self): | |
response = self._session.get(f"{self._endpoint}me") | |
if response.status_code == 200: | |
return response.json()["data"]["id"] | |
else: | |
print("Error while retreiving user id") | |
print(response) |
NewerOlder