Skip to content

Instantly share code, notes, and snippets.

View amrayoub's full-sized avatar

amrayoub amrayoub

  • Egypt
View GitHub Profile
@stella-yc
stella-yc / dijkstra.js
Last active August 24, 2023 20:46
Dijkstra's Algorithm in Javascript using a weighted graph
const problem = {
start: {A: 5, B: 2},
A: {C: 4, D: 2},
B: {A: 8, D: 7},
C: {D: 6, finish: 3},
D: {finish: 1},
finish: {}
};
const lowestCostNode = (costs, processed) => {
@ihadeed
ihadeed / googlemap.component.ts
Last active September 8, 2017 04:49
Ionic 2 + Ionic Native + Google Maps Plugin
import { Component, AfterViewInit, Input, Output, EventEmitter } from '@angular/core';
import { Platform } from 'ionic-angular';
import { GoogleMap } from 'ionic-native';
@Component({
selector: 'GoogleMap',
template: '<div [id]="id" [style.height]="height" [style.width]="width" style="display: block;"></div>'
})
export class GoogleMapComponent implements AfterViewInit {
@Input() id: string = 'GoogleMap';
@Input() height: string = '100%';
@dwolner
dwolner / encryptMedia.js
Last active March 9, 2017 11:58
function in cordova to encrypt media with custom plugin
function initFS() {
//init and maintain fs, look into removing
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fs) {
appFileSystem = fs;
fs.root.getDirectory("Wanagogo", {create: true, exclusive: false}, function(dirEntry) {
mainAppDir = dirEntry
k('defining main app dir', dirEntry)
//look at downloads
mainAppDir.getDirectory("downloads", {create: true, exclusive: false}, function(dirEntry) {
@bcabanes
bcabanes / cordovaListFileEntries.js
Created December 10, 2015 16:07
Cordova/PhoneGap: List all files entries in directories provided.
/**
* Starter vars.
*/
var index = 0;
var i;
/**
* Need cordova.file plugin.
* $ cordova plugin add org.apache.cordova.file
*
@staltz
staltz / introrx.md
Last active November 14, 2024 11:27
The introduction to Reactive Programming you've been missing