关于sublime-text:sublime-做一款翻译变量名插件

sublime 做一个变量翻译插件指标中文写一个变量名, 鼠标移上去调用命令能将中文单词翻译成变量名,要求能抉择是大驼峰小驼峰还是下划线 开始Tools > Developer > New Plugin... import sublimeimport sublime_pluginclass ExampleCommand(sublime_plugin.TextCommand): def run(self, edit): self.view.insert(edit, 0, "Hello, World!")首先思路就是先能取到鼠标所在的单词. 因为 sublime 是反对多光标的, view.sel()会返回数组 for region in self.view.sel(): print(region)ctrl+~关上控制台, 输出view.run_command('example') 看打印后果。 tip: sublime插件最终的命令名是取类名的每个单词,而后用下划线拼接,最初去掉`command`字符而来.如果类名批改为 `TestCommand`, 那么应该输出`view.run_command('test')`如果类名批改为 `TestDevCommand`, 那么应该输出`view.run_command('test_dev')`拿到鼠标所在的地位, 能够通过view.word(regin) 拿到整个单词的地位 当初代码如下: for region in self.view.sel(): passselection = self.view.word(region)print(selection)调用 APIsublime 中只能应用内置的模块,所以应用urllib, API 如下: urllib.request.urlopen(url, data)留神: 如果是get申请第二个参数不必填,填了就代表是post申请, 对于get咱们本人去拼接url 对于第三方翻译平台,我应用的是百度,因为在vscode中我也做了一个一摸一样的插件,所以 API 就拿来用了。 申请第三方翻译平台代码: import hashlibimport jsonfrom urllib import request,parsedef translateBaidu(self, q, fromq, to): appid = '20200921000570318' secret = 'GLMeRH02ZIQHOCIPlJhW' salt = random.random() sign = appid + q + str(salt) + secret url = 'https://fanyi-api.baidu.com/api/trans/vip/translate' data = { "q": q, "appid": appid, "from": fromq, "to": to, "salt": str(salt), "sign": hashlib.md5(sign.encode('utf-8')).hexdigest() } encodeddata = parse.urlencode(data) print(encodeddata) req = request.Request(url + '?' + encodeddata) r = request.urlopen(req) print(r)字符串整合拿到翻译后差不多是这样的: ...

November 4, 2022 · 3 min · jiezi

关于sublime-text:sublime安装Pretty-JSON插件

格式化JSON是开发过程中必不可少的性能之一,尽管有相似bejson.com这种网站,但毕竟是网页还是不不便,而sublime就非常适合解析JSON,之前能够从sublime的install package里装置Pretty JSON,但当初发现搜寻不到了。咱们就用命令行手动装置办法来解决: Sublime Text 4 cd <Packages directory> (MacOS: ~/Library/Application\ Support/Sublime\ Text/Packages)git clone https://github.com/dzhibas/SublimePrettyJson.git "Pretty JSON"Sublime Text 3 cd <Packages directory> (MacOS: ~/Library/Application\ Support/Sublime\ Text\ 3/Packages)git clone https://github.com/dzhibas/SublimePrettyJson.git "Pretty JSON"cd Pretty JSONgit checkout st3Sublime Text 2 不在反对了,降级sublime吧。 装置实现后,重启sublime,选中json文本,mac下按快捷键 command + shift + p,而后输出json,就能看到Pretty JSON插件的各种性能了。如图:

October 10, 2022 · 1 min · jiezi

关于sublime-text:Mac上的前端代码编辑器sublime-text-4

sublime text for Mac是利用在Mac上的一款前端代码开发神器,反对语法高亮、代码补全、代码片段(Snippet)、代码折叠、行号显示、自定义皮肤、配色计划等所有其它代码编辑器所领有的性能的同时,又保障了其飞快的速度! 1.转到任何货色应用Goto Anything只需几个按键即可关上文件,并立刻跳转到符号,行或单词。触发 + P,能够:- 键入文件名的一部分来关上它。- 键入@以跳转到符号,#在文件中搜寻并:转到行号。这些快捷键能够合并,这样tp@rf能够带你到一个性能READ_FILE在文件中text_parser.py。同样,tp:100会带你到第100行的同一个文件。2.转到定义应用语法定义中的信息,Sublime Text自动检索每个类,办法和函数的我的项目范畴索引。这个索引反对Goto Definition,它有三种不同的形式:- 悬停在符号上时会显示一个弹出窗口- 当插入符号时按F12- 我的项目性能中的转到符号能够通过配置文件依照语法定制符号索引,使用户能够依据本人的须要定制性能。

August 10, 2022 · 1 min · jiezi

关于sublime-text:sublime-安装LiveReload-修改后实时自动刷新的方法

// 本测试文章应用的是sublime3 sublime 装置LiveReload 批改后实时主动刷新的办法: 第一:下载chrome插件LiveReload ,并设置容许拜访文件网址 第二:下载sublime插件 LiveReload 反对(win,os,linux),并把目录放在如下门路(肯定要改名为LiveReload) 第三:在sublime中设置 { "enabled_plugins": [ "SimpleReloadPlugin", "SimpleRefresh" ]}{ "enabled_plugins": [ "SimpleReloadPlugin", "SimpleRefresh"]} 第四:测试胜利的验证,chrome浏览器中的插件LiveReload变成实心,sublime批改后按保留后呈现提醒 阐明:如果重新启动插件没有失效,则能够在sublime从新激活一下即可应用。 肯定要保留这个名字才能够:LiveReload

December 5, 2021 · 1 min · jiezi

关于sublime-text:Mac-zsh-使用Sublime打开文件

vim ~/.zshrc# Set Sublime Text Aliasalias subl="'/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl'"# 使配置失效source ~/.zshrc# 关上sublime$ subl# 应用sublime关上当前目录$ subl .

July 29, 2021 · 1 min · jiezi

关于sublime-text:STT-422

STT 422 EXAM 1Due Monday Apr 08, 11:59 pm, 25% of Final Grade = 80 points There are total 8 questions. Each question has subparts.11 Problem 1Consider the data set bank wage.csv. Using R or otherwise answer the following questions: (2 points) Plot wages versus LOS and circle the outlier with the highest value of wage. (Dropthis observation for remaining parts.)(1 point) Find the least squares regression line for the regression of wages on LOS.(4 points) Give the significance test for the slope of LOS. (Clearly mention the hypothesis test,test statistic, pvalue and conclusion).(3 points) Give a 95% prediction interval at LOS=55.Problem 2Consider the data set student gpa.csv. Consider a regression model for predicting GPA using IQ,gender and self-concept. Using R or otherwise answer the following questions:(4 points) Give the F-statistic for testingH0 : IQ = gender = selfconcept = 0Also provide the degrees of freedom for this F-statistic.(4 point) Run correlation tests to check if GPA is correlated to(a) IQ(b) GENDERProblem 3Consider the data set biomarkers.csv. Consider a regression model for predicting VO+ using OC,TRAP and VO-. Using R or otherwise answer the following questions:(2 points) Give the statistical model for this including all assumptions.(2 point) Give the multiple regression regression line to predict VO+ from OC, TRAP andVO-.(4 points) Make a table with t-statistics and pvalues for all the explanatory variables. Whichis the least significant variable among OC, TRAP and VO-.(4 points) Consider the full model and the one without the least significant variable. Give theanova table to compare these two models.2Problem 4Do people from different cultures experience emotions differently? Here is a summary of the data:Are the means same across different cultures?(2 points) Should you use a pooled standard deviation? If yes, what is its value?(4 points) Construct an ANOVA table for this problem.(2 points) State the hypothesis test for this problem.(2 points) Provide the p-value for hypothesis test in part 3.Problem 5Consider the data set price promotion.csv. Using R or otherwise answer the following questions.(2 points) Construct a contrast which can compare the average of promotions 1 and 7 to theaverage of promotions 3 and 5.(3 points) Give a 95% confidence interval for the contrast in part 1.(4 points) Use the Bonferroni or another multiple-comparisons procedure to compare differentprice promotion groups.Problem 6Consider the data set intervene program.csv. Using R or otherwise answer the following questions.(3 points) Plot the means. Do you think there is an interaction between Group and Time.3(2 points) Give an estimate for the main effect of group 1.(4 points) Construct the two way anova model for this problem with group and time as thefactors.(2 points) Can you accept the hypothesis that there is a main effect of time?Problem 7Consider the data set plants1.csv. Using R or otherwise answer the following questions.(4 points) Find the means for each species-by-water combination. Plot these means versuswater for the four species, connecting the means for each species by lines.(2 points) Give the interaction effect between species level 1 and water level 6.(4 points) Give the two-way analysis of variance with species and water as factors.Problem 8A study of 170 franchise firms classified each firm as to whether it was successful or not. Attached isthe data.(2 points) What proportion of exclusive territory firms are successful?(2 points) Find the log odds for the answer in part 1.)(6 points) Let x = 1 for exclusive territories and x = 0 for other territories. Using R orotherwise.(a) (3 points) The fitted logistic regression model.(b) (3 points) Odds ratio for exclusive territory versus no exclusive territory. WX:codehelp

June 29, 2021 · 3 min · jiezi

关于sublime-text:Sublime-Text-4-首个稳定版终于来了支持-GPU-渲染兼容旧版本Python-API-升级

Sublime Text 是一个轻量、简洁、高效、跨平台的编辑器,反对 Linux、Windows 和 Mac OS X 操作系统,受到许多程序员的青睐。 近日,Sublime Text 4 公布首个稳固版本!开发团队称该版本在维持原有优良个性的同时,提供了一些新的改良。新增的次要个性将极大地改良用户的工作流程。 Sublime Text 4 下载地址:https://www.sublimetext.com/d... Sublime Text 4 稳定版新个性该版本的更新亮点如下: 许可证更改:Sublime Text License 密钥(注册码)不再与独立的次要版本绑定,而是对购买后 3 年内的所有更新均无效,不过应用更新的版本须要降级 License。反对多 tab 选项卡:不便宰割视图,反对通过界面或内置命令行应用。反对 Apple Silicon 和 Linux ARM64:Sublime Text for Mac 蕴含对 Apple Silicon 处理器的原生反对,Linux ARM64 builds 在树莓派等设施中可用。全新的 UI 界面语境感知主动补全:该版本重写了主动补全引擎,使之可能基于我的项目中的已有代码提供智能补全。反对 TypeScript、JSX 和 TSX语法定义降级:语法高亮引擎全新降级,可能解决非确定性语法、多行语句、lazy embed 和语法继承。此外,内存应用升高,加载速度更快。GPU 渲染:Sublime Text 4 稳定版在渲染界面时,可能在 Linux、Mac 和 Windows 零碎中利用 GPU,从而带来晦涩的 UI 界面,分辨率最高可达 8K,且耗费的能源更少。Python API 降级:Sublime Text 新版本 API 降级至 Python 3.8,同时具备对 Sublime Text 3 软件包的向后兼容性。Python API 新增了许多个性,如容许 LSP 等插件更好地运行。兼容性:Sublime Text 4 齐全兼容 Sublime Text 3,能够主动接管旧版本的会话和配置。Sublime Text 还反对 3、4 版本的离开运行。参考链接:https://www.sublimetext.com/b... ...

May 22, 2021 · 1 min · jiezi

关于sublime-text:sublime配置jade语法高亮

明天在网上看 scott老师讲的node+mongodb 建站攻略(一期) 就在本人亲手实际的时候发现jade语法没法高亮. 我的开发平台是ubuntu,工具是sublime3,sublime3之前就有没法中文输出的问题,所以还是老思路,在网上找插件。 关上sublime3,再关上 view > show console,把下列代码复制到console框内 import urllib.request,os,hashlib; h = 'eb2297e1a458f27d836c04bb0cbaf282' + 'd0e7a3098092775ccb37ca9d6b2e4b7d'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)如果你是sublime2,请粘贴下列代码 import urllib2,os,hashlib; h = 'eb2297e1a458f27d836c04bb0cbaf282' + 'd0e7a3098092775ccb37ca9d6b2e4b7d'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib2.install_opener( urllib2.build_opener( urllib2.ProxyHandler()) ); by = urllib2.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); open( os.path.join( ipp, pf), 'wb' ).write(by) if dh == h else None; print('Error validating download (got %s instead of %s), please try manual install' % (dh, h) if dh != h else 'Please restart Sublime Text to finish installation')在底部栏会看到显示导入pakeage control胜利 重启sublime,而后在 preferences >package control >抉择package control:install package 再在选框中输出 jade >而后重启,即可看见jade语法高亮了。 本文来自PHP中文网的sublime教程栏目:https://www.php.cn/tool/sublime/

August 1, 2020 · 1 min · jiezi