Skip to content

Instantly share code, notes, and snippets.

View negativems's full-sized avatar
😄

Mohamed negativems

😄
View GitHub Profile
@negativems
negativems / vscode-toggle-find-in-file.json
Last active April 18, 2023 09:49
VSCode toggle find in file (search view)
[
{ // You need only this shortcut
"key": "ctrl+shift+f",
"command": "workbench.files.action.focusFilesExplorer",
"when": "searchViewletVisible"
},
// COPY THIS ONLY:
// If you have the find view in the secondary side bar (the right)
{ // this open the find view

asd

.config/sxhkd/sxhkdrc

#...

# preselect the ratio with mouse scroll
super + ctrl + shift + {button4,button5}
   ~/.config/sxhkd/set_bspc_ratio.sh {up,down}
   
@negativems
negativems / php-switch.md
Last active January 31, 2023 12:21
CLI commands to list and switch between PHP versions

image

Usage

  • php-versions # Find all installed php versions in laragon folder (configurate)
  • php-use <version/lastest> # Switch to a php version changing env variables ($PATH)
  • (**NEW**) php-switch # Interactive beautiful menu using fzf

Script

Put this on your .bashrc (NOTE: This script is made to use in Windows with Git Bash)

@negativems
negativems / BukkitUtils.java
Created January 17, 2022 13:24
Bukkit Utils class from Icarus project
package net.zargum.plugin.icarus.utils;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Entity;
private static JsonObject itemToJson(ItemStack item, boolean useIndex, int index) {
if(item == null) return null;
Gson gson = new GsonBuilder().create();
// Map<String, Object> values = new LinkedHashMap<>();
JsonObject values = new JsonObject();
//Set data to variables
int id = item.getTypeId();
int amount = item.getAmount();
Team team = scoreboard.getTeam("team-"+index) == null ? scoreboard.registerNewTeam("team-"+index) : scoreboard.getTeam("team-"+index);
String prefix = "";
String entry = "";
String suffix = "";
Iterator<String> iterator = Splitter.fixedLength(16).split(line).iterator();
prefix = iterator.next();
entry = iterator.next();