Skip to content

Instantly share code, notes, and snippets.

View coomsie's full-sized avatar

coomsie coomsie

View GitHub Profile
@welcoMattic
welcoMattic / IonicCordovaNetwork.js
Last active December 4, 2021 04:33
Async navigator.connection.type service for Ionic Framework
var myApp = angular.module('myApp').service('CordovaNetwork', ['$ionicPlatform', '$q', function($ionicPlatform, $q) {
// Get Cordova's global Connection object or emulate a smilar one
var Connection = window.Connection || {
"CELL" : "cellular",
"CELL_2G" : "2g",
"CELL_3G" : "3g",
"CELL_4G" : "4g",
"ETHERNET" : "ethernet",
"NONE" : "none",
"UNKNOWN" : "unknown",
/*
* Needs a tile layer, something like (for Leaflet) ..
*
* var tl = L.tileLayer("content://com.pahasapatrails.m.tiles/{style}/{z}/{x}/{y}.png",
* { style: "XXX", minZoom: 9, maxZoom: 13, tms: true });
* map.addLayer(tl);
*
*
* Also needs a provider entry under the application tag in the Android
* Manifest, something like the following ..
@macdonst
macdonst / ft.js
Created October 4, 2012 17:14
FileTrasfer a bunch of files.
var remoteFiles = [];
function downloadRemotePDF() {
var local2User = JSON.parse( localStorage["locallessons"] );
$.each(local2User, function(key) {
remoteFiles.push(optionsJSON + local2User[key].idcountries + '/' + local2User[key].idcurriculum + '/' + local2User[key].idoptions + '/pdf/' + local2User[key].pdfname);
}
downloadFile();
}
@coomsie
coomsie / downloadosmtilestosqlite.pl
Created December 6, 2011 19:14
download tms tiles to insert into sqlite db
#! /usr/bin/perl
# 2011
# added a few mods to script to allow to be pushed into sqlite
# coomsie at gmail.com
use 5.006001;
use strict;
use warnings;
@leplatrem
leplatrem / gist:1415795
Created December 1, 2011 10:53
Tiles serialization in base64 using django and landez
import base64
from StringIO import StringIO
from django.http import HttpResponse
from django.utils import simplejson
from easydict import EasyDict as edict
from landez import TilesManager
from . import app_settings
@leplatrem
leplatrem / gist:1415767
Created December 1, 2011 10:47
Leaflet Offline Tiles using SQL Storage
/*
* L.TileLayer.LocalCache : A tile layer using SQL Storage, if available.
*/
L.TileLayer.LocalCache = L.TileLayer.extend({
options: {
minZoom: 0,
maxZoom: 18,
tileSize: 256,
subdomains: 'abc',
@madmanlear
madmanlear / titanium_migrations.js
Created March 9, 2011 22:10
Rails-like migrations for Titanium
/*
Model methods below requires Joli.js: https://github.com/xavierlacot/joli.js
Requires a tables named 'migrations' with columns id & version
Database migrations
Each migration is attached to a timestamp
When the migration is run, a record is added to the migrations table so it isn't run again
The rollback function takes a string date and rolls back all migrations since that date and deletes the migration record
Usage: