Skip to content

Instantly share code, notes, and snippets.

View anhdiepmmk's full-sized avatar

PHẠM NGỌC ĐIỆP anhdiepmmk

View GitHub Profile
@anhdiepmmk
anhdiepmmk / doom.txt
Created March 4, 2022 04:54 — forked from hjertnes/doom.txt
Doom Emacs Cheatsheet
SPC
SPC: find file
, switch buffer
. browse files
: MX
; EX
< switch buffer
` eval
u universal arg
x pop up scratch
const { AbilityBuilder, Ability, ForbiddenError } = require("@casl/ability");
const { packRules } = require("@casl/ability/extra");
const { can, cannot, rules } = new AbilityBuilder(Ability);
// BlogPost
can("manage", "BlogPost", { author: 1 });
cannot("delete", "BlogPost");
// User
@anhdiepmmk
anhdiepmmk / README.md
Created February 28, 2022 04:34 — forked from martinklepsch/README.md
A very minimal Emacs configuration to get started with Emacs & Evil-mode

A Starting Point for using Emacs & Evil-mode

(I wrote a bit about why Emacs and Vim on my blog and thought it might be nice to give some starting point for people that want to try it.)

If you just want to play around with Emacs & Evil mode do the following:

  1. mkdir ~/.emacs.d/
  2. copy init.el into ~/.emacs.d/
  3. Download Emacs from http://emacsformacosx.com
@anhdiepmmk
anhdiepmmk / init.el
Last active February 28, 2022 17:26
emacs configuration file
;; Set up package.el to work with MELPA
(require 'package)
(require 'use-package)
(package-initialize)
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/"))
(add-to-list 'package-archives '("melpa" . "http://stable.melpa.org/packages/"))
(use-package org
:ensure t)
@anhdiepmmk
anhdiepmmk / page-info.ts
Created February 25, 2022 12:41 — forked from tumainimosha/page-info.ts
NestJS Graphql Cursor Based pagination
import { ObjectType, Field } from "@nestjs/graphql";
@ObjectType()
export class PageInfo {
@Field({ nullable: true })
startCursor: string;
@Field({ nullable: true })
endCursor: string;
@anhdiepmmk
anhdiepmmk / .ideavimrc
Last active August 3, 2023 14:29
my configuration vimrc for intellij
let mapleader = " "
set relativenumber number
set surround
set ignorecase
set scrolloff=999
set highlightedyank
let g:highlightedyank_highlight_color = "rgba(160, 160, 160, 155)"
let g:highlightedyank_highlight_duration = "500"
@anhdiepmmk
anhdiepmmk / vim-maps.vim
Created January 3, 2022 12:28 — forked from jcmuller/vim-maps.vim
Useful vim key mappings
""""""""""""""""""""""""
" Useful maps
""""""""""""""""""""""""
" Map <C-L> (redraw screen) to also turn off search highlighting until the
" next search
nnoremap <C-L> :nohl<CR><C-L>
" Don't use arrow keys
map <up> <nop>
map <down> <nop>
@anhdiepmmk
anhdiepmmk / rules.mk
Last active January 3, 2022 16:17
xiudi/xd68/config.h
/*
Copyright 2019 Michael Campbell
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@anhdiepmmk
anhdiepmmk / nft.js
Last active November 20, 2021 12:49
const {
Client,
TokenCreateTransaction,
PrivateKey,
TokenType,
TokenSupplyType,
TokenMintTransaction,
TokenNftInfoQuery,
NftId,
} = require("@hashgraph/sdk");
@anhdiepmmk
anhdiepmmk / better-sqlite3-example.js
Last active January 15, 2022 00:15
a small script that demonstrate how to use better-sqlite3
const Database = require('better-sqlite3');
const db = new Database('foobar.db', { verbose: console.log });
const commandToCreateUserTable = `
CREATE TABLE IF NOT EXISTS users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL,
created_at timestamp NOT NULL DEFAULT current_timestamp,
updated_at timestamp NOT NULL DEFAULT current_timestamp