Skip to content

Instantly share code, notes, and snippets.

View shkbahmad's full-sized avatar
🤘

Shakeeb Ahmad shkbahmad

🤘
View GitHub Profile
@schmidt1024
schmidt1024 / location.ts
Last active October 5, 2021 17:23
start external map navigation from ionic 2 app for ios and android; needs cordova-plugin-geolocation
startExternalMap() {
if (this.location.latitude) {
this.platform.ready().then(() => {
Geolocation.getCurrentPosition().then((position) => {
// ios
if (this.platform.is('ios')) {
window.open('maps://?q=' + this.location.name + '&saddr=' + position.coords.latitude + ',' + position.coords.longitude + '&daddr=' + this.location.latitude + ',' + this.location.longitude, '_system');
};
// android
if (this.platform.is('android')) {
@lappi-lynx
lappi-lynx / prawn_io_image.rb
Created March 3, 2016 16:20
Prawn PDF images with Base64 and StringIO
def render
pdf = Prawn::Document
pdf.image StringIO.new(Base64.decode64(splitBase64(BASE64_IMAGE_GOES_HERE)[:data])), at: [10, cursor - 50], width: 200, height: 125
end
def splitBase64(uri)
if uri.match(%r{^data:(.*?);(.*?),(.*)$})
return {
type: $1, # "image/png"
encoder: $2, # "base64"
@danharper
danharper / demo.md
Last active January 20, 2024 16:09
Open native Maps apps on iOS and Android in Cordova
iOS (with pin, iOS will lookup address too and show that as label)
maps://?q=LAT,LNG
Android, no pin (just open at location)
geo:LAT,LNG
@oswaldoacauan
oswaldoacauan / gist:7580474
Created November 21, 2013 12:06
jQuery - Serialize Form with File inputs
(function($) {
$.fn.serializeFiles = function() {
var form = $(this),
formData = new FormData()
formParams = form.serializeArray();
$.each(form.find('input[type="file"]'), function(i, tag) {
$.each($(tag)[0].files, function(i, file) {
formData.append(tag.name, file);
});