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 { mkdir } from "node:fs/promises"; | |
import { dirname, join } from "node:path"; | |
import unzipper from "unzipper"; | |
import { createWriteStream } from "node:fs"; | |
/** | |
* Main function to unzip and filter files based on user-defined patterns | |
*/ | |
async function unzipAndFilter(inputZip, destDir, ignorePatterns) { |
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
VAR_QUOTED="FOOBAR" | |
VAR_QUOTED_WITH_HASH="FOO#BAR" | |
VAR_QUOTED_WITH_HASH_SPACE="FOO #BAR" | |
VAR_QUOTED_WITH_COMMENT="FOOBAR" # COMMENT | |
VAR_QUOTED_WITH_COMMENT_NOSPACE="FOOBAR"# COMMENT | |
VAR_UNQUOTED=FOOBAR | |
VAR_UNQUOTED_WITH_HASH=FOO#BAR | |
#VAR_COMMENTED_OUT="FOO" | |
#VAR_COMMENTED_OUT_WITH_COMMENT="FOO" # BAR |
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 Promise support for PassportJS: req.logIn() and req.logOut() | |
// | |
import { promisify } from "node:util"; | |
import passportHttpRequest from "passport/lib/http/request.js"; | |
// Workaround: Convert to promises before passport.initialize() | |
app.use(function (req, res, next) { | |
req.logIn = promisify(passportHttpRequest.logIn); | |
req.logOut = promisify(passportHttpRequest.logOut); |
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
#!/usr/bin/env node | |
const EventEmitter = require("events"); | |
const stdin = new EventEmitter(); | |
stdin.on("line", console.error); | |
let buff = ""; |
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
<html> | |
<head> | |
<style> | |
* { | |
margin: 0; | |
} | |
</style> | |
</head> | |
<body> | |
<div style="display: flex; flex-direction: column; min-height: 100vh;"> |
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
# https://stackoverflow.com/a/3143485/2424549 | |
# create a new branch | |
git checkout -b new_clean_branch | |
# apply all changes | |
git merge original_messy_branch | |
# forget the commits but have the changes staged for commit | |
git reset --soft master |
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
<body> | |
<div style="display: flex; flex-direction: column; min-height: 100vh; "> | |
<div style="flex-shrink: 0; overflow: auto;"> | |
HEADER | |
</div> | |
<div style="flex-shrink: 0; overflow: auto;"> | |
<div style="margin: 0 auto; align-self: center; overflow: auto; max-width: 420px; padding: 1rem 2rem; border-radius: 0.5rem; background: #eee;"> | |
BANNER | |
</div> | |
</div> |
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
/* | |
Enforcing strict routing | |
https://github.com/expressjs/express/issues/2281 | |
Use cases: | |
GET /strict -> noslash | |
GET /strict/ -> noslash (expect slash) | |
GET /strict// -> noslash (expect 404) |
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 test(a = foo(arguments)) { | |
console.log(a, typeof a); | |
} | |
function foo(args) { | |
console.log('foo', args) | |
} | |
console.log(test(undefined, undefined, undefined)); |
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
var Component = Vue.extend({ | |
template: "<div>Hello world</div>", | |
data: function () { | |
console.log('Component data()'); | |
return {}; | |
}, | |
ready: function () { |
NewerOlder