Skip to content

Instantly share code, notes, and snippets.

View harishkotra's full-sized avatar
🏠
Working from home

Harish Kotra harishkotra

🏠
Working from home
View GitHub Profile
@harishkotra
harishkotra / discord-role-add.js
Created April 20, 2024 17:54
✅ Discord.js v14.14.1: Add Role on Reaction Add
/**
* Easily add roles from Discord users when they add a specific reactions using discord.js v14.14.1. (discord.js 14+)
*/
const { Client, Events, GatewayIntentBits, Partials } = require('discord.js');
const client = new Client({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMessageReactions],
partials: [Partials.Message, Partials.Channel, Partials.Reaction],
});
@harishkotra
harishkotra / discord-role-remove.js
Created April 17, 2024 03:26
✅ Discord.js v14.14.1: Remove Role on Reaction Removal
/**
* Easily remove roles from Discord users when they remove specific reactions using discord.js v14.14.1. (discord.js 14+)
*/
const { Client, Events, GatewayIntentBits, Partials } = require('discord.js');
const client = new Client({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMessageReactions],
partials: [Partials.Message, Partials.Channel, Partials.Reaction],
});
@harishkotra
harishkotra / custom-thank-you-message-woocommerce.php
Created December 16, 2019 13:19
Custom thank you message after order is placed to show to the customer in woocommerce.
/*
* Custom thank you message after order is placed to show to the customer in woocommerce.
*/
add_filter( 'woocommerce_thankyou_order_received_text', 'holikau_custom_ty_msg' );
function holikau_custom_ty_msg ( $thank_you_msg ) {
$thank_you_msg = 'Thank you for placing an order with us! Our Customer Care Executive will review your order & get in touch with you shortly regarding your date & time of delivery. Incase you want to make changes to your order please call +91-9849427575!';
return $thank_you_msg;
}
@harishkotra
harishkotra / vscode.sh
Created May 11, 2019 05:25
Run Visual Studio Code as root
sudo code --user-data-dir="~/.vscode-root"
@harishkotra
harishkotra / countries.json
Created April 15, 2019 11:37
A list of all countries in JSON. Data last updated on March 1, 2019 and as per https://www.britannica.com/topic/list-of-countries-1993160
[
{ name: "Afghanistan" },
{ name: "Albania" },
{ name: "Algeria" },
{ name: "Andorra" },
{ name: "Angola" },
{ name: "Antigua and Barbuda" },
{ name: "Argentina" },
{ name: "Armenia" },
{ name: "Australia" },
@harishkotra
harishkotra / RemoveDuplicates.java
Created July 10, 2018 12:43
Design an algorithm and write code to remove the duplicate characters in a string
import java.io.*;
import java.util.*;
public class RemoveDuplicates{
public static void main(String []args){
String s = "aabnsbsbsssbbsbsbs";
char[] characters = s.toCharArray();
Set<Character> newSet = new LinkedHashSet<Character>();
@harishkotra
harishkotra / ReverseString.java
Created July 10, 2018 11:21
Java program to reverse a string without worrying about a null.
public class ReverseString{
public static void main(String []args){
String myString = "this is the test";
System.out.println(reverse(myString));
}
public static String reverse(String str){
System.out.println("Original Length " + str.length());
char[] data = str.toCharArray();
@harishkotra
harishkotra / ReverseString.java
Created July 10, 2018 11:21
Java program to reverse a string without worrying about a null.
public class ReverseString{
public static void main(String []args){
String myString = "this is the test";
System.out.println(reverse(myString));
}
public static String reverse(String str){
System.out.println("Original Length " + str.length());
char[] data = str.toCharArray();
@harishkotra
harishkotra / npm-updater.txt
Created May 6, 2018 07:36
Steps to update npm on Windows
**This is the new best way to upgrade npm on Windows.**
**Run PowerShell as Administrator**
Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
npm install -g npm-windows-upgrade
npm-windows-upgrade
@harishkotra
harishkotra / decryptor.php
Last active April 16, 2018 13:10
Decrypt CodeIgniter Password
<?php
$encrypted_password = 'ENCRYPTED_PASSWORD_HERE';
$key = 'KEY_FROM_CONFIG_FILE_HERE';
$decrypted_string = $this->encrypt->decode($encrypted_password, $key);
echo $decrypted_string;
?>