Skip to content

Instantly share code, notes, and snippets.

View manniru's full-sized avatar

MUHAMMAD MANNIR AHMAD manniru

View GitHub Profile
@manniru
manniru / form1.jsx
Created September 22, 2022 13:27
Brilliant Gist
// ** MUI Imports
import Card from '@mui/material/Card'
import Grid from '@mui/material/Grid'
import Typography from '@mui/material/Typography'
import CardHeader from '@mui/material/CardHeader'
import CardContent from '@mui/material/CardContent'
import TextField from '@mui/material/TextField'
import Select from '@mui/material/Select'
import MenuItem from '@mui/material/MenuItem'
import InputLabel from '@mui/material/InputLabel'
@manniru
manniru / gotify_web_sample.html
Created September 20, 2022 20:10 — forked from erfg12/gotify_web_sample.html
Gotify web app sample code for send and receive.
<html>
<header>
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
<script>
// VARIABLES, PLEASE CHANGE
var APP_TOKEN = "AhCGJ-BEC3z.g8Q";
var CLIENT_TOKEN = "C25iT7U7E1xlzSk";
var GOTIFY_SERVER = "localhost:80";
// SEND INFO TO MSG SERVER
const XLSX = require('xlsx');const data = [
{ name: 'Diary', code: 'diary_code', author: 'Pagorn' },
{ name: 'Note', code: 'note_code', author: 'Pagorn' },
{ name: 'Medium', code: 'medium_code', author: 'Pagorn' },
]const workSheet = XLSX.utils.json_to_sheet(data);
const workBook = XLSX.utils.book_new();XLSX.utils.book_append_sheet(workBook, workSheet, "Sheet 1");
XLSX.writeFile(workBook, "./temp/sample.xlsx");
https://modularfirebase.web.app/common-use-cases/firestore/#crud-operations
@manniru
manniru / load_json_to_firstore.js
Created September 17, 2022 15:58 — forked from gregfenton/load_json_to_firestore.js
FIRESTORE: a node/javascript command-line script that loads JSON data into a Firestore database (could be cloud or local emulator)
/**
* load_json_to_firstore.js
*
* This code is a "node script" used to load data into your Firestore database, either in "the cloud" or the emulator.
*
* The script is a "client app", so it logs in with Firebase Auth using email/password from the variable USER1.
*
* The USER1 user ([email protected]) must exist in your Firebase project and have write access
* to the collection(s) you are populating. You can create that account via Firebase Console >> Authentication.
*
@manniru
manniru / axiosMockAdapterUse.js
Created September 16, 2022 02:21 — forked from alicekao/axiosMockAdapterUse.js
How to use axios mock adapter
// Fetch all places action to test in actions/index.js
import axios from 'axios';
export function fetchPlaces() {
return dispatch => {
return axios.get('/api/places/fetchAll')
.then(resp => {
dispatch(updatePlaces(resp.data));
})
.catch(err => {
sudo tail -F /var/log/apache2/error.log
DRUPAL MYSQL GROUP BY ERORR
'init_commands' => ['sql_mode' => "SET sql_mode = 'REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO’"]
@manniru
manniru / README.md
Created August 1, 2022 14:48 — forked from CodingDoug/README.md
Realtime Database triggers with Cloud Functions for Firebase - source

Realtime Database triggers with Cloud Functions for Firebase - source

This gist contains the source code in my video series about Realtime Database triggers. You can watch the three parts here:

  1. Part 1 (intro, onCreate)
  2. Part 2 (onUpdate, infinite loops)
  3. Part 3 (onDelete, transactions)

index.ts contains the Cloud Functions code, and dialog.ts contains the script to run

@manniru
manniru / mongo-auth.ts
Created July 30, 2022 18:36 — forked from Macarthurval/mongo-auth.ts
A typescript class to manage Baileys auth states in Mongo database
import { WAProto } from '@adiwajshing/baileys';
import { BufferJSON, initAuthCreds } from '@adiwajshing/baileys/lib/Utils';
import { Collection, Document, MongoClient } from 'mongodb';
import chalk from 'chalk';
export class MongoDbAuth{
static mongoUrl = "mongodb+srv://your-mongodb-url/DBName/?retryWrites=true&w=majority"
sim: string
private collection: Collection