This file contains hidden or 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 type ConsList<T> = null | readonly [T, ConsList<T>]; | |
function cons<T>(h: T, t: ConsList<T>): ConsList<T> { | |
return [h, t]; | |
} | |
function head<T>(xs: ConsList<T>): T { | |
if (!xs) { | |
throw new Error("can't take head of empty ConsList"); | |
} |
This file contains hidden or 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 const Component: React.FunctionComponent<Props> = ({ text }) => { | |
const container = React.useRef() as React.MutableRefObject<HTMLDivElement>; | |
const [textContainerWidth, setTextContainerWidth] = React.useState(0); | |
React.useLayoutEffect(() => { | |
handleTextContainerWidth(); | |
}, []); | |
React.useEffect(() => { | |
window.addEventListener('resize' handleTextContainerWidth); |
This file contains hidden or 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 type ApiError = { | |
error: string; | |
error_details?: string; | |
}; | |
export interface TypedResponse<T = ApiError> extends Response { | |
status: (status: number) => TypedResponse<T | ApiError>; | |
send: (body: T | ApiError) => TypedResponse<T | ApiError>; | |
} |
This file contains hidden or 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
isMember(A, houses(A, _, _, _, _)). | |
isMember(A, houses(_, A, _, _, _)). | |
isMember(A, houses(_, _, A, _, _)). | |
isMember(A, houses(_, _, _, A, _)). | |
isMember(A, houses(_, _, _, _, A)). | |
isInMiddle(A, houses(_, _, A, _, _)). | |
isFisrt(A, houses(A, _, _, _, _)). |
This file contains hidden or 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
% house(Nationality, Color, Pet, Cigarette, Drink) | |
solve(Houses) :- | |
length(Houses, 5), | |
% Anglik ma czerwony dom | |
member(house(english,red,_,_,_), Houses), | |
% Hiszpan ma psa | |
member(house(spanish,_,dog,_,_), Houses), | |
% W zielonym domu pije się kawę | |
member(house(_,green,_,_,coffee), Houses), |
This file contains hidden or 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 const listMeetings = ( | |
groupId: GroupDTO['id'], | |
callback: QueryCallback | |
) => | |
connection.query( | |
{ | |
sql: /* sql */ ` | |
SELECT | |
id, meeting_name, group_id, date | |
FROM |
This file contains hidden or 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 { purify } from 'profanity-util'; | |
import * as vscode from 'vscode'; | |
export const purifyLogs = () => { | |
const { | |
activeTextEditor: { document }, | |
} = vscode.window; | |
const workspaceEdit = new vscode.WorkspaceEdit(); |
This file contains hidden or 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
'use strict'; | |
import * as vscode from 'vscode'; | |
import { purifyLogs } from './purifyLogs'; | |
export function activate(context: vscode.ExtensionContext) { | |
const disposable = vscode.commands.registerCommand( | |
'extension.noProfanity', | |
purifyLogs | |
); |
This file contains hidden or 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
"activationEvents": [ | |
"onCommand:extension.noProfanity" | |
], | |
"main": "./out/extension", | |
"contributes": { | |
"commands": [ | |
{ | |
"command": "extension.noProfanity", | |
"title": "No profanity 🤬" | |
} |
This file contains hidden or 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
'use strict'; | |
// The module 'vscode' contains the VS Code extensibility API | |
// Import the module and reference it with the alias vscode in your code below | |
import * as vscode from 'vscode'; | |
// this method is called when your extension is activated | |
// your extension is activated the very first time the command is executed | |
export function activate(context: vscode.ExtensionContext) { | |
// Use the console to output diagnostic information (console.log) and errors (console.error) |