Skip to content

Instantly share code, notes, and snippets.

View Troland's full-sized avatar
🎯
Focusing

Tris Roland Troland

🎯
Focusing
  • China
View GitHub Profile

Set rz and sz on Mac

There are a mess of troubles in sending and receiving files from my macbook to dev server, since I had no permission to excute command scp on dev server. Here is a lightweight, quick, and convenience tools which related with ssh, called lrzsz. lrzsz is a unix communication package providing the XMODEM, YMODEM, ZMODEM file transefer protocol which usually has been already installed in most of servers.

Prerequisites

  • iTerm2 is necessary. [Here][] is the official website.
/**
Code copyright Dustin Diaz and Ross Harmes, Pro JavaScript Design Patterns.
**/
// Constructor.
var Interface = function (name, methods) {
if (arguments.length != 2) {
throw new Error("Interface constructor called with " + arguments.length + "arguments, but expected exactly 2.");
}
this.name = name;
@Troland
Troland / deepClone.txt
Created July 29, 2020 11:58
deepClone include prop of date, regexp etc.
function deepClone(obj) {
function getType(obj) {
return Object.prototype.toString.call(obj).replace(/^\[object (.+)\]$/, '$1').toLowerCase();
}
const type = getType(obj)
if (!obj || typeof obj !== 'object') {
return obj
}
@Troland
Troland / getType.txt
Created July 29, 2020 04:56
get data type
function getType(obj) {
return Object.prototype.toString.call(obj).replace(/^\[object (.+)\]$/, '$1').toLowerCase();
}
@Troland
Troland / index.md
Created May 4, 2019 14:57 — forked from SethRobertson/index.md
Commit Often, Perfect Later, Publish Once: Git Best Practices
@Troland
Troland / stuns
Created February 25, 2019 10:40 — forked from zziuni/stuns
STUN server list
# source : http://code.google.com/p/natvpn/source/browse/trunk/stun_server_list
# A list of available STUN server.
stun.l.google.com:19302
stun1.l.google.com:19302
stun2.l.google.com:19302
stun3.l.google.com:19302
stun4.l.google.com:19302
stun01.sipphone.com
stun.ekiga.net
@Troland
Troland / moment-locale-resolver.js
Created January 28, 2019 09:04 — forked from fabulator/moment-locale-resolver.js
Resolve best locale for moment
import moment from 'moment';
import {
LocaleResolver,
NavigatorDetector,
FallbacksTransformer,
DefaultLocaleTransformer,
} from 'locales-detector';
// moment locales are in lowercase, need it change en-GB to en-gb
class LowerCaseTransformer {
@Troland
Troland / media-query.css
Created December 10, 2018 13:11 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
@Troland
Troland / isInit.txt
Created November 14, 2018 09:32
isInter
// 判断是否整数
const isInt = (n) => {
return Number(n) === n && n % 1 === 0;
}
@Troland
Troland / isFloat.txt
Created November 14, 2018 09:32
isFloat
// 判断是否浮点数
const isFloat = (n) => {
return Number(n) === n && n % 1 !== 0;
}