Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
node_modules | |
*.swp |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
function getDistance(lon1, lat1, lon2, lat2) { | |
var R = 6371; // Radius of the earth in km | |
var dLat = toRad(lat2-lat1); | |
var dLon = toRad(lon2-lon1); | |
var a = Math.sin(dLat/2) * Math.sin(dLat/2) + | |
Math.cos(toRad(lat1)) * Math.cos(toRad(lat2)) * | |
Math.sin(dLon/2) * Math.sin(dLon/2); | |
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); | |
return R * c; // Distance in km | |
} |
def balance(chars: List[Char], open: Int): Boolean = { | |
if (chars.isEmpty) | |
open == 0 | |
else if (chars.head == '(') | |
balance(chars.tail, open + 1) | |
else if (chars.head == ')' && open > 0) | |
// found an unmatched '(' earlier | |
balance(chars.tail, open - 1) | |
else | |
balance(chars.tail, open) |
This means, on your local machine, you haven't made any SSH keys. Not to worry. Here's how to fix:
*nix
based command prompt (but not the default Windows Command Prompt!)cd ~/.ssh
. This will take you to the root directory for Git (Likely C:\Users\[YOUR-USER-NAME]\.ssh\
on Windows).ssh
folder, there should be these two files: id_rsa
and id_rsa.pub
. These are the files that tell your computer how to communicate with GitHub, BitBucket, or any other Git based service. Type ls
to see a directory listing. If those two files don't show up, proceed to the next step. NOTE: Your SSH keys must be named id_rsa
and id_rsa.pub
in order for Git, GitHub, and BitBucket to recognize them by default.ssh-keygen -t rsa -C "your_email@example.com"
. Th/* | |
* Copyright (c) 2013 Google Inc. | |
* | |
* 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 |
Bundle bundle = new Bundle(); | |
bundle.putString("fields", "picture.type(large),quotes,email,first_name,last_name,username"); | |
final Request request = new Request(ParseFacebookUtils.getSession(), | |
"me", bundle, HttpMethod.GET, new Request.Callback() { | |
@Override | |
public void onCompleted(Response response) { | |
GraphObject graphObject = response.getGraphObject(); | |
if (graphObject != null) { | |
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
WARNING: If you're reading this in 2021 or later, you're likely better served by reading:
(This gist was created in 2013 and targeted the legacy GOPATH mode.)
$ ssh -A vm
$ git config --global url."git@github.com:".insteadOf "https://github.com/"