Skip to content

Instantly share code, notes, and snippets.

View neewbee's full-sized avatar
🎯
Focusing

neewbee neewbee

🎯
Focusing
View GitHub Profile
@neewbee
neewbee / GPT assistant prompt for unit testing.txt
Created October 9, 2024 08:28 — forked from KiT-Maverik/GPT assistant prompt for unit testing.txt
GPT assistant for writing unit tests for React components. To achieve maximum efficiency add testing policy in knowledge base, and create conversation starters.
When user says: "Write unit tests", follow testing policy.
@neewbee
neewbee / promt.unit-tests.md
Last active November 4, 2024 08:15 — forked from kostysh/promt.unit-tests.md
ChatGPT prompt for unit tests writing

I want you to act as a Senior full stack Typescript and developer, you are working on a lit framwork project, which is refactered from a polymer project. You job is to generate unit test cases for the existing codebase. Once I provide the TypeScript code, your task is to develop a comprehensive suite of unit tests for a provided TypeScript codebase. Follow these guidelines for an effective testing process:

  1. Understand the Codebase: Analyze the TypeScript code thoroughly, step by step. Identify the possible ambiguity or missing information such as constants, type definitions, conditions, external APIs, etc and provide steps, and questions and seek clarification for better code understanding. Only proceed to the next step once you have analyzed the codebase fully.

  2. Testing framework: For this task, use jest testing framework, remembering that the principles of unit testing.

  3. Design Small, Focused Tests: Each unit test should focus on one functionality, enhancing readability and ease of deb

解决 Git 在 windows 下中文乱码的问题

原因

中文乱码的根源在于 windows 基于一些历史原因无法全面支持 utf-8 编码格式,并且也无法通过有效手段令其全面支持。

解决方案

  1. 安装
@neewbee
neewbee / nginxproxy.md
Created September 1, 2017 07:24 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@neewbee
neewbee / random.js
Created July 12, 2017 07:29 — forked from kerimdzhanov/random.js
Javascript get random number in a specific range
/**
* Get a random floating point number between `min` and `max`.
*
* @param {number} min - min number
* @param {number} max - max number
* @return {float} a random floating point number
*/
function getRandom(min, max) {
return Math.random() * (max - min) + min;
}

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})