Code Monkey home page Code Monkey logo

codevar's Introduction

CodeVar

开发基于 Javascriptalfy有道翻译api;

依赖

  • Node.js 8+
  • Alfred 3

安装

点击下载

开发趋向

  • 使用标准的缩写(如 rpt)。✔️
  • 去掉虚词 and,or,the。✔️
  • 使用名字中的每一个重要单词,最多不超过3个。❎
  • 去掉无用的后缀(如 ing、ed 等)。❎
  • 确保不要改变变量的含义。✔️
  • 不要从每个单词中删除一个字符的方式来缩写。❎
  • 缩写要一致:如果将 function 缩写成 func。那么将整个项目里,最好都统一使用这种缩写。✔️

效果

小驼峰命名法:xt

大驼峰命名法:dt

下划线命名法:xh

常量命名法:cl

中划线命名法:zh

作者

关注作者有更多好用的小工具哦~

其他作品

CodeExpander 专为开发者开发的一个集输入增强、代码片段管理(支持 Markdown)为一体跨平台云同步的开发工具。

codevar's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

codevar's Issues

好像是翻译不出来了

今天看到了这个感觉挺好用的,但是试了一下,好像不能用了,希望作者看下原因,非常感谢!

Unexpected token

ParseError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON in "http://fanyi.youdao.com/openapi.do": 
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="te...
    at /Users/wjx/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.0D7B33FB-C4F3-47AC-B4AA-06F6BD5AC703/node_modules/got/index.js:118:14
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

CodeVar undefined
Alfred 5.0.4
darwin x64 22.3.0

速度比较慢

👋先感谢提供好用的workflow,issues:输入 情况表格 四个字 大概需要4秒才能出来

求教程怎么安装

作为一个新手,怎么安装啊,下载下来那个文件之后怎么安装啊,有点懵逼。。

run_node 脚本建议增加对 CodeRunner 的支持

好吧,这个可能有点小众。。

对于安装了 CodeRunner,但是没有装 node(我连 homebrew 都没有 = =)的人,电脑上其实是有 node 的,就在 /Applications/CodeRunner.app/Contents/SharedSupport/Developer/bin 路径下。

CodeRunner 自带的集成环境:

default

run_node 判断 node 存在的时候,在 PATH 尾部补一个这个路径就行。

无法导入

你好,我根据说明下载了CodeVar.alfredworkflow,但不能导入。
我使用的Alfred版本为Alfred 3.3 Build 801
导入其它的.alfredworkflow文件正常。

建议把 build 命令写到package.json里面

修改 src/config.js 文件

去有道字典申请账号

yarn add crypto-js uuid

'use strict';

const alfy = require('alfy');
const { v4:uuid } = require('uuid');
const CryptoJS = require('crypto-js')
module.exports = {
    youDaoApi: 'https://openapi.youdao.com/api',
    getParams: function () {
        const salt = uuid();
        const curtime = Math.round(new Date().getTime()/1000);
        const key = '应用密钥'
        const appKey = "应用ID";
        const q = alfy.input
        const sign = CryptoJS.SHA256(`${appKey}${q}${salt}${curtime}${key}`).toString(CryptoJS.enc.Hex)
        return {
            query: {
                appKey,
                salt,
                curtime,
                sign,
                signType:'v3',
                q,
                from:'auto',
                to:'auto',
            }
        }
    },
    filter: {
        prep: [
            'and', 'or', 'the', 'a', 'at', 'of'
        ],
        prefix: [],
        suffix: [
            'ing', 'ed', 'ly'
        ],
        verb: [
            'was'
        ]
    }
};

ParseError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON in "http://fanyi.youdao.com/openapi.do": <!DOCTYPE html>

CodeVar undefined
Alfred 5.0.4
darwin arm64 22.4.0

image

image

[11:58:58.213] CodeVar[Script Filter] Queuing argument '你好'
[11:58:58.421] CodeVar[Script Filter] Script with argv '(null)' finished
[11:58:58.426] ERROR: CodeVar[Script Filter] Code 1: {
"items": [
{
"title": "ParseError: Unexpected token '<', "\n\n\n <meta http-equiv="Content-Type" content="te...\n at /Users/doudou/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.1239E880-0DA5-4507-9E68-9DD6FCD250E2/node_modules/got/index.js:118:14\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)",
"subtitle": "Press ⌘L to see the full error and ⌘C to copy it.",
"valid": false,
"text": {
"copy": "\nParseError: Unexpected token '<', \"<!DOCTYPE \"... is not valid JSON in \"http://fanyi.youdao.com/openapi.do\": \n<!DOCTYPE html>\n<html>\n<head>\n <meta http-equiv=\"Content-Type\" content=\"te...\n at /Users/doudou/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.1239E880-0DA5-4507-9E68-9DD6FCD250E2/node_modules/got/index.js:118:14\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n\n\n-\nCodeVar undefined\nAlfred 5.0.4\ndarwin arm64 22.4.0",
"largetype": "ParseError: Unexpected token '<', "\n\n\n <meta http-equiv="Content-Type" content="te...\n at /Users/doudou/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.1239E880-0DA5-4507-9E68-9DD6FCD250E2/node_modules/got/index.js:118:14\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"
},
"icon": {
"path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/AlertStopIcon.icns"
}
}
]
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.