abstract class ASong(
    var songId: Int = 0,
    var title: String? = "",
    var clipArt: String? = "",
    var artist: String? = "",
    var source: String? = "",
    var songType: Int = 0,
    var length: String? = "",
    var downloadPath: String? = "",
    var category: String? = ""
) : Parcelable {

    @Transient
    var totalDuration: Long = 0
    @Transient
    var currentPosition: Long = 0
    @Transient
    var playingPercent = 0

    private fun calculatePlayingPercent(): Int {
        return if (currentPosition == 0L || totalDuration == 0L) 0 else (currentPosition * 100 / totalDuration).toInt()
    }

}
© 2021 GitHub, Inc

Probably meant to stand for AbstractSong. Ens up sounding awkward or like somebody who just wrote their first class.

By peakvalleytech, 2021-11-13 00:07:44
                Path path = FileSystems.getDefault().getPath("../../../../../../../../../../EmailResults.csv");
                Files.deleteIfExists(path);
By Anonymous, 2021-11-12 20:18:57
#define private public
#define protected public
#define class struct

#include "your_private_parts.hpp"
// ...

#undef class
#undef protected
#undef private

// ...

Fails miserably if template <class>, template <template <class> class> or their variations are found anywhere inside your header. :(

By 2 + 2 = 3.99999999999999999999999999999999999, 2021-11-08 07:59:05
isCreatedUser : !this.isEdit ? true : false

Vue.js project, someone wanted to verify if the user was being edited or created...

By rat, 2021-10-21 17:11:54
const handleBoolean = value => {
        switch (value) {
            case "true":
                return true;
            case true:
                return "true";
            case "false":
                return false;
            case false:
                return "false"
            default:
                return null;
        }
    }
By Anonymous, 2021-09-29 11:53:22
'use strict'

// exports //

module.exports = Math.sqrt
By Igor, 2021-09-01 21:28:26
for (const order of orders) {
    for (const resultItem of results) {
        if (resultItem.machine != "TRANSFER") {
            shiftsLoop: for (const shift of resultItem.shifts) {
                if (shift.products) {
                    for (const product of shift.products) {
                        if (product.product == order.product) {
                            for (const routing of routings) {
                                if (routing.output == order.product) {
                                    const machinePlant = findMachinePlant(resultItem.machine, machines)
                                    if (routing.type == "ODP") {
                                        if (machinePlant == order.plant) {
                                            const msg = createMessage(order, shift, resultItem.machine, CHOR)
                                            requests.push(buildRequest(msg))
                                        } else {
                                            //CHEE CHIE CHEI
                                        }
                                        break shiftsLoop
                                    } else if (routing.type == "OCL" || routing.type == "RCL") {
                                        const msg = createMessage(order, shift, resultItem.machine, CHCL)
                                        requests.push(buildRequest(msg))
                                        //CHCL
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
By sgaloppo, 2021-08-28 20:28:59
.stepper a{
}

.stepper>div>div>div>div>a{
  color: transparent !important;
}
stepper>div>div>div>div>span{
  color: transparent !important;
}

.stepper>div>div>div:nth-child(1)>div>a:after, .stepper>div>div>div:nth-child(1)>div>span:after{
  color: rgb(52, 58, 64);
  content: '4' !important;
  margin-left: -10px;
}
.stepper>div>div>div:nth-child(2)>div>a:after{
  color: rgb(52, 58, 64);
  content: '3' !important;
  margin-left: -10px;
}
.stepper>div>div>div:nth-child(3)>div>a:after{
  color: rgb(52, 58, 64);
  content: '2' !important;
  margin-left: -10px;
}
.stepper>div>div>div:nth-child(4)>div>a:after{
  color: rgb(52, 58, 64);
  content: '1' !important;
  margin-left: -10px;
}
.stepper>div>div>div:nth-child(4)>div>span:after{
  color: rgb(52, 58, 64);
  background-color: rgb(108, 117, 125);
  content: '1' !important;
  margin-left: -10px;
}
.stepper>div>div>div:nth-child(3)>div>span:after{
  color: rgb(52, 58, 64);
  background-color: rgb(108, 117, 125);
  content: '2' !important;
  margin-left: -10px;
}
.stepper>div>div>div:nth-child(2)>div>span:after{
  color: rgb(52, 58, 64);
  background-color: rgb(108, 117, 125);
  content: '3' !important;
  margin-left: -10px;
}
.stepper>div>div>div:nth-child(1)>div>span:after{
  color: rgb(52, 58, 64);
  background-color: rgb(108, 117, 125);
  content: '4' !important;
  margin-left: -10px;
}
By Anonymous, 2021-08-11 11:24:55
Button.MouseButton1Click:Connect(function()
    if TextHolder.Text == Codes.Code1 then
        if Check1.Value == false then
            Check1.Value = true
        elseif Check1.Value == false then
            TextHolder.Text = "Code Already Redeemed"
        Event:FireServer("Code1")
        TextHolder.Text = "Success! 500 Coins Rewarded"
    elseif TextHolder.Text == Codes.Code2 then
        if Check2.Value == false then
            Check2.Value = true
        elseif Check2.Value == false then
            TextHolder.Text = "Code Already Redeemed"
        Event:FireServer("Code2")
        TextHolder.Text = "Success! 250 Coins Rewarded"
    elseif TextHolder.Text == Codes.Code3 then
        if Check3.Value == false then
            Check3.Value = true
        elseif Check3.Value == false then
            TextHolder.Text = "Code Already Redeemed"
        Event:FireServer("Code3")
        TextHolder.Text = "Sucess! 100 Coins Rewarded"
            else TextHolder.Text = "Invalid/Expired Code"
                end
            end
        end
    end
end)
By ShitFuck, 2021-08-07 00:55:53

class Timer extends React.Component{
    state ={
        time: 10
    };
    setInvt = () =>{
        let t = this.state.time
        if(t<=1){
            clearInterval(this.invertal)
        }
        this.setState({time: t-1})
    }
    componentDidMount(){
        this.invertal = setInterval(this.setInvt, 1000)
    }

    render(){
        return (<label>{this.state.time}</label>)
    }
}

export {Timer}
By Anonymous, 2021-07-30 21:13:46
if(products.Length < 0) {
    foreach (var p in products)
    {
        //...
    }
}
By Anonymous, 2021-07-24 20:56:07
@Pipe({ name: 'shortSex' })
export class SexPipe implements PipeTransform {
  public transform(value: any): 'M' | 'K' {
    switch (value?.code) {
      case SexCodes.MALE:
        return 'M';
      case SexCodes.FEMALE:
        return 'K';
      default:
        return null;
    }
  }
}

What can I say more?

By Anonymous, 2021-07-21 10:44:17
@EventHandler
	public void onCpUse(PlayerMoveEvent e) {
		Player player = e.getPlayer();
		if(Main.main.state != Gamestate.JUMP) return;
		if(!Main.main.alive.contains(player)) return;
		Location loc = e.getPlayer().getLocation();
		  loc.setY(loc.getY() -1);
		  Block standingOnBlock = loc.getBlock();
		  int currentCP = Main.main.checkpointTracker.get(player);
			int nextCP = currentCP+1;
		  if(standingOnBlock.getType() == Material.EMERALD_BLOCK) {
			  Main.main.lm.setLocation(Main.main.map + "x" + nextCP + "x" + player.getName(), player.getLocation());
			  standingOnBlock.setType(Material.BEDROCK);
				giveCPEquip(player, nextCP);
					Main.main.checkpointTracker.put(player, nextCP);
					Main.main.scoreboard.setIngameScoreboard(player);
					player.sendMessage(Main.main.pr + "�aDu hast den " + nextCP + ". Checkpoint erreicht!");
					if(Main.main.particleTracker.containsKey(player)) {
						player.spawnParticle(Main.main.particleTracker.get(player), player.getLocation(), 10);
					}
			 		player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 10, 1);
		  }
	}
	public void giveCPEquip(Player p, int cp) {
		Inventory i = p.getInventory();
		ItemStack cp1Helmet = Main.main.utils.create(Material.LEATHER_HELMET, 1);
		ItemStack cp1Chest = Main.main.utils.create(Material.LEATHER_CHESTPLATE, 1);
		ItemStack cp1Leggings = Main.main.utils.create(Material.LEATHER_LEGGINGS, 1);
		ItemStack cp1Boots = Main.main.utils.create(Material.LEATHER_BOOTS, 1);
		
		ItemStack cp2Sword = Main.main.utils.createSharp1Item(Material.STONE_SWORD, 1);
		
		ItemStack cp3Apples = Main.main.utils.create(Material.GOLDEN_APPLE, 3);
		
		ItemStack cp4Chest = Main.main.utils.create(Material.CHAINMAIL_CHESTPLATE, 1);
		ItemStack cp4Leggings = Main.main.utils.create(Material.CHAINMAIL_LEGGINGS, 1);
		
		ItemStack cp5Helmet = Main.main.utils.create(Material.IRON_HELMET, 1);
		ItemStack cp5Boots = Main.main.utils.create(Material.IRON_BOOTS, 1);
		
		//6 Add extra Herzen
		
		ItemStack cp7Sword = Main.main.utils.create(Material.DIAMOND_SWORD, 1);
		
		ItemStack cp8Sword = Main.main.utils.create(Material.SHIELD, 1);
		
		
		ItemStack cp1Helmet1 = Main.main.utils.create(Material.DIAMOND_HELMET, 1);
		ItemStack cp1Chest1 = Main.main.utils.create(Material.DIAMOND_CHESTPLATE, 1);
		ItemStack cp1Leggings1 = Main.main.utils.create(Material.DIAMOND_LEGGINGS, 1);
		ItemStack cp1Boots1 = Main.main.utils.create(Material.DIAMOND_BOOTS, 1);
		
		ItemStack cp2Sword1 = Main.main.utils.createSharp1Item(Material.DIAMOND_SWORD, 1);
		
		ItemStack cp3Apples1 = Main.main.utils.create(Material.SHIELD, 1);
		
		ItemStack cp4Leggings1 = Main.main.utils.create(Material.NETHERITE_LEGGINGS, 1);
		
		ItemStack cp5Helmet1 = Main.main.utils.create(Material.NETHERITE_HELMET, 1);
		ItemStack cp5Boots1 = Main.main.utils.create(Material.NETHERITE_BOOTS, 1);
		
		//6 Add extra Herzen
		
		ItemStack cp7Sword1 = Main.main.utils.create(Material.NETHERITE_CHESTPLATE, 1);
		
		ItemStack cp8Sword1 = Main.main.utils.createSharp1Item(Material.NETHERITE_SWORD, 1);
		
		
		ItemStack cp1Helmet2 = Main.main.utils.create(Material.GOLDEN_HELMET, 1);
		ItemStack cp1Chest2 = Main.main.utils.create(Material.GOLDEN_CHESTPLATE, 1);
		ItemStack cp1Leggings2 = Main.main.utils.create(Material.GOLDEN_LEGGINGS, 1);
		ItemStack cp1Boots2 = Main.main.utils.create(Material.GOLDEN_BOOTS, 1);
		
		ItemStack cp2Sword2 = Main.main.utils.createSharp1Item(Material.STONE_SWORD, 1);
		
		ItemStack cp3Apples2 = Main.main.utils.create(Material.GOLDEN_APPLE, 3);
		ItemStack cp3Apple2 = Main.main.utils.create(Material.SHIELD, 1);
		
		ItemStack cp4Leggings2 = Main.main.utils.create(Material.IRON_LEGGINGS, 1);
		
		ItemStack cp5Helmet2 = Main.main.utils.create(Material.IRON_HELMET, 1);
		ItemStack cp5Boots2 = Main.main.utils.create(Material.IRON_BOOTS, 1);
		
		//6 Add extra Herzen
		
		ItemStack cp7Sword2 = Main.main.utils.create(Material.IRON_CHESTPLATE, 1);
		
		ItemStack cp8Sword2 = Main.main.utils.createSharp1Item(Material.IRON_SWORD, 1);
		
		
		
		if(!Main.main.random) {
		if(Main.main.rn ==0) {
		if(cp == 1) {
			i.addItem(cp1Helmet);
			i.addItem(cp1Chest);
			i.addItem(cp1Leggings);
			i.addItem(cp1Boots);
		}else if(cp == 2) {
			i.addItem(cp2Sword);
		}else if(cp == 3) {
			i.addItem(cp3Apples);
		}else if(cp == 4) {
			i.addItem(cp4Chest);
			i.addItem(cp4Leggings);
		}else if(cp == 5) {
			i.addItem(cp5Helmet);
			i.addItem(cp5Boots);
		}else if(cp == 6) {
			p.setMaxHealth(24);
			p.sendMessage(Main.main.pr + "�aDu hast zwei Extraherzen erhalten!");
		}else if(cp == 7) {
			i.addItem(cp7Sword);
		}else if(cp == 8) {
			i.addItem(cp8Sword);
			if(Main.main.fallTracker.get(p) == 0) {
				p.sendMessage(Main.main.pr + "Du hast das Ziel ohne JumpFail erreicht!");
				p.getInventory().addItem(Main.main.utils.create(Material.DIAMOND_HELMET, 1));
			}
			Bukkit.broadcastMessage(Main.main.pr + "�5" + p.getName() + " �a hat das Ziel erreicht!");
			Main.main.cd.cancelIngameTask();
			Main.main.cd.startDeathmatchCD();
		}
	}else if(Main.main.rn == 1) {
		if(cp == 1) {
			i.addItem(cp1Helmet1);
			i.addItem(cp1Chest1);
			i.addItem(cp1Leggings1);
			i.addItem(cp1Boots1);
		}else if(cp == 2) {
			i.addItem(cp2Sword1);
		}else if(cp == 3) {
			i.addItem(cp3Apples1);
		}else if(cp == 4) {
			i.addItem(cp4Leggings1);
		}else if(cp == 5) {
			i.addItem(cp5Helmet1);
			i.addItem(cp5Boots1);
		}else if(cp == 6) {
			p.setMaxHealth(24);
			p.sendMessage(Main.main.pr + "�aDu hast zwei Extraherzen erhalten!");
		}else if(cp == 7) {
			i.addItem(cp7Sword1);
		}else if(cp == 8) {
			i.addItem(cp8Sword1);
			if(Main.main.fallTracker.get(p) == 0) {
				p.sendMessage(Main.main.pr + "Du hast das Ziel ohne JumpFail erreicht!");
				p.getInventory().addItem(Main.main.utils.create(Material.GOLDEN_APPLE, 10));
			}
			Bukkit.broadcastMessage(Main.main.pr + "�5" + p.getName() + " �a hat das Ziel erreicht!");
			Main.main.cd.cancelIngameTask();
			Main.main.cd.startDeathmatchCD();
		}
	}else if(Main.main.rn == 2) {
		if(cp == 1) {
			i.addItem(cp1Helmet2);
			i.addItem(cp1Chest2);
			i.addItem(cp1Leggings2);
			i.addItem(cp1Boots2);
		}else if(cp == 2) {
			i.addItem(cp2Sword2);
		}else if(cp == 3) {
			i.addItem(cp3Apples2);
			i.addItem(cp3Apple2);
		}else if(cp == 4) {
			i.addItem(cp4Leggings2);
		}else if(cp == 5) {
			i.addItem(cp5Helmet2);
			i.addItem(cp5Boots2);
		}else if(cp == 6) {
			p.setMaxHealth(24);
			p.sendMessage(Main.main.pr + "�aDu hast zwei Extraherzen erhalten!");
		}else if(cp == 7) {
			i.addItem(cp7Sword2);
		}else if(cp == 8) {
			i.addItem(cp8Sword2);
			if(Main.main.fallTracker.get(p) == 0) {
				p.sendMessage(Main.main.pr + "Du hast das Ziel ohne JumpFail erreicht!");
				p.getInventory().addItem(Main.main.utils.create(Material.GOLDEN_APPLE, 10));
			}
			Bukkit.broadcastMessage(Main.main.pr + "�5" + p.getName() + " �a hat das Ziel erreicht!");
			Main.main.cd.cancelIngameTask();
			Main.main.cd.startDeathmatchCD();
		}	
	}
		}else {
		    Random random = new Random();
		    List<Material> materials = Arrays.asList(Material.values());
		    int size = materials.size()-1;
		    Material ran = materials.get(random.nextInt(size));
		    p.getInventory().addItem(new ItemStack(ran, 1));
		    if(cp == 8) {
		    	if(Main.main.fallTracker.get(p) == 0) {
					p.sendMessage(Main.main.pr + "Du hast das Ziel ohne JumpFail erreicht!");
					p.getInventory().addItem(Main.main.utils.create(Material.DIAMOND_HELMET, 1));
				}
				Bukkit.broadcastMessage(Main.main.pr + "�5" + p.getName() + " �a hat das Ziel erreicht!");
				Main.main.cd.cancelIngameTask();
				Main.main.cd.startDeathmatchCD();
		    }
		}
	}

This beautiful code snippet was found in one of the repositories of people who sell their products on Fiverr. As you may have noticed only the functionally of code is beautiful but also the formatting style.

By Anonymous, 2021-07-06 23:38:00
private boolean check_if_valid_login(Login login) {
    boolean validLogin = false;
    if (login.isValid(login)) {
        validLogin = true;
    }
    
    if (!(login.isValid(login) == true)) {
        validLogin = false;
    }
    
    return validLogin ? true : false;
}
By Anonymous, 2021-07-06 20:22:47
#include <iostream>
#define OPEN_PARENTHESIS (
#define CLOSE_PARENTHESIS )
#define OPEN_BRACES {
#define CLOSE_BRACES }
#define INTEGER int
#define STANDARD_LIB std::
#define CONSOLE_OUT cout
#define ANGLE_BRACKETS <<
#define MESSAGE "Hello World\n"
#define SEMI ;
#define CLASS_NAME main

INTEGER CLASS_NAME OPEN_PARENTHESIS CLOSE_PARENTHESIS OPEN_BRACES
STANDARD_LIB CONSOLE_OUT ANGLE_BRACKETS MESSAGE SEMI
CLOSE_BRACES

Everything is defined

By Anonymous, 2021-06-28 01:46:44