欢迎来到第 125 期的【视野修炼 - 技术周刊】,下面是本期的精选内容简介
近期因为身体原因,上机时间较少,码内容断断续续😋,断更了一段时间。
这周超火的图片编辑模型,谷歌出品的 Gemini Flash,"直接替代 PS"。
可直接上 Google Gemini Web 段体验。
下面给2个案例和提示词(来源于 X 上大佬 @ZHO_ZHO_ZHO 分享)
md
Use the nano-banana model to create a 1/7 scale commercialized figure of thecharacter in the illustration, in a realistic style and environment. Place the figure on a computer desk, using a circular transparent acrylic base without any text.On the computer screen, display the ZBrush modeling process of the figure. Next to the computer screen, place a BANDAI-style toy packaging box printed with the original artwork.md
Generate a highly detailed photo of a girl cosplaying this illustration, at Comiket. Exactly replicate the same pose, body posture, hand gestures, facial expression, and camera framing as in the original illustration. Keep the same angle, perspective, and composition, without any deviation大家也可以参考文章 实测谷歌Nano Banana,探索更多玩法!
挑一些实用的点:
使用 ESM 替代CJS
导入内置模块使用 node: 前缀以区分第三方模块 ,如 node:fs
js
import { readFile } from 'node:fs/promises';awaitjs
import { readFile } from 'node:fs/promises';
const config = JSON.parse(await readFile('config.json', 'utf8'));js
const response = await fetch('https://api.example.com/data');
const data = await response.json();AbortController 终止请求js
const controller = new AbortController();
setTimeout(() => controller.abort(), 10000);
try {
const data = await fetch('https://slow-api.com/data', {
signal: controller.signal
});
console.log('Data received:', data);
} catch (error) {
if (error.name === 'AbortError') {
console.log('Request was cancelled');
} else {
console.error('Unexpected error:', error);
}
}node:testjs
// test/math.test.js
import { test, describe } from 'node:test';
import assert from 'node:assert';
import { add, multiply } from '../math.js';
describe('Math functions', () => {
test('adds numbers correctly', () => {
assert.strictEqual(add(2, 3), 5);
});
});sh
# Run all tests with built-in runner
node --test
# Watch mode for development
node --test --watch
# Coverage reporting (Node.js 20+)
node --test --experimental-test-coveragejs
{
"name": "modern-node-app",
"type": "module",
"engines": {
"node": ">=20.0.0"
},
"scripts": {
"dev": "node --watch --env-file=.env app.js",
"test": "node --test --watch",
"start": "node app.js"
}
}这个吊,之前都没了解到👍🏻,完美替代 alias
package.json 中添加 imports 字段
json
{
"imports": {
"#config": "./src/config/index.js",
"#utils/*": "./src/utils/*.js",
"#db": "./src/database/connection.js"
}
}js
import config from '#config';
import { logger, validator } from '#utils/common';
import db from '#db';基于 GitHub Action 基础能力,自动部署GitHub Pages和定时数据更新。
下面是笔者部署的自己的!
一个简单的工具,可帮助检查目标 URL 页面,哪部分内容是服务端渲染哪部分是CSR渲染。
GitHub风格本地 Diff 工具
sh
npx difit支持在 Node.js 和浏览器中运行,用于调整大小、裁剪、过滤、颜色调整以及许多其他高级操作的库。
👍🏻比较高级
收藏!
收藏!迟早有一天会用上。
周刊部分内容来源如下渠道,推荐大家关注。
欢迎来到第 125 期的【视野修炼 - 技术周刊】,下面是本期的精选内容简介
近期因为身体原因,上机时间较少,码内容断断续续😋,断更了一段时间。
这周超火的图片编辑模型,谷歌出品的 Gemini Flash,"直接替代 PS"。
可直接上 Google Gemini Web 段体验。
下面给2个案例和提示词(来源于 X 上大佬 @ZHO_ZHO_ZHO 分享)
md
Use the nano-banana model to create a 1/7 scale commercialized figure of thecharacter in the illustration, in a realistic style and environment. Place the figure on a computer desk, using a circular transparent acrylic base without any text.On the computer screen, display the ZBrush modeling process of the figure. Next to the computer screen, place a BANDAI-style toy packaging box printed with the original artwork.md
Generate a highly detailed photo of a girl cosplaying this illustration, at Comiket. Exactly replicate the same pose, body posture, hand gestures, facial expression, and camera framing as in the original illustration. Keep the same angle, perspective, and composition, without any deviation大家也可以参考文章 实测谷歌Nano Banana,探索更多玩法!
挑一些实用的点:
使用 ESM 替代CJS
导入内置模块使用 node: 前缀以区分第三方模块 ,如 node:fs
js
import { readFile } from 'node:fs/promises';awaitjs
import { readFile } from 'node:fs/promises';
const config = JSON.parse(await readFile('config.json', 'utf8'));js
const response = await fetch('https://api.example.com/data');
const data = await response.json();AbortController 终止请求js
const controller = new AbortController();
setTimeout(() => controller.abort(), 10000);
try {
const data = await fetch('https://slow-api.com/data', {
signal: controller.signal
});
console.log('Data received:', data);
} catch (error) {
if (error.name === 'AbortError') {
console.log('Request was cancelled');
} else {
console.error('Unexpected error:', error);
}
}node:testjs
// test/math.test.js
import { test, describe } from 'node:test';
import assert from 'node:assert';
import { add, multiply } from '../math.js';
describe('Math functions', () => {
test('adds numbers correctly', () => {
assert.strictEqual(add(2, 3), 5);
});
});sh
# Run all tests with built-in runner
node --test
# Watch mode for development
node --test --watch
# Coverage reporting (Node.js 20+)
node --test --experimental-test-coveragejs
{
"name": "modern-node-app",
"type": "module",
"engines": {
"node": ">=20.0.0"
},
"scripts": {
"dev": "node --watch --env-file=.env app.js",
"test": "node --test --watch",
"start": "node app.js"
}
}这个吊,之前都没了解到👍🏻,完美替代 alias
package.json 中添加 imports 字段
json
{
"imports": {
"#config": "./src/config/index.js",
"#utils/*": "./src/utils/*.js",
"#db": "./src/database/connection.js"
}
}js
import config from '#config';
import { logger, validator } from '#utils/common';
import db from '#db';基于 GitHub Action 基础能力,自动部署GitHub Pages和定时数据更新。
下面是笔者部署的自己的!
一个简单的工具,可帮助检查目标 URL 页面,哪部分内容是服务端渲染哪部分是CSR渲染。
GitHub风格本地 Diff 工具
sh
npx difit支持在 Node.js 和浏览器中运行,用于调整大小、裁剪、过滤、颜色调整以及许多其他高级操作的库。
👍🏻比较高级
收藏!
收藏!迟早有一天会用上。
周刊部分内容来源如下渠道,推荐大家关注。