Skip to content

Instantly share code, notes, and snippets.

View hanzlahabib's full-sized avatar
:electron:
I may be slow to respond.

hanzla habib hanzlahabib

:electron:
I may be slow to respond.
View GitHub Profile
@hanzlahabib
hanzlahabib / readme.md
Created November 4, 2024 09:03 — forked from slava-vishnyakov/readme.md
How to upload images with TipTap editor
  1. Create a file Image.js from the source below (it is almost a copy of Image.js from tiptap-extensions except that it has a constructor that accepts uploadFunc (function to be called with image being uploaded) and additional logic if(upload) { ... } else { ... previous base64 logic .. } in the new Plugin section.
import {Node, Plugin} from 'tiptap'
import {nodeInputRule} from 'tiptap-commands'

/**
 * Matches following attributes in Markdown-typed image: [, alt, src, title]
 *
@hanzlahabib
hanzlahabib / private_fork.md
Created October 25, 2022 09:37 — forked from 0xjac/private_fork.md
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git

@hanzlahabib
hanzlahabib / event-handler.js
Created February 21, 2021 17:58 — forked from eh3rrera/event-handler.js
Code for the event handler of a PubNub Block that returns the base64 representation of the QR code of an URL
/*
SAMPLE PAYLOAD
{
"url": "https://google.com"
}
*/
// https://gist.github.com/jonleighton/958841
const base64ArrayBuffer = function(arrayBuffer) {
var base64 = '';
var encodings = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
@hanzlahabib
hanzlahabib / Socket.io-load-test.js
Last active August 9, 2020 16:52 — forked from jmyrland/test.js
Socket-io load test?
/**
* Modify the parts you need to get it working.
*/
var should = require('should');
var request = require('../node_modules/request');
var io = require('socket.io-client');
var serverUrl = 'http://localhost';
@hanzlahabib
hanzlahabib / axios-catch-error.js
Created June 20, 2020 14:45 — forked from fgilio/axios-catch-error.js
Catch request errors with Axios
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨
@hanzlahabib
hanzlahabib / namespaceComponent1.vue
Last active March 29, 2020 21:06 — forked from hootlex/Component.vue
How to use a namespaced action in a Vue.js component
<template>
<div>
<button @click="actionMethod">Increment</button>
</div>
</template>
<script>
import { mapActions } from 'vuex'
export default{
methods: {