Skip to content

Instantly share code, notes, and snippets.

View gauravmehla's full-sized avatar
🚀
to the sky and beyond

Gaurav Mehla gauravmehla

🚀
to the sky and beyond
View GitHub Profile
@gauravmehla
gauravmehla / android-sdk-linux-cli
Created November 9, 2017 11:13 — forked from rikyperdana/android-sdk-linux-cli
Ubuntu 14.04 command line install android sdk
# install openjdk
sudo apt-get install openjdk-7-jdk lib32stdc++6 lib32z1
# download android sdk
wget http://dl.google.com/android/android-sdk_r24.2-linux.tgz
tar -xvf android-sdk_r24.2-linux.tgz
# install all sdk packages
cd android-sdk-linux/tools
./android update sdk --no-ui
#!/bin/bash
cat /path/to/public_key | ssh root@yourdokkuinstance "sudo sshcommand acl-add dokku [description]"

HTTP Status Codes

GET

200 : OK - The request was successful and the response body contains the representation requested.

302 : FOUND - A common redirect response; you can GET the representation at the URI in the Location response header.

304 : NOT MODIFIED - There is no new data to return.

@gauravmehla
gauravmehla / http-status-codes.md
Created October 30, 2017 13:21 — forked from subfuzion/http-status-codes.md
General REST API HTTP Status Codes

Reference: RFC 2616 - HTTP Status Code Definitions

General

  • 400 BAD REQUEST: The request was invalid or cannot be otherwise served. An accompanying error message will explain further. For security reasons, requests without authentication are considered invalid and will yield this response.
  • 401 UNAUTHORIZED: The authentication credentials are missing, or if supplied are not valid or not sufficient to access the resource.
  • 403 FORBIDDEN: The request has been refused. See the accompanying message for the specific reason (most likely for exceeding rate limit).
  • 404 NOT FOUND: The URI requested is invalid or the resource requested does not exists.
  • 406 NOT ACCEPTABLE: The request specified an invalid format.
function find_direction( direction ) {
var directions = [
"North",
"North-East",
"East",
"South-East",
"South",
"South-West",
"West",
"North-West"

Keybase proof

I hereby claim:

  • I am gauravmehla on github.
  • I am gauravmehla (https://keybase.io/gauravmehla) on keybase.
  • I have a public key whose fingerprint is 17EA AB82 A1FA C6B3 1911 1C58 69A5 C573 1EA4 1CCE

To claim this, I am signing this object:

function removeFile() {
var fileToRemove = cordova.file.externalRootDirectory + '/image.jpeg'; // Change this with your file path
window.resolveLocalFileSystemURL( fileToRemove, function (dirEntry) {
function successHandler() {
console.log('Directory deleted successfully');
}
function errorHandler() {
console.log('There is some error while deleting directory')
}
dirEntry.remove(successHandler, errorHandler);
function removeDirectory() {
var directoryToRemove = cordova.file.externalRootDirectory + 'directoryName/'; // Change this path with your directory
window.resolveLocalFileSystemURL( directoryToRemove, function (dirEntry) {
function successHandler() {
console.log('Directory deleted successfully');
}
function errorHandler() {
console.log('There is some error while deleting directory')
}
dirEntry.removeRecursively(successHandler, errorHandler);
function readFile( pathToFile ){
resolveLocalFileSystemURL( pathToFile , function (fileEntry) {
fileEntry.file(function (file) {
var reader = new FileReader();
reader.onloadend = function (event) {
console.log(event)
};
reader.readAsDataURL(file);
});
});
function b64toBlob(b64Data, contentType, sliceSize) {
var contentType = contentType || '';
var sliceSize = sliceSize || 512;
var byteCharacters = atob(b64Data);
var byteArrays = [];
for (var offset = 0; offset < byteCharacters.length; offset += sliceSize) {
var slice = byteCharacters.slice(offset, offset + sliceSize);
var byteNumbers = new Array(slice.length);
for (var i = 0; i < slice.length; i++) {
byteNumbers[i] = slice.charCodeAt(i);