Skip to content

Instantly share code, notes, and snippets.

View youngdze's full-sized avatar
🎯
Focusing

Justin Young youngdze

🎯
Focusing
View GitHub Profile
@youngdze
youngdze / keyrepeat.shell
Created July 22, 2020 16:20 — forked from kconragan/keyrepeat.shell
Enable key repeat in Apple Lion for Sublime Text in Vim mode
# Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key
# that enables you to choose a character from a menu of options. If you are on Lion
# try it by pressing and holding down 'e' in any app that uses the default NSTextField
# for input.
#
# It's a nice feature and continues the blending of Mac OS X and iOS features. However,
# it's a nightmare to deal with in Sublime Text if you're running Vintage (Vim) mode,
# as it means you cannot press and hold h/j/k/l to move through your file. You have
# to repeatedly press the keys to navigate.
{
"extends": [
"eslint:recommended",
"plugin:import/errors",
"plugin:import/warnings"
],
"parser": "babel-eslint",
"plugins": [
"react"
],
class Node {
constructor(key) {
this.key = key;
this.left = null;
this.right = null;
}
}
class BST {
constructor() {
在浏览器地址栏输入URL
浏览器查看缓存,如果请求资源在缓存中并且新鲜,跳转到转码步骤
如果资源未缓存,发起新请求
如果已缓存,检验是否足够新鲜,足够新鲜直接提供给客户端,否则与服务器进行验证。
检验新鲜通常有两个HTTP头进行控制Expires和Cache-Control:
HTTP1.0提供Expires,值为一个绝对时间表示缓存新鲜日期
HTTP1.1增加了Cache-Control: max-age=,值为以秒为单位的最大新鲜时间
浏览器解析URL获取协议,主机,端口,path
浏览器组装一个HTTP(GET)请求报文
浏览器获取主机ip地址,过程如下:
@youngdze
youngdze / cloudSettings
Last active August 14, 2020 02:58
Visual Studio code settings
{"lastUpload":"2020-08-14T02:56:53.597Z","extensionVersion":"v3.4.3"}
@youngdze
youngdze / sample-nginx.conf
Created July 13, 2016 08:20 — forked from cjus/sample-nginx.conf
AngularJS Nginx and html5Mode
server {
server_name yoursite.com;
root /usr/share/html;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}
let randomRange = (start, end) => {
return Math.floor(Math.random() * Math.abs(end - start + 1)) + start;
};
let swapArr = (arr, index1, index2) => {
let dummy = arr[index1];
arr[index1] = arr[index2];
arr[index2] = dummy;
};
var Node = function( data, left, right ){
this.data = data;
this.left = left;
this.right = right;
};
Node.prototype.getData = function(){
return this.data;
};
@youngdze
youngdze / Sort.java
Last active August 29, 2015 14:21
Sort algorithm in Java
public class Sort {
public static void main(String[] args) {
int arr[] = {2, 3, 1, 56, 88, 23, 10, 54, 40, 78, 29};
// bubbleSort(arr);
// selectionSort(arr);
insertionSort(arr);
for (int i : arr) {
System.out.print(i + " ");