Skip to content

Instantly share code, notes, and snippets.

View DungGramer's full-sized avatar
🔥
React, JS

Nguyễn Công Dũng DungGramer

🔥
React, JS
View GitHub Profile
@DungGramer
DungGramer / sinhvien.cpp
Created September 4, 2020 19:34
Tạo class Sinh vien, tính điểm trung bình, sắp xếp theo điểm trung bình, xuất điểm trung bình > 7, xoá 1 vị trí bất kỳ
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define foreach(length) for(int i = 0; i < length; ++i)
class SinhVien {
public:
string maSV;
string hoTen;
string lop;
@DungGramer
DungGramer / Client.java
Created September 28, 2020 03:46
Send data client to Server, then print result to client
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Scanner;
public class Client {
public static void main(String[] args) throws IOException {
//tạo socket kết nối đển Server
@DungGramer
DungGramer / Book.java
Created September 28, 2020 18:40
Quản lý sinh viên bằng db4o
package Bai1;
import com.db4o.ObjectContainer;
import com.db4o.ObjectSet;
import com.db4odoc.f1.chapter1.Pilot;
import java.util.List;
import java.util.Scanner;
public class Book {
<template>
<div>
<div class="main">
<div class="menuBar__button">
<button class="menuBar__button-submit"><a>Nộp bài</a></button>
</div>
<div class="menubar-container">
<div>
<span class="menuBar__title">Bài test: junior BA</span>
@DungGramer
DungGramer / CSS - Edit Content
Last active February 21, 2022 18:10
Debug CSS using Bookmarklet
javascript:(function(){document.designMode=document.designMode==="on"?"off":"on"})();
@DungGramer
DungGramer / Color branch git - Terminal Ubuntu
Created February 19, 2021 11:07
Add these lines in your ~/.bashrc file
force_color_prompt=yes
color_prompt=yes
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;31m\]$(parse_git_branch)\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(parse_git_branch)\$ '
fi
function createRipple(event) {
const button = event.currentTarget;
const circle = document.createElement("span");
const diameter = Math.max(button.clientWidth, button.clientHeight);
const radius = diameter / 2;
circle.style.width = circle.style.height = `${diameter}px`;
circle.style.left = `${event.clientX - button.offsetLeft - radius}px`;
circle.style.top = `${event.clientY - button.offsetTop - radius}px`;
circle.setAttribute("ripple", "");
@DungGramer
DungGramer / HTML Text Editor
Last active February 28, 2021 07:13
Make browser to Text Editor
data:text/html,<html contenteditable><style>body{color:rgb(79 79 79);background:rgb(250 250 250);font-family:"Cascadia Code","Fira Code Retina","Consolas","Roboto Mono","Courier New",monospace;font-size:16px;line-height:1.688;padding:34px 16px 32px 32px;border-radius:10px;width:min(80ch, calc(100% - 64px));margin:15px auto;box-shadow:0 0px 40px rgba(0,0,0,0.13);white-space:break-spaces}body>*>*,body>*{white-space:break-spaces !important}</style></html>
Using Git Bash for run if using Windows
Ex: addComponent.sh pages/dropdown-menu
--> src/components/pages/dropdown-menu
.
|-- DropdownMenu.jsx
`-- DropdownMenu.module.scss
@DungGramer
DungGramer / fetcher.js
Last active September 4, 2021 04:07
Simple fetch snippet for Chrome
async function fetcher(
url,
method = 'get',
body = undefined,
headers = {
'Content-Type': 'application/json',
},
) {
try {
const response = await fetch(url, {