- Go to linear -> Settings -> My Account -> API -> Personal API Keys -> Create New API Key
- Paste the API key in the script
- Download the script and store it in /usr/bin. I recommend to rename it from
issue.py
toissues
- Give executable permissions
chmod +x /usr/bin/
- Go to a repository with a branch name that follows the Linear convention and run
issue
. - The title of the issue should be printed.
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 asyncio | |
from fastapi import FastAPI | |
app = FastAPI() | |
async def some_long_running_task(param): | |
await asyncio.sleep(10) # Simulating a long-running task | |
print(f"Task completed with param: {param}") | |
@app.get("/fire-and-forget/{param}") |
GraphQL is great for exposing a single API that hides the complexity of the systems behind. As such, it is commonly use to aggregate data from different data sources. For example, databases, services, etc.
But most corporate web services are build around RESTful APIs, hence it is crucial to handle this use case efficiently.
Given the reference implementation for GraphQL is written in node and the close relationship between the frontend and the language, it is very popular to use node as the platform for the server.
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
<script type="text/javascript"> | |
var node = document.scripts[document.scripts.length - 1]; | |
var parent = node.parentElement; | |
var iframe = document.createElement('iframe'); | |
iframe.setAttribute('src', 'http://example.com'); | |
iframe.width = '100%'; | |
iframe.frameBorder = 0; | |
parent.insertBefore(iframe, node.nextSibling); | |
window.addEventListener('message', function(e){ iframe.height = e.data }, false); | |
</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
function printName(id) { | |
console.log(this.name + id); | |
} | |
let person = { | |
name: 'Person Marian' | |
}; | |
let human = { | |
name: 'Human Charles' | |
} |
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
// From https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/this | |
let o = { | |
prop: 37, | |
f: function() { | |
return this.prop; | |
} | |
}; | |
console.log(o.f()); // logs 37 |
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
function Animal() { | |
// this points to animal | |
document.addEventListener('click', (e) => { | |
// Unlike regular functions arrow functions takes this from the | |
// outer context so it points to animal as well. | |
console.log(this) | |
}); | |
} | |
let animal = new Animal(); |
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 code doesn't make any sense. | |
// Just for pedagogical purposes. | |
class HelloComponent { | |
constructor(id) { | |
this.button = document.getElementById(id); | |
this.bindLog = this.log.bind(this); | |
// Use the bind version of log. It ties log to the object we are creating. | |
document.addEventListener('click', this.bindLog); | |
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
function LikeButton(id) { | |
this.id = id; | |
} | |
// In this case "this" will point to btn. You can read the function like this: | |
// function LikeButton(id) { | |
// btn.id = id; | |
// return btn; | |
// } | |
let btn = new LikeButton('like-button'); |
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
// Suppose you have an html like: | |
// <div id="like-button"> | |
// <i class"icon-hand" /> | |
// <div>Like</div> | |
// </div> | |
function LikeButton(id) { | |
this.buttonId = id; | |
this.subscribe = function() { | |
let btn = document.getElementById(this.buttonId); |
NewerOlder