Skip to content

Instantly share code, notes, and snippets.

@oldnapalm
oldnapalm / LoadCayoPerico.cs
Created July 1, 2021 17:20
GTA 5 SHVDN script to load Cayo Perico island
using System;
using GTA;
using GTA.Math;
using GTA.Native;
namespace LoadCayoPerico
{
public class LoadCayoPerico : Script
{
private Blip island;
@solundev
solundev / discordjs-slash-commands.md
Created April 25, 2021 06:03 — forked from advaith1/discordjs-slash-commands.md
Slash Commands in Discord.js

Slash Commands in Discord.js

These are some simple examples for using Slash Commands in discord.js.
discord.js doesn't have full support for slash commands yet (there's a pr) but you can still use the underlying api and websocket to use them.
Note that discord.js doesn't officially support using client.api, this is basically just a workaround until they fully release support. Do not ask for help with client.api in the discord.js server.

Please read Discord's Slash Command docs since they have actual docs and details for slash commands; the code examples below are just how you can implement it using discord.js.

Note that slash commands won't show in a server unless that server has authorized it with the applications.commands oauth2 scope (not just the bot scope).

@Nexxed
Nexxed / search_players.lua
Last active September 14, 2021 23:30
[FiveM] Search players based on string
-- search param must be a string thats either #<server_id> or a partial player name
-- e.g SearchPlayers("#1361") or SearchPlayers("test")
-- compatible with command arguments
-- 2nd example above will match "testuser", "userTest", "TeSt", "TEST" etc
-- server-side only, you *could* modify it for client-side rather easily, though
local function SearchPlayers(search)
-- initialize our return table
local ret = {}
@VijayaSankarN
VijayaSankarN / str_replace_n.php
Last active June 18, 2023 14:43
String replace nth occurrence using PHP
<?php
/**
* String replace nth occurrence
*
* @param type $search Search string
* @param type $replace Replace string
* @param type $subject Source string
* @param type $occurrence Nth occurrence
* @return type Replaced string
*/
~r~ = Red
~b~ = Blue
~g~ = Green
~y~ = Yellow
~p~ = Purple
~o~ = Orange
~c~ = Grey?
~m~ = Darker Grey
~u~ = Black
~n~ = New Line
@flangofas
flangofas / ConvertMS.js
Last active March 28, 2025 14:13
JS: Convert Milliseconds to days? minutes? seconds? or all!
function convertMiliseconds(miliseconds, format) {
var days, hours, minutes, seconds, total_hours, total_minutes, total_seconds;
total_seconds = parseInt(Math.floor(miliseconds / 1000));
total_minutes = parseInt(Math.floor(total_seconds / 60));
total_hours = parseInt(Math.floor(total_minutes / 60));
days = parseInt(Math.floor(total_hours / 24));
seconds = parseInt(total_seconds % 60);
minutes = parseInt(total_minutes % 60);
@yosko
yosko / batch-download.php
Created December 16, 2013 15:41
Batch download files from a list of URLs into your own server and ZIP it for a easier download to your computer.
<!doctype html>
<!--
PHP Batch Download Script
@author Yosko <[email protected]>
@copyright none: free and opensource
@link http://www.yosko.net/article32/snippet-05-php-telechargement-de-fichiers-par-lots
-->
<html lang="en-US">
<head>
@stilliard
stilliard / jsonToTable.php
Created October 9, 2012 13:24
JSON to HTML table
<?php
/**
* JSON data to html table
*
* @param object $data
*
*/
function jsonToTable ($data)
{