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
function savebase64AsFile(folderPath, fileName, base64, contentType){
var DataBlob = b64toBlob(base64,contentType);
window.resolveLocalFileSystemURL(folderPath, function(dir) {
dir.getFile(fileName, {create:true}, function(file) {
file.createWriter(function(fileWriter) {
fileWriter.write(DataBlob);
fileWriter.onwrite = function(){
console.log('File written successfully.');
}
}, function(){
function CreateDirectory() {
var parentDirectory = cordova.file.externalRootDirectory;
var directoryToCreate = {{ FOLDER_NAME }}; // Make sure to change this to the directory name
window.resolveLocalFileSystemURL( parentDirectory , function (dirEntry) {
function successHandler() {
console.log('Directory created');
}
function errorHandler(err) {
console.log('Error in creating directory.', err);
}
@gauravmehla
gauravmehla / how-to-use-mac-keychain-to-store-github-repos-credentials.md
Created July 18, 2017 07:02 — forked from nepsilon/how-to-use-mac-keychain-to-store-github-repos-credentials.md
How to use Mac KeyChain to store GitHub repos credentials? — First published in fullweb.io issue #108

How to use Mac KeyChain to store GitHub repos credentials?

You know the pain, you cloned a repo over HTTPS, and now Git asks you for your password each time you want to push or pull.

Chances are you already have the git credential-osxkeychain command installed. If not, just install Git with brew: brew install git.

Once installed, just tell Git to use the KeyChain to store your credentials:

git config --global credential.helper osxkeychain

bomb_baby

The challenge specification

You're so close to destroying the LAMBCHOP doomsday device you can taste it! But in order to do so, you need to deploy special self-replicating bombs designed for you by the brightest scientists on Bunny Planet. There are two types: Mach bombs (M) and Facula bombs (F). The bombs, once released into the LAMBCHOP's inner workings, will automatically deploy to all the strategic points you've identified and destroy them at the same time.

But there's a few catches. First, the bombs self-replicate via one of two distinct processes: Every Mach bomb retrieves a sync unit from a Facula bomb; for every Mach bomb, a Facula bomb is created; Every Facula bomb spontaneously creates a Mach bomb.

For example, if you had 3 Mach bombs and 2 Facula bombs, they could either produce 3 Mach bombs and 5 Facula bombs, or 5 Mach bombs and 2 Facula bombs. The replication process can be changed each cycle.

@gauravmehla
gauravmehla / translate.js
Created June 28, 2017 12:09 — forked from mgechev/translate.js
Translate.js
var translate = (function () {
var symbols = {
a: '([]+![])[+!+[]]',
b: '([]+{})[+!+[]+!+[]]',
c: '([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]]',
d: '([]+[][+[]])[+!+[]+!+[]]',
e: '([]+[][+[]])[+!+[]+!+[]+!+[]]',
f: '([]+[][+[]])[+!+[]+!+[]+!+[]+!+[]]',
g: '([]+([]+[])[([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+{})[+!+[]]+([]+[][+!+[]])[+!+[]]+([]+![])[+!+[]+!+[]+!+[]]+([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+!![])[+!+[]]+([]+!![])[+!+[]+!+[]]+([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+{})[+!+[]]+([]+!![])[+!+[]]])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]',
h: '(+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[])[([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+{})[+!+[]]+([]+([]+[])[([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+{})[+!+[]]+([]+[][+!+[]])[+!+[]]+([]+![])[+!+[]+!+[]+!+[]]+([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+!![])[+!+[]]+([]+!![])[+!+[]+!+[]]
@gauravmehla
gauravmehla / Projects-for-beginner.md
Last active June 22, 2017 02:53
[JS] Javascript projects for beginners.

JavaScript

  • annyang (label: first-timers-only)
    A popular Speech Recognition library used to communicate with everything from websites to smart mirrors to flying drones.
  • Clementine.js Boilerplate (label: beginner)
    The elegant and lightweight full stack JavaScript boilerplate.
  • PouchDB (label: first time only)
    PouchDB is a pocket-sized database.
  • Leaflet (label: easy fix)
    JavaScript library for mobile-friendly interactive maps.
  • angular-formly (label: first-timers-only)
    JavaScript powered forms for AngularJS.
  • Dragula (label: first-timers-only)
    Drag and drop so simple it hurts.
@gauravmehla
gauravmehla / .bash_profile
Last active June 21, 2017 15:24
🖥 iTerm color scheme and configurations http://imgur.com/fJiGs9s
# Setting PATH for Python 3.4
# The orginal version is saved in .bash_profile.pysave
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "
PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}"
export PATH=${PATH}:/usr/local/mysql/bin/
export ANDROID_HOME=/Development/android-sdk/
export PATH=$PATH:/usr/local/mongodb/bin
PS1="\n$PS1"
export PATH=$PATH:/Users/gaurav/Library/Android/sdk/platform-tools
@gauravmehla
gauravmehla / ArrayIterate.js
Created June 16, 2017 07:14 — forked from NishiGaba/iterate-over-array.js
8 Methods to Iterate through Array
//8 Methods to Iterate through Array
//forEach (Do Operation for Each Item in the Array)
[1,2,3].forEach(function(item,index) {
console.log('item:',item,'index:',index);
});
//map (Translate/Map all Elements in an Array to Another Set of Values.)
const oneArray = [1,2,3];
const doubledArray = oneArray.map(function(item) {
@gauravmehla
gauravmehla / license-badges.md
Created June 16, 2017 05:49 — forked from lukas-h/license-badges.md
License Badges for your Project

Markdown License badges

Collection of License badges for your Project's README file.
This list includes the most common open source and open data licenses.
Easily copy and paste the code under the badges into your Markdown files.

Notes

  • Badges are made with Shields.io.
  • This badges do not fully replace the license informations for your projects, they are only emblems for the README, that the user can see the License at first glance.  
  • 🇫🇷 Cette liste en français