Skip to content

Instantly share code, notes, and snippets.

View huynguyen93's full-sized avatar
🌴
alive

Huy huynguyen93

🌴
alive
View GitHub Profile
@huynguyen93
huynguyen93 / simple-theme-toggle-server-side-render.html
Last active April 1, 2022 02:05
Simple switch theme toggle (server-side render)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<title>khoahuy.com</title>
{% set isDarkTheme = app.request.cookies.get('defaultTheme') == 'dark' %}
{% set cssLightUrl = 'assets/cssLight.css' %}
{% set cssDarkUrl = 'assets/cssDark.css' %}
<link
@huynguyen93
huynguyen93 / CollectionStreamer.php
Last active August 26, 2021 03:26
[Symfony - Doctrine] Iterate large amount of data without fetching all at once
<?php
namespace App\Service\Doctrine;
use Doctrine\ORM\EntityManagerInterface;
use Generator;
class CollectionStreamer
{
public static function stream(callable $fetch, int $chunkSize, callable $clear): Generator
@huynguyen93
huynguyen93 / zones.json
Created January 28, 2021 14:49
Vùng mức lương tối thiểu
{
"Hà Nội": {
"Ba Đình": "I",
"Bắc Từ Liêm": "I",
"Cầu Giấy": "I",
"Đống Đa": "I",
"Hà Đông": "I",
"Hai Bà Trưng": "I",
"Hoàn Kiếm": "I",
"Hoàng Mai": "I",
@huynguyen93
huynguyen93 / my-theme.zsh-theme
Created March 31, 2020 02:47
Oh my zsh - fullpath theme
# put line below in ~/.zshrc
# ZSH_THEME="my-theme"
PROMPT="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
PROMPT+=' %{$fg[cyan]%}%d%{$reset_color%} $(git_prompt_info)'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"