This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# The install script is licensed under the MIT license Glide itself is under. | |
# See https://github.com/Masterminds/glide/blob/master/LICENSE for more details. | |
# To run this script execute: | |
# `curl https://glide.sh/get | sh` | |
PROJECT_NAME="glide" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
location /docs/ { | |
proxy_pass http://{author}.gitbook.io/{book}/; | |
sub_filter_once off; | |
sub_filter_types *; | |
sub_filter "/{book}/" "/docs/"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
METHOD 1 | |
This should roughly sort the items on distance in MySQL, and should work in SQLite. | |
If you need to sort them preciser, you could try using the Pythagorean theorem (a^2 + b^2 = c^2) to get the exact distance. | |
--- | |
SELECT * | |
FROM table | |
ORDER BY ((lat-$user_lat)*(lat-$user_lat)) + ((lng - $user_lng)*(lng - $user_lng)) ASC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log(getTZDiff('UTC+5:30','UTC+8:00')); | |
function getTZDiff(currentTz, otherTz) { | |
var selectedTz = new Date('January 1, 1970 00:00:00 ' + currentTz); | |
var targetTz = new Date('January 1, 1970 00:00:00 ' + otherTz); | |
var difference = selectedTz.getTime() - targetTz.getTime(); | |
var hours = (difference / 3600000); | |
if (hours < 0) return Math.abs(hours) + " hours behind"; | |
return Math.abs(hours) + " hours ahead"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export GO_VERSION=1.10 | |
export GO_DOWNLOAD_URL=https://storage.googleapis.com/golang/go$GO_VERSION.linux-amd64.tar.gz | |
export GOPATH=/root/local/lib/go | |
export GOROOT=/usr/local/go | |
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin | |
mkdir ${GOPATH} | |
chown ${USER} -R ${GOPATH} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
GVERSION="1.8.3" | |
GFILE="go$GVERSION.linux-amd64.tar.gz" | |
GOPATH="$HOME/projects/go" | |
GOROOT="/usr/local/go" | |
if [ -d $GOROOT ]; then | |
echo "Installation directories already exist $GOROOT" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
apt-get install -y \ | |
apt-transport-https \ | |
ca-certificates \ | |
curl \ | |
software-properties-common | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - | |
apt-key fingerprint 0EBFCD88 | |
add-apt-repository \ | |
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
func echo(strings []int) []interface{} { | |
ids := []interface{}{} | |
for _, s := range strings { | |
ids = append(ids, s) |