Skip to content

Instantly share code, notes, and snippets.

View mchampaneri's full-sized avatar
😎
Exploring open source

Manish Champaneri mchampaneri

😎
Exploring open source
View GitHub Profile
# Note:
#
# Only hosting and functions are getting deployed in this
# script you should only deploy whole firebase project,
# If you are maintaining local copy of indexes and rules.
#
# Assuming that you have functions folder in your roote folder.
#
# This pipe line reads credentials from the gitlab envrioment.
# https://docs.gitlab.com/ee/ci/variables/README.html#create-a-custom-variable-in-the-ui
documentMap.toArray().map((msg) => {
// msg[0] is key
// msg[1] is element at key
console.log(msg[0],msg[1])
return
}
@mchampaneri
mchampaneri / firebase-immutable-js-orderedmap.js
Last active October 10, 2020 05:32
Using OrderdMap from immutable.js with firebase javascript example.
const { OrderedMap } = require('immutable');
var documentMap = OrderedMap()
const messageListner = () => {
let unsubscribe = database
.collection('documents')
.orderBy('created_at', 'asc')
.limitToLast(10)
.onSnapshot(async (snap) => {
for (let msg of snap.docs) {
@mchampaneri
mchampaneri / c.h
Created May 2, 2020 16:21 — forked from chai2010/c.h
Golang cgo objective-c cocoa button callback
#include <Cocoa/Cocoa.h>
extern void ButtonClick(void);
@interface GoPasser : NSObject
+ (void)buttonClick:(id)sender; // this should call the cgo function defined in main.go
@end
void StartApp(void);
@mchampaneri
mchampaneri / example.go
Created May 2, 2020 06:39 — forked from chai2010/example.go
Minimal Golang + Cocoa application using CGO. Build with `CC=clang go build`
package main
/*
#cgo CFLAGS: -x objective-c
#cgo LDFLAGS: -framework Cocoa
#import <Cocoa/Cocoa.h>
int
StartApp(void) {
[NSAutoreleasePool new];
@mchampaneri
mchampaneri / string-padding.go
Created December 20, 2018 05:51
string padding helper functions
package main
import "fmt"
func PadRight(str, pad string, lenght int) string {
for {
str += pad
if len(str) > lenght {
return str[0:lenght]
}
@mchampaneri
mchampaneri / datastore-to-bigquery-export.py
Created December 7, 2018 05:29
export data from datastore to bigquery
# Managed dump script file is already provided
# by google to manage datastore dump
# I have just extended the same script to load
# dump to bigquery as soon as dumping opertion
# is successfully done
import datetime
import httplib
import json
import logging
@mchampaneri
mchampaneri / firestore-code-work-with-dropzone.js
Created November 14, 2018 11:06
firestore code work with dropzone
function storage_upload(filedata, filehandle, DropzoneHandle, cb) {
// Getting Handle of the progressbar element of current file //
var progressBar = filehandle.previewElement.children[2]
// Firestore storage task
var task
// uuid for file being uploaded
var uuid_string = uuid()
@mchampaneri
mchampaneri / dropzone-config-code-for-firebase-storage.js
Created November 14, 2018 11:04
dropzone config code for firebase storage
var myDropzone = new Dropzone("form#dropzone", { // Make the whole body a dropzone
url: '/',
addRemoveLinks: true,
method: 'put',
chunking: true,
forceChunking: true,
autoQueue: false,
autoProcessQueue: false
});
myDropzone.autoDiscover = false;
@mchampaneri
mchampaneri / simpleGuiApp.html
Created June 14, 2018 11:46
simple gui html file
<html>
<head>
<head>
<title>Simple Calc</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
</head>
<body>
<label for="">Input First</label>