Skip to content

Instantly share code, notes, and snippets.

View NearHuscarl's full-sized avatar
🏚️

Near Huscarl NearHuscarl

🏚️
View GitHub Profile
@NearHuscarl
NearHuscarl / main.dart
Last active April 9, 2021 03:00 — forked from devoncarew/main.dart
54898767/enumerate-or-map-through-a-list-with-index-and-value-in-dart
// https://gist.github.com/NearHuscarl/86ce74d95798635e14c8b848863b429f
extension ExtendedIterable<E> on Iterable<E> {
/// Like Iterable<T>.map but callback have index as second argument
Iterable<T> mapIndexed<T>(T Function(E e, int i) f) {
var i = 0;
return map((e) => f(e, i++));
}
void forEachIndexed(void Function(E e, int i) f) {
@NearHuscarl
NearHuscarl / CodeExtensions
Created September 25, 2019 15:16
vscode extensions
code --list-extensions | % { "code --install-extension $_" }
code --install-extension CoenraadS.bracket-pair-colorizer
code --install-extension Dart-Code.dart-code
code --install-extension Dart-Code.flutter
code --install-extension dbaeumer.vscode-eslint
code --install-extension donjayamanne.githistory
code --install-extension DotJoshJohnson.xml
code --install-extension eamodio.gitlens
code --install-extension Equinusocio.vsc-material-theme
@NearHuscarl
NearHuscarl / Effect.cs
Created March 23, 2019 19:22
sfd effectnames
public static class Effect
{
public static readonly string BLOOD = "BLD";
// IGame.PlayEffect("CAM_S", Vector2 position, float strength, float milliseconds, bool UNDOCUMENTED)
// IGame.PlayEffect("CAM_S", Vector2.Zero, 1f, 500f, true)
public static readonly string CAMERA_SHAKER = "CAM_S";
// IGame.PlayEffect("CFTXT", Vector2 Position, string Text)
public static readonly string CUSTOM_FLOAT_TEXT = "CFTXT";
public static readonly string ELECTRIC = "Electric";
public static readonly string EXPLOSION = "EXP";
# -*- coding: utf-8 -*-
"""
Cho vali chứa được trọng lượng tối đa là W. Có n đồ vật được đánh số từ 1 đến n,
đồ vật thứ i có khối lượng weight[i] và giá trị value[i], 1 <= i <= n. Tìm cách
xếp đồ vật vào vali sao cho tổng giá trị các đồ vật trong vali là lớn nhất
"""
weight = [3, 4, 5, 2, 1]
value = [4, 5, 6, 3, 1]
@NearHuscarl
NearHuscarl / git_cmd.md
Last active August 1, 2018 09:30
some useful git commands

Change from https to ssh

git remote -v
# origin  https://github.com/NearHuscarl/dotfiles (fetch)
# origin  https://github.com/NearHuscarl/dotfiles (push)

git remote set-url origin [email protected]:NearHuscarl/dotfiles.git

git remote -v
# origin [email protected]:NearHuscarl/dotfiles.git (fetch)
@NearHuscarl
NearHuscarl / README.md
Last active July 9, 2020 09:30
debugging in shell script

Hướng dẫn debug trong shell script

Bình thường, khi shell script đang thi hành bị lỗi, nó chỉ in ra lỗi gì và ở dòng nào

./script.sh: line 20: [: lt: binary operator expected

Ở những lỗi cú pháp thì thông thường chỉ cần nhiêu đó thông tin là đủ.

@NearHuscarl
NearHuscarl / Japanese_emoij.ahk
Last active March 15, 2018 13:37
shortcuts to insert japanese emoijs...
; Japanese Emoijs
:::angry::(#`Д´)
:::awesome::°˖✧◝(⁰▿⁰)◜✧˖°
:::cry::(μ_μ)
:::fear::〣( ºΔº )〣
:::dcare::┐( ̄ヘ ̄)┌
:::confuse::( ̄ω ̄;)
:::surprise::Σ(O_O)
:::greet::(°▽°)/
:::hug::(づ ̄ ³ ̄)づ
@NearHuscarl
NearHuscarl / rofi-emoji.sh
Last active June 14, 2024 16:40 — forked from tadly/rofi-emoji.sh
Rofi emoji picker
#!/usr/bin/env bash
# Source: https://gist.github.com/Tadly/0741821d3694deaec1ee454a95c591fa
#
# Use rofi to pick emoji because that's what this
# century is about apparently...
#
# Requirements:
# rofi, xsel, xdotool, curl, xmllint
#
# Usage:
@NearHuscarl
NearHuscarl / git_workflow.md
Last active April 17, 2018 05:00
github development workflow

Clone repository:

$ cd /dirname/
$ git clone [email protected]:user_name/repository_name.git

Create a new branch

$ git branch new_branch

Change git branch to the new_branch

black="$(tput setaf 0)"
red="$(tput setaf 1)"
green="$(tput setaf 2)"
yellow="$(tput setaf 3)"
blue="$(tput setaf 4)"
magenta="$(tput setaf 5)"
cyan="$(tput setaf 6)"
white="$(tput setaf 7)"
reset="$(tput sgr0)"