Skip to content

Instantly share code, notes, and snippets.

View robertu7's full-sized avatar
🏁
#0d6763, #c0a46b

robertu robertu7

🏁
#0d6763, #c0a46b
View GitHub Profile
@robertu7
robertu7 / ST3-Packages.md
Last active July 19, 2017 03:15
Sublime Text 3 Packages
@robertu7
robertu7 / JSON.method.js
Created February 5, 2016 01:57
Javascript JSON.parse and JSON.stringify
// Deep Copy https://jsperf.com/deep-copy-vs-json-stringify-json-parse
var copy = JSON.parse(JSON.stringify(targetObject))
// Find and Modify Deeply Nested Object
JSON.parse(JSON.stringify(targetObject).replace(/replaceThis/g, 'toThis'))
@robertu7
robertu7 / isNaN.js
Last active August 29, 2015 14:24
Check a number is NaN
function _isNaN(val){
return val !== val
}
@robertu7
robertu7 / utf8-base64.js
Last active August 29, 2015 14:18
UTF-8 - Base64
/*
Copyright Vassilis Petroulias [DRDigit]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
@robertu7
robertu7 / LinuxCommands.sh
Last active August 29, 2015 14:18
Linux 常用命令
# 查看端口佔用
sudo netstat -plunt
# 設置持久環境變量
vim ~/.bash_proflle
export XXX=xxxxxx
@robertu7
robertu7 / MEAN.sh
Created April 5, 2015 14:17
Install MEAN on CentOS 7
#!/bin/bash
####### Nginx #######
# Install
sudo yum install epel-release
sudo yum install nginx
# Start
sudo systemctl start nginx.service
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload
@robertu7
robertu7 / convertEncoding
Created March 31, 2015 01:29
把一个文件的编码从 UTF-8 转换成 UTF-16
iconv -f utf8 -t utf16 /path/to/file
@robertu7
robertu7 / Distance.js
Created March 30, 2015 09:26
Calculates the distance between two points (given the latitude/longitude of those points)
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//::: :::
//::: This routine calculates the distance between two points (given the :::
//::: latitude/longitude of those points). It is being used to calculate :::
//::: the distance between two locations using GeoDataSource (TM) prodducts :::
//::: :::
//::: Definitions: :::
//::: South latitudes are negative, east longitudes are positive :::
//::: :::
//::: Passed to function: :::