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
/** Defers an execution until a promise is awaited */ | |
class DeferredPromise<T = void> extends Promise<T> { | |
private executor: () => Promise<T>; | |
private resultPromise: Promise<T> | undefined; // Memoize the promise, to avoid executing the executor twice if awaited twice | |
constructor(executor: () => Promise<T>) { | |
super(() => { | |
// Dummy callback to make Promise happy | |
}); | |
this.executor = executor; |
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
/// QUERIES | |
// Get all nodes | |
MATCH(n) | |
RETURN n | |
// Get all nodes with label | |
MATCH(m:Movie) | |
RETURN m |
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
# C# beautify config | |
# @angrykoala | |
newlines = LF # AUTO (default), CRLF, CR, or LF | |
indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs | |
input_tab_size = 4 # original tab size | |
output_tab_size = 4 # new tab size | |
indent_columns = output_tab_size | |
# indent_label = 0 # pos: absolute col, neg: relative column |
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
// utilify.ts - Random set of utilities for TypeScript | |
// by @angrykoala | |
// FUNCTIONS | |
/** Ensures input is an array, if not, turns it into an array (empty array if input is null or undefined) */ | |
export function arrayfy<T>(raw: T | Array<T> | undefined | null): Array<T> { | |
if (Array.isArray(raw)) return raw; | |
if (raw === undefined || raw === null) return []; | |
else return [raw]; |
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
Show hidden characters
{ | |
"defaultSeverity": "error", | |
"extends": ["tslint:recommended"], | |
"jsRules": {}, | |
"rules": { | |
"arrow-parens": false, | |
"quotemark": false, | |
"trailing-comma": false, | |
"ordered-imports": false, | |
"object-literal-shorthand": false, |
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
{ | |
"compilerOptions": { | |
"module": "commonjs", | |
"noImplicitReturns": true, | |
"noUnusedLocals": true, | |
"outDir": "dist", | |
"sourceMap": false, | |
"strict": true, | |
"target": "es2015", | |
"typeRoots": [ "./@types", "./node_modules/@types"], |
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
/* | |
Add this file under ~/.mozilla/firefox/***.default/chrome/ in linux | |
Or AppData/Roaming/Mozilla/Firefox/Profiles/***.default/chrome in windows | |
about:config --> toolkit.legacyUserProfileCustomizations.stylesheets | |
*/ | |
/* Removes "Open All In Tabs" button in bookmarks tabs */ | |
openintabs-menuseparator, .openintabs-menuitem, .bookmarks-actions-menuseparator { | |
display: none !important; |
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
// Preprocess typescript files to make export/import statements work on appscript after compiling with ts2gs | |
const fs = require('fs'); | |
const path = require('path'); | |
const glob = require("glob") | |
const ncp = require('ncp').ncp; | |
const source = path.join(__dirname, "..", "/lib"); | |
const target = path.join(__dirname, "..", "/bin"); |
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
#!/bin/sh | |
# Unites and compress pdf | |
# Usage compress_pdf.sh file1.pdf file2.pdf output_file.pdf | |
last_arg=${*: -1:1} | |
last_arg_temp="${last_arg}_temp.pdf" | |
args_except_last=${@:1:$#-1} | |
echo "Creating pdf $last_arg" |
NewerOlder