meetup_如何使用标准库和Node.js构建Meetup Slack机器人
meetup
by Janeth Ledezma
简妮丝·莱德兹玛(Janeth Ledezma)
如何使用标准库和Node.js构建Meetup Slack机器人 (How to build a Meetup Slack bot with Standard Library and Node.js)
In this guide, you will learn how to set up a Slack application that will display information from Meetup’s API, which serves stored data from Meetup to other application software.
在本指南中,您将学习如何设置一个Slack应用程序,该应用程序将显示来自Meetup API的信息 ,该API将来自Meetup的存储数据提供给其他应用程序软件。
Meetup is a popular website where individuals with similar interests form groups to organize events in their local cities.
Meetup是一个受欢迎的网站,志趣相投的人组成小组来组织当地城市的活动。
Once we’ve successfully made a request to Meetup’s API, we will receive a response from Meetup, we’ll pull specific data from the JSON payload, and display that data in Slack. We will design our Slack application’s attachment so that it displays the event’s name, description, date and time, location, and more!
成功向Meetup的API提出请求后,我们将收到来自Meetup的响应,我们将从JSON有效负载中提取特定数据,并在Slack中显示该数据。 我们将设计Slack应用程序的附件,以便它显示事件的名称,描述,日期和时间,位置等!
这个怎么运作: (How it Works:)
When you submit /nextmeetup 94709&javascript
(or any zip code and a topic of interest) in Slack’s message box, a webhook will be triggered. The webhook, built and hosted on Standard Library, will first make a request to Meetup’s API, which will return a JSON payload with results from the query.
当您在Slack的消息框中提交/nextmeetup 94709&javascript
(或任何邮政编码和感兴趣的主题)时,将触发一个Webhook。 在标准库上构建和托管的Webhook首先会向Meetup的API发出请求,该API将返回带有查询结果的JSON有效负载。
The webhook will then create Slack messages for each event and post those to a specified channel.
然后,Webhook将为每个事件创建Slack消息并将其发布到指定的频道。
No need to get overwhelmed! Let’s take it a step at a time.
无需不知所措! 让我们一次迈出一步。
您需要什么: (What You’ll Need:)
1x Slack Account
1个Slack帐户
1x Meetup Account
1个聚会帐户
1x Standard Library Account
1个标准图书馆帐户
步骤1:设定您的Slack应用程式 (Step 1: Set up your Slack Application)
Make sure you’re signed in to Slack and visit your Slack Apps Dashboard at https://api.slack.com/apps. You’ll see a screen that looks like the following.
确保您已登录Slack并访问https://api.slack.com/apps上的 Slack Apps仪表板。 您将看到一个类似于以下的屏幕。
Click Create New App. You’ll be presented with a modal to enter your App Name and the Development Slack Workspace you’d like to add it to.
单击创建新应用。 系统将为您提供一个模态,以输入您的应用名称和您想要添加到其中的Development Slack工作区。
From here, click Create App, you’ll find yourself on a Basic Information page.
从此处单击“ 创建应用程序”,您会在“ 基本信息”页面上找到自己。
Scroll down to Display Information. This is where you can give your Slack app a name, description, and an image if you’d like.
向下滚动以显示信息。 如果需要,您可以在此处为Slack应用提供名称,描述和图像。
Keep the Basic Information page open in your browser. We’ll be using it in a second to retrieve your Slack app’s credentials to connect this application to the backend logic hosted on Standard Library — the code running your application.
在浏览器中保持“ 基本信息”页面打开。 我们将在一秒钟内使用它来检索您的Slack应用程序的凭据,以将该应用程序连接到标准库中托管的后端逻辑-运行您的应用程序的代码。
第2步:创建一个免费的标准库帐户 (Step 2: Create a Free Standard Library Account)
We’ll be hosting our Slack application’s code on Standard Library— the code that will be requesting and receiving specific information from Meetups API. So head on over to Code on Standard Library and claim your free account.
我们将在标准库上托管Slack应用程序的代码,该代码将请求并从Meetups API接收特定信息。 因此,请转到标准库上的代码并申请免费帐户。
步骤3:在标准库中复制和修改Slack App代码模板 (Step 3: Copy and Modify the Slack App Code Template on Standard Library)
Once you’ve logged in or signed up, you will land on “Featured API Source.” These are application code templates available on Standard Library for anyone to easily copy and modify apps. You’re going to select the Slack application code template and modify it to create your API that will power your Slack app.
登录或注册后,您将进入“ Featured API Source”。 这些是标准库上可用的应用程序代码模板,任何人都可以轻松复制和修改应用程序。 您将选择Slack应用程序代码模板并对其进行修改,以创建将为Slack应用程序提供动力的API。
Enter a unique name for your API project and hit Okay.
为您的API项目输入一个唯一的名称,然后单击“ 确定”。
Slack App源代码模板的简要说明: (A Brief Explanation of the Slack App Sourcecode Template:)
Let’s pause for a moment to understand what we are looking at. The left sidebar is an API project scaffold that Standard Library has set up for you to build Slack apps.
让我们暂停片刻以了解我们正在查看的内容。 左侧边栏是标准库为您建立的API项目支架,以构建Slack应用程序。
The code template for Slack Apps has four directories. We will only work within the functions
directory which comes equipped with three more folders
Slack Apps的代码模板有四个目录。 我们将仅在functions
目录下工作,该目录还提供了三个文件夹
actions/, commands/, and events/
as well as a single file __main__.js.
The instructions for Slack actions, slash commands, and events for your app live inside those folders.
actions/, commands/, and events/
以及单个文件__main__.js.
这些应用程序位于这些文件夹中,其中包含有关应用程序的Slack操作,斜杠命令和事件的说明。
When you deploy your API, Standard Library will automatically generate HTTPS endpoints (URLs) for each directory. The resulting URLs will allow us to configure webhooks that listen and respond to Slack’s actions, slash commands, and events.
部署API时,标准库将自动为每个目录生成HTTPS端点(URL)。 生成的URL将使我们能够配置侦听并响应Slack的动作 , 斜杠命令和事件的 Webhooks。
All five folders (including the functions
folder are set up with a __main__.js
file (the directory’s main endpoint). These endpoints__main__.js
dispatch the appropriate functions when they receive a message from Slack. For this tutorial, the file__main__.js
will be dispatching the commands
endpoint when we call our API via our Slack Bot. Now, let’s return to our bot setup!
这五个文件夹(包括functions
文件夹)均使用__main__.js
文件(目录的主要端点)设置。这些端点__main__.js
收到Slack的消息__main__.js
调度相应的函数__main__.js
当我们通过Slack Bot调用API时,将调度commands
端点,现在,让我们回到我们的机器人设置!
步骤4:将命令添加到标准库API (Step 4: Add a Command to your Standard Library API)
commands:
The commands
directory is the endpoint for all Slack slash commands. Create an additional command by placing your cursor over the commands
directory and right-clicking. Select New File and name your slash command file nextmeetup.js and click Okay.
commands:
commands
目录是所有Slack斜杠命令的端点。 将光标放在commands
目录上并单击鼠标右键,以创建其他命令。 选择New File并命名您的斜杠命令文件nextmeetup.js ,然后单击Okay 。
At this point, you will notice a “hello world” JavaScript function inside (__main__.js
), which is automatically generated.
此时,您会注意到( __main__.js
)内部的“ hello world” JavaScript函数是自动生成的。
Replace the contents of nextmeetup.js
with the following:
用以下内容替换nextmeetup.js
的内容:
代码简要说明: (A Brief Explanation of the Code:)
When you submit /nextmeetup
via your Slack app, you are making a GET request to Meetup’s API.
当您通过Slack应用程序提交/nextmeetup
,您正在向Meetup的API发出GET请求。
Every request to Meetups API has to be authenticated with an API key, so we pass our Meetup key from our env.json
file into our request. We also send our GET request with the two parameters, zip and topic.
对Meetups API的每个请求都必须使用API密钥进行身份验证,因此我们将Meetup密钥从env.json
文件传递到我们的请求中。 我们还发送带有两个参数zip和topic的GET请求。
The Meetup API returns an array of meetup event objects, which we can view from Code on Standard Library logs by logging our response: console.log(response.data)
. Your logs tab is located underneath the debug section.
Meetup API返回一个Meetup事件对象数组,我们可以通过记录以下响应从console的标准库日志中的代码查看: console.log(response.data)
。 您的日志标签位于调试部分下方。
The response.data
is an array of events that match your query, and we want to create two attachments for each event (one for location and one for details). We have a function called formatAttachement
that we can call on each of the events. The results get put in an array called attachments
that gets sent to Slack.
response.data
是与您的查询匹配的事件数组,我们希望为每个事件创建两个附件(一个用于位置,一个用于详细信息)。 我们有一个名为formatAttachement
的函数,我们可以对每个事件进行调用。 结果被放入称为attachments
的数组中,该数组被发送到Slack。
Once you’ve copied and pasted the code into your file nextmeetup.js
, save the changes and navigate to the env.json
file on the left bar menu.
将代码复制并粘贴到文件nextmeetup.js
,保存更改并导航至左侧栏菜单上的env.json
文件。
步骤5:使用应用凭据和密钥填充env.json文件 (Step 5: Fill your env.json File with App Credentials and Keys)
Inside the env.json
you will notice environment variables for your API. You can set different values for local, dev, and release (production) environments. This file will hold all of your unique access keys to your Standard Library account, Meetup account and Slack app credentials.
在env.json
内部,您会注意到API的环境变量。 您可以为本地,开发和发布(生产)环境设置不同的值。 该文件将包含您对标准库帐户,Meetup帐户和Slack应用程序凭据的所有唯一访问密钥。
We’ll only be making modifications to the "dev"
environment variables — make sure you’re modifying the right set! Note that "dev”
values are for your development environment and "release"
values should only be populated when you’re ready to release your app. “local”
variables can be left blank when deploying from Code on Standard Library, but they should be filled out when working with the command line tools.
我们将只对"dev"
环境变量进行修改 - 确保您正在修改正确的设置 ! 请注意, "dev”
值适用于您的开发环境, "release"
值仅应在准备发布应用程序时填充。 “local”
变量在从标准库上的代码进行部署时可以留空。使用命令行工具时填写。
Let’s start off by filling in the “STDLIB_TOKEN”
variable. Place your cursor in between the quotation marks (see screen) and either right-click and select Insert Library Token… or use the shortcut ⌘ + K.
让我们从填写“STDLIB_TOKEN”
变量开始。 将光标置于引号之间(请参见屏幕),然后右键单击并选择Insert Library Token…,或使用快捷键⌘+K。
Select Library Token to fill in "dev"
environment.
选择“ 库令牌”以填写"dev"
环境。
Now go back to the Basic Information page of your Slack App and scroll down to App Credentials:
现在返回到Slack App的Basic Information页面,然后向下滚动到App Credentials :
Copy your Client ID, Client Secret, and Verification Token. Paste them into their respective fields in“dev”
section of the env.json
file.
复制您的客户ID,客户机密和验证令牌 。 将它们粘贴到env.json
文件的“dev”
部分中的相应字段中。
Add the name you gave your Slack app for theSLACK_APP_NAME
.
添加您为SLACK_APP_NAME
Slack应用命名的名称。
Ex: SLACK_APP_NAME:Meetup-bot
例如: SLACK_APP_NAME:Meetup-bot
The “SLACK_REDIRECT”
value will be an https endpoint generated by Standard Library once you deploy your API. Even though we haven’t yet deployed, go ahead an fill it in now using this structure. https://<username>.api.stdlib.com/<apiname&g
t;@dev/auth/ — with your standard library username and your API name. Once we deploy the code you can return to confirm that you filled this value properly.
部署API后, “SLACK_REDIRECT”
值将是标准库生成的https端点。 即使我们尚未部署,也请立即使用此结构进行填充。 https://<username>.api.stdlib.com/<apiname&g
t; @ dev / auth /-使用标准库用户名和API名称。 部署代码后,您可以返回以确认您正确填写了该值。
My SLACK_REDIRECT
looks like this: https://Janethl.api.stdlib.com/slack-meetup-bot@dev/auth/
— make sure you add authentication path with a slash at the end.
我的SLACK_REDIRECT
看起来像这样: https://Janethl.api.stdlib.com/slack-meetup-bot@dev/auth/
: SLACK_REDIRECT
—确保在末尾添加带斜杠的身份验证路径。
Your Slack app’s capabilities and permissions will already be set up with the following scopes:
您的Slack应用程序的功能和权限将在以下范围内进行设置:
“SLACK_OAUTH_SCOPE”:bot,commands,chat:write:bot,chat:write:user,files:write:user,channels:history
“ SLACK_OAUTH_SCOPE”: bot,commands,chat:write:bot,chat:write:user,files:write:user,channels:history
The last variable that you will need to add is your Meetup API key. Meetup requires that every request is authenticated with an API key.
您需要添加的最后一个变量是Meetup API密钥。 Meetup要求每个请求都必须通过API密钥进行身份验证。
步骤6:检索Meetup API密钥 (Step 6: Retrieve your Meetup API Key)
Login or create an account at Meetup.com. Head on over to https://secure.meetup.com/meetup_api/key/ to retrieve your unique API key. Click the lock to reveal your API key and copy it.
登录或在Meetup.com上创建一个帐户。 前往https://secure.meetup.com/meetup_api/key/检索您的唯一API密钥。 单击锁以显示您的API密钥并进行复制。
Return to your env.json
file on Code on Standard Library. Add your Meetup key as a "key"
value, exactly as I have done in the image:
返回到标准库代码上的 env.json
文件。 将您的Meetup键添加为"key"
值,就像我在图像中所做的一样:
Make sure to save the changes with ‘⌘ + s’ (or hit Save in the bottom right).
确保使用“⌘+ s”保存更改(或点击右下角的“ 保存 ”)。
On the sidebar menu pen the __main__.js
file located below the events directory. Deploy the code of your Slack app to Standard Library by clicking “Run”.
在边栏菜单上,笔位于事件目录下的__main__.js
文件。 单击“ 运行 ”将Slack应用程序的代码部署到标准库。
Shortly after deploying your code, Standard Library generates an HTTPS API endpoint URL where your code lives. This address consists of your <username>.api.stdlib.com followed by the name you gave your API @ the environment: https://janethl.api.stdlib.com/slack-meetup-bot@dev/
部署代码后不久,标准库就会生成一个HTTPS API终结点URL,您的代码将驻留在该URL中。 该地址包含您的<username> .api.stdlib.com,后跟您在环境中给API的名称:https: //janethl.api.stdlib.com/slack-meetup-bo t @ dev /
We now have the URL that will allow us to send and receive messages from our Slack app to Meetup’s API. Now we need to set our URL as webhook in Slack, so let’s head back to the Slack app dashboard
现在,我们有了该URL,该URL使我们能够从Slack应用发送和接收消息到Meetup的API。 现在我们需要在Slack中将URL设置为webhook,所以让我们回到Slack应用仪表板
步骤7:创建一个新的斜杠命令并设置一个Webhook (Step 7: Create a New Slash Command and Set a Webhook)
We now need to set our Slack app to respond to a slash command (/
). For this, we need to set up a webhook on Slacks API page.
现在,我们需要设置Slack应用程序以响应斜杠命令( /
)。 为此,我们需要在Slacks API页面上设置一个Webhook。
什么是Webhook? (What is a Webhook?)
Perhaps we can understand what a webhook is by comparing it to an API. APIs are request based — meaning that they operate when a request is made from a third party application. A webhook is event-based — the code will run when a specific event triggers it.
也许我们可以通过将它与API进行比较来了解什么。 API是基于请求的-意味着当第三方应用程序发出请求时,它们将运行。 Webhook是基于事件的-代码将在特定事件触发时运行。
To set a webhook, a service provider must allow its consumers to register a URL where the provider can send information when an event happens. In this example, Slack enables us to register our URL address, and once registered a slash command can trigger our webhook, which will execute the code in our URL.
要设置Webhook,服务提供商必须允许其使用者注册一个URL,服务提供商可以在事件发生时在该URL上发送信息。 在此示例中,Slack使我们能够注册我们的URL地址,一旦注册,斜杠命令就可以触发我们的Webhook,它将执行URL中的代码。
Now that we understand this, let’s head on over to Slack’s API page to set our webhook. Find and Select Slash Commands on the sidebar menu.
现在我们已经了解了这一点,让我们进入Slack的API页面来设置我们的webhook。 找 并在侧边栏菜单上选择Slash Commands 。
After clicking Create New Command, you’ll be asked to enter your command details, for this example use:
点击创建新命令后 ,将要求您输入命令详细信息,在此示例中,请使用:
Command: /nextmeetup
命令: /nextmeetup
RequestURL: https://<username>.api.stdlib.com/<apiname>@dev/
commands/:bg
RequestURL: https://<username>.api.stdlib.com/<apiname>@dev/
命令/:bg
Short Description: retrieves Meetup events
简短说明: retrieves Meetup events
Usage Hint:[<zip>&&l
t;topic>]
用法提示: [<zip>&&l
; topic>]
Hit “Save” once complete.
完成后点击“ 保存 ”。
步骤8:启用OAuth和权限 (Step 8: Enable OAuth & Permissions)
Return to your Slack App, On the sidebar menu, click OAuth & Permissions.
返回您的Slack App ,在侧边栏菜单上,点击OAuth&Permissions 。
Once there, you’ll want to enter in a Redirect URL as follows: https://<username>.api.stdlib.com/ <apiname&g
t;@dev/auth/
到达该地址后 ,您将要输入一个重定向URL ,如下所示: https://<username>.api.stdlib.com/ <apiname&g
t; @ dev / auth /
click “Add” and “Save URLS.”
点击“添加”和“保存网址”。
This Redirect URL should match the URL that we set on the env.json
file on Code on Standard Library.
此重定向URL应与我们在标准库代码上的env.json
文件上设置的URL匹配。
第9步:向您的Slack应用添加Bot (Step 9: Add a Bot to Your Slack App)
Return to your Slack App page, and click Bot Users on the left sidebar. Click Add Bot User. Keep the default settings.
返回您的Slack App页面,然后点击左侧栏中的Bot Users 。 单击添加Bot用户 。 保留默认设置。
The final step is to authorize the app. In your browser, type: https://<username>.api.stdlib.com/<apin
ame>@dev/
最后一步是授权应用程序。 在浏览器中,输入: https://<username>.api.stdlib.com/<apin
ame> @ dev /
Click the Add to Slack button. You will be taken to another authorization screen.
单击添加到松弛按钮。 您将被带到另一个授权屏幕。
Click Authorize. You should see a success message!
点击授权 。 您应该会看到一条成功消息!
步骤10:测试您的Slack Meetup应用程序 (Step 10: Test Your Slack Meetup Application)
You’re all done. Try it out! Your Slack App is now available for use in the Slack workspace you authorized it for. Your Slack app should respond to a /nextmeetup<94709>&<ja
vascript> as I show in the screenshot above.
大功告成 试试看! 您的Slack应用程序现在可以在您为其授权的Slack工作区中使用。 正如我在上面的屏幕快照中所示,您的Slack应用应响应/nextmeetup<94709>&<ja
vascript>。
就是了,谢谢! (That is it & Thank You!)
I hope you found this tutorial helpful. I would love for you to comment here, e-mail me at Janeth [at] stdlib [dot] com, or follow Standard Library on Twitter, @StdLibHQ .
希望本教程对您有所帮助。 我希望您在这里发表评论 , 给我发电子邮件给Janeth [at] stdlib [dot] com ,或者在Twitter上关注标准库 @StdLibHQ 。
Janeth Ledezma is a Developer Advocate for Standard Library and Cal grad — go bears! When she isn’t learning the Arabic language, or working out, you can find her exploring NorCal on her CBR500R. ??? Follow her journey with Standard Library through Twitter @mss_ledezma.
Janeth Ledezma是标准库和Cal研究生的开发倡导者-快死了! 当她不学习阿拉伯语或正在锻炼时,您可以在CBR500R上找到她探索NorCal的知识。 ??? 通过Twitter @ms s_ledezma跟着标准图书馆走下去。
翻译自: https://www.freecodecamp.org/news/how-to-build-a-meetup-slack-app-with-standard-library-52f96b27d95a/
meetup
相关文章:

.NET使用OpenSSL生成的pem密钥文件[1024位]
using System; using System.Text; using System.Security.Cryptography; using System.Web; using System.IO;namespace Thinhunan.Cnblogs.Com.RSAUtility {public class PemConverter{/// <summary>/// 将pem格式公钥转换为RSAParameters/// </summary>/// <…

[2014百度之星资格赛]
第一个问题: Energy Conversion Problem Description魔法师百小度也有遇到难题的时候——如今。百小度正在一个古老的石门面前,石门上有一段古老的魔法文字,读懂这样的魔法文字须要耗费大量的能量和大量的脑力。过了许久。百小度最终读懂魔法…

视频录制,压缩实现源码
实现代码: <!DOCTYPE html> <html><head><meta charset"utf-8"><title></title><meta name"viewport" content"widthdevice-width, initial-scale1.0"><!-- <script src"./js…

alexa技能个数_如何在您的技能中使用Alexa演示语言
alexa技能个数by Garrett Vargas通过Garrett Vargas 如何在您的技能中使用Alexa演示语言 (How to use Alexa Presentation Language in your skill) Amazon recently released the Alexa Presentation Language (APL). APL provides a richer display for multimodal skills. …

HTML与XML总结
阅览《孙欣HTML》和《刘炜XML》过了一段时间,在这里学到的内容用思维导图来概括。HTML与XML都是标记语言。 同样点: HTML文档与XML文档有类似的结构。前者是(head和body)后者是(声明和主体),大致…

ant PageHeaderWrapper 返回上一页
PageHeaderWrapper 返回上一页实现代码: <PageHeaderWrappertitle{false}content{<a onClick{() > router.goBack()}><Icon type"left" />返回</a>}breadcrumb{{routes: [{ path: /, breadcrumbName: 首页 },{ path: /pay_orde…

ruby 新建对象_Ruby面向对象编程的简介
ruby 新建对象by Saul Costa由Saul Costa Object-oriented programming (OOP) is a programming paradigm organized around objects. At a high level, OOP is all about being able to structure code so that its functionality can be shared throughout the application.…

ASP.NET导出文件FileResult的使用
本文给大家讲一下ASP.NET MVC中如何使用FileResult来导出文件,首先网上相关例子有很多大神都有讲,我在这只是稍微说一点不同——为什么我的导出没有反应呢? 这个问题,我找了半天也没有找到,最后是在一个网友的评论中体…

【AHOI 2016初中组】 自行车比赛 - 贪心
题目描述 小雪非常关注自行车比赛,尤其是环滨湖自行车赛。一年一度的环滨湖自行车赛,需要选手们连续比赛数日,最终按照累计得分决出冠军。今年一共有 N 位参赛选手。每一天的比赛总会决出当日的排名,第一名的选手会获得 N 点得分&…

【Ant Design Pro 三】样式动态绑定 react样式绑定
第一步,创建样式文件,在页面目录下根据自己习惯创建一个less文件,用来写样式类 第二部,引用该文件 import styles from ./details.less; //details.less 代码: .menu {width: 95%; } .navigation-menu{width: 90%; …

react hooks使用_如何使用React和Hooks检测外部点击
react hooks使用by Andrei Cacio通过安德烈卡西奥(Andrei Cacio) 如何使用React和Hooks检测外部点击 (How to detect an outside click with React and Hooks) “外部点击”是什么意思? (What does “Outside Click” mean?) You can think of it as the “anti-b…

正则表达式(1)
正则表达式的概念 正则表达式是一个字符串,使用单个字符串来描述、用来定义匹配规则,匹配一系列符合某个句法规则的字符串。在开发中,正则表达式通常被用来检索、替换那些符合某个规则的文本。 正则表达式的匹配规则 字符类:[abc]…

Android 曲线动画animation,类似加入购物车动画
按照惯例先放效果图:图中小球做抛物线运动 资源图片 1.首先布局文件activity_main.xml,布局很简单,就一个测试按钮 1 <RelativeLayout xmlns:android"http://schemas.android.com/apk/res/android"2 xmlns:tools"http:…

小程序音频播放报10001 解决方案 errCode:10001, errMsg:errCode:602,err:error,not found param
音频播放有两种方式: 第一种: innerAudioContext.src audioSrc;innerAudioContext.play(); 第二种: innerAudioContext.autoplay true;innerAudioContext.src audioSrc; 之前使用第一种,华为手机不能正常播放,…

在线学位课程_您在四年制计算机科学学位课程中学到的知识
在线学位课程by Colin Smith通过科林史密斯 您在四年制计算机科学学位课程中学到的知识 (What you learn in a 4 year Computer Science degree) I recently wrote an article on whether you need a computer science degree to get a job in tech. I thought that going ove…

Swift学习笔记-协议(Protocols)
1.0 翻译:geek5nan 校对:dabing1022 2.0 翻译:futantan 校对:小铁匠Linus 定稿:shanksyang 本页包含内容: 协议的语法(Protocol Syntax)对属性的规定(Property Requireme…

JavaScript简单重写构造器的原型
1 //简单重写原型对象:2 3 //一个构造函数Person4 function Person(){5 6 }7 //重写Person的原型8 //把Person的原型赋值给一个新的对象 是我们重写的过程9 Person.prototype{ 10 // 对于构造器 如果我们不给他写,则构造器就是Object的构造器了 …

node.js cannot find module
找不到模块的解决方案 : 把node_module整个文件夹删掉,然后npm clean cache,看下package.json里有没有express的依赖项,有的话直接npm install,没有的话 npm install express --save。 有人说 npm clean cache 命令变成了 npm cache clean,可以都试一下

我在React Native中构建时获得的经验教训
by Amanda Bullington通过阿曼达布林顿(Amanda Bullington) 我在React Native中构建时获得的经验教训 (Lessons I learned while building in React Native) When I received an offer for a software engineering role to build an app in React Native, I wasn’t sure what…

【Ant Design Pro 五】箱套路由在菜单栏显示返回上一页
效果图: 场景:从菜单栏进入子页面,但是子页面默认不在路由显示,完成操作后需要返回上级页面。所以要在菜单栏中加返回的功能。 实现代码: import React from react; import { Button, Card, Icon } from antd; impor…

[002] The Perks of Being a Wallflower - 读后记
The Perks of Being a Wallflower 今天(2015年10月30日 18:26:17)读完"The Perks of Being a Wallflower". 本书290页,我是在小米pad上完成阅读的,epub格式,花费四天时间,每天至少5小时. 生词很多,就不一一列出了. 使用透析法并不强求完全的正确理解原文.强调完整的阅…

ios集成firebase_如何将Firebase与您的应用程序集成
ios集成firebaseYou’ve probably heard about Firebase, but may not know much about how it works and how it fits in with your application. Well, you’ve come to the right place. We’ll go over what Firebase is and how to integrate it with your Android projec…

PLSQL创建Oracle定时任务
转自:http://www.cnblogs.com/yx007/p/6519544.html#_label0转载于:https://www.cnblogs.com/good-tomorrow/p/7443817.html

判断h5是不是在小程序中
执行代码: if (ua.indexOf(MicroMessenger) -1) {//说明不在微信中// 走不在小程序的逻辑 } else {wx.miniProgram.getEnv(function(res) {if (res.miniprogram) {// 走在小程序的逻辑} else {// 走不在小程序的逻辑}}) }

CSS3关于过渡效果的问题
首先trasition:transform只是单单表示后面只要有含有的tranform的所有属性可以参与动画,而trasition:all表示后面所有动画属性都可以参动画,当父容器有relative时,子容器有absolute,子容器会跟着父容器相对定位。当你想要然后一个…

在线学位课程_如何选择计算机科学学位课程
在线学位课程by Colin Smith通过科林史密斯 如何选择计算机科学学位课程 (How to choose a Computer Science degree program) I remember combing through the countless computer science programs online and feeling a bit lost on what I should be looking for. I ended…

Dubbo 入门实例 本地伪集群测试Demo
1. 概述 Dubbo是一个分布式服务框架,致力于提供高性能和透明化的RPC远程服务调用方案,以及SOA服务治理方案 Dubbo是阿里巴巴SOA服务化治理方案的核心框架,每天为2,000个服务提供3,000,000,000次访问量支持,并被广泛应用于阿里巴…

Vue源码终笔-VNode更新与diff算法初探
写完这个就差不多了,准备干新项目了。 确实挺不擅长写东西,感觉都是罗列代码写点注释的感觉,这篇就简单阐述一下数据变动时DOM是如何更新的,主要讲解下其中的diff算法。 先来个正常的html模板: <body><div id…

JS获取当月每天的日期,JS获取本周每天的日期
获取当前月每天的日期,获取当前周每天的日期实现代码: 调用代码: console.log(-----------------, getNowM(), getWeekDay()) 结果:我今天是2020-2-28日 封装方法: function getDay(num, str) {var today new Dat…

@Scheduled注解的scheduler属性什么作用
注解是 Spring Framework 提供的一种机制,用于定义计划任务,即周期性执行的任务。 注解可以应用于方法上,以指示 Spring 容器在特定的时间间隔或按照某种调度规则来调用该方法。 属性是 注解的一个可选属性,它的作用是允许开发者指定一个自定义的 对象来控制任务的调度方式。默认情况下, 注解使用 Spring 内部的 来执行任务,但如果需要更高级的定制化需求,可以通过 属性指定一个自定义的 实现。自定义调度器:共享调度器资源:高级调度需求:假设你想使用 作为调度器,并且希望所有带有