Skip to content

Instantly share code, notes, and snippets.

View YujiaY's full-sized avatar

Yujia (Jack) Yuan YujiaY

View GitHub Profile
@YujiaY
YujiaY / typescript-crash.ts
Created August 19, 2021 12:04 — forked from bradtraversy/typescript-crash.ts
Basic intro to TypeScript (From YouTube Crash Course)
// Basic Types
let id: number = 5
let company: string = 'Traversy Media'
let isPublished: boolean = true
let x: any = 'Hello'
let ids: number[] = [1, 2, 3, 4, 5]
let arr: any[] = [1, true, 'Hello']
// Tuple
@YujiaY
YujiaY / css-selectors.md
Created May 12, 2021 00:34 — forked from magicznyleszek/css-selectors.md
CSS Selectors Cheatsheet

CSS Selectors Cheatsheet

Element selectors

Element -- selects all h2 elements on the page

h2 {
    foo: bar;
@YujiaY
YujiaY / index.ts
Created October 23, 2020 03:41 — forked from Curtis017/index.ts
Simple middleware implementation using typescript and ES6
import pipeline, { Middleware } from './pipeline';
const step1: Middleware<any, any> = (req, res, next) => {
if (req.body) {
console.log(`STEP 1: \n req: ${JSON.stringify(req)}\n res: ${JSON.stringify(res)}`);
next();
}
}
const step2: Middleware<any, any> = async (req, res, next) => {
@YujiaY
YujiaY / wsl2-network.ps1
Created September 23, 2020 06:46 — forked from xmeng1/wsl2-network.ps1
WSL2 Port forwarding port to linux
$remoteport = bash.exe -c "ifconfig eth0 | grep 'inet '"
$found = $remoteport -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}';
if( $found ){
$remoteport = $matches[0];
} else{
echo "The Script Exited, the ip address of WSL 2 cannot be found";
exit;
}

Advanced JavaScript Learning Resources

This is a list of advanced JavaScript learning resources from people who responded to this [Tweet][13] and this [Tweet][20].

  • [You Don't Know JS][3]

  • [Frontend Masters courses by Kyle Simpson][12]

  • [@mpjme][6]'s [YouTube videos][5]

@YujiaY
YujiaY / Random-string
Created July 10, 2020 05:46 — forked from 6174/Random-string
Generate a random string in JavaScript In a short and fast way!
//http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
@YujiaY
YujiaY / app.js
Created October 8, 2019 07:38 — forked from stongo/app.js
Joi validation in a Mongoose model
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/test');
var db = mongoose.connection;
db.on('error', function() {
return console.error.bind(console, 'connection error: ');
});
@YujiaY
YujiaY / population-try
Created September 27, 2019 05:53 — forked from aikin/population-try
mongoose-population
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var ObjectId = mongoose.Types.ObjectId;
console.log('Running mongoose version %s', mongoose.version);
var UserSchema = new Schema({
name : String,
posts : [{
type : Schema.Types.ObjectId,
@YujiaY
YujiaY / devise.zh-CN.yml
Created April 4, 2017 07:46 — forked from HealthGrid/devise.zh-CN.yml
for devise 4.2.0
# Chinese (China) translations for Devise(4.2.0)
# by HealthGrid (https://github.com/HealthGrid)
zh-CN:
devise:
confirmations:
confirmed: "您的帐号已经确认,您现在已登录。"
send_instructions: "几分钟后,您将收到确认帐号的电子邮件。"
send_paranoid_instructions: "如果您的邮箱存在于我们的数据库中,您将收到一封确认账号的邮件。"
failure: