Skip to content

Instantly share code, notes, and snippets.

View manniru's full-sized avatar

MUHAMMAD MANNIR AHMAD manniru

View GitHub Profile
@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
FROM gitpod/workspace-full-vnc
USER gitpod
# Install custom tools, runtime, etc. using apt-get
# For example, the command below would install "bastet" - a command line tetris clone:
#
# RUN sudo apt-get -q update && # sudo apt-get install -yq bastet && # sudo rm -rf /var/lib/apt/lists/*
#
# More information: https://www.gitpod.io/docs/42_config_docker/
version: '3.2'
services:
db:
image: postgres
restart: always
volumes:
- db:/var/lib/postgresql/data
environment:
- POSTGRES_DB=nextcloud
cd /Applications/XAMPP/xamppfiles/htdocs/brilliant
sudo chown -R _www:_www .
sudo chgrp -R _www .
sudo chmod -R 777 .
@manniru
manniru / php_array_table.php
Created May 13, 2022 07:11 — forked from jasondavis/php_array_table.php
PHP Array to HTML Table
<?php
function html_table($data = array())
{
$rows = array();
foreach ($data as $row) {
$cells = array();
foreach ($row as $cell) {
$cells[] = "<td>{$cell}</td>";
}
@manniru
manniru / drupal_render_table_html.php
Created May 8, 2022 08:46
How to render a table in drupal 8 (with html in cells)
use Drupal\Core\Render\Markup;
$rows = [
[Markup::create('<strong>test 1</strong>'),'test'],
[Markup::create('<s>test 2</s>'), 'test'],
[Markup::create('<div>test 3</div>'), 'test'],
];
$header = [
'title' => t('Title'),
'content' => t('Content'),
@manniru
manniru / RESTClient.java
Created May 3, 2022 14:04 — forked from mohsinknsd/RESTClient.java
A REST Api client to deal get and post requests using OkHttp 3.
import android.content.Context;
import android.support.annotation.Nullable;
import android.util.Log;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Interceptor;
/**
* Redirect the User to Paystack / Paypal Payment Page
* @param Request $request
* @return URL
*/
public function redirectToGateway(Request $request)
{
//Check if user is logged in
if(Auth::check()){
//Check if the subscription for Professional Plan
@manniru
manniru / android_error.java
Created April 20, 2022 14:20
Can't create handler inside thread that has not called Looper.prepare()
JAVA
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
Toast toast = Toast.makeText(mContext, "Something", Toast.LENGTH_SHORT);
toast.show();
}
});