switch ($content) {
case "vid":
echo '<iframe width="600" height="450" src="http://www.youtube.com/embed/' . $img . '" frameborder="0" allowfullscreen></iframe>';
break;
default:
if ($height > 0 && $width > 0) {
echo '<img width="' . $width . '" height="' . $height . '" src="http://szpileczki.com/up/' . $img . '"/>';
} else {
if ($kochamto == 1) {
echo '<img src="http://kocham.to/up/' . $img . '"/>';
} else {
echo '<img src="http://szpileczki.com/up/' . $img . '"/>';
}
}
break;
}
especially if one of them doesn't exist since 2012
String zeroPad(int number) {
return number < 10 ? "0" + number : String.valueOf(number);
}
You could just have done String.format("%02d", number);
switch (kafkaStreams.state()) {
case RUNNING: {
if (kafkaStreams.state().isRunning()) {
countDownLatch.countDown();
}
}
break;
$number = int(1);
export const getUniqueIds = (ids: string[]) => {
const uniqueIds = new Set<string>();
return ids.filter((id) => {
if (!uniqueIds.has(id)) {
uniqueIds.add(id);
return true;
}
return false;
});
};
int var = 0;
int* ptr = &var;
ptr[0] = 5;
std::cout << ptr[0];
if(userEndDate.getTime() != null
&& userEndDate.getTime() > today.getTime()
&& endDateFromRequest != null ? endDateFromRequest.getTime() !== userEndDate.getTime() : true){
//some code
}
for code lovers :D
string AllPDF = "";
int CountPDF = 0;
AllPDF = txtInput.Text;
string[] AllPDF2 = AllPDF.Split(';');
List<string> PDF = new List<string>();
PDF.AddRange(AllPDF2);
while (PDF.Count != CountPDF)
{
File.Delete(AllPDF2[0 + CountPDF] + ".pdf");
CountPDF++;
}
I believe, there are so many easier ways to do that
from typing import Dict, List
from dataclasses import dataclass
from lbcore.orders import Order, Match
@dataclass
class SideEffect:
order_id: str = ''
action: Dict = None
updates: Dict = None
matches: List[Match] = None
order: Order = None
action_exists: bool = False
def match(self, price):
match = self.action.copy()
match['price'] = price
return match
class SideEffects(list):
def add_action(self, order, action_exists=False, **action):
action['order_id'] = order.id
se = SideEffect(order=order, action=action,
action_exists=action_exists)
self.append(se)
return se
def add_update(self, order_id, **updates):
se = SideEffect(order_id=order_id, updates=updates)
self.append(se)
return se
def add_trade(self, order, matches):
se = SideEffect(order=order, matches=matches)
self.append(se)
return se
//JSONObject input;
String givenName = input.get("propName") != null ? (String)input.get("propName") : null;
WHAT DA FUCK ASSHOLES
if (!String.prototype.replaceLast) {
String.prototype.replaceLast = function(find, replace) {
String.prototype.replaceLast = function (what, replacement) {
var pcs = this.split(what);
var lastPc = pcs.pop();
return pcs.join(what) + replacement + lastPc;
};
};
}
Prototypes are super buggy anyway, I should rewrite that as a pure function.
const Discord = require("discord.js");
const bot = new Discord.Client();
const TOKEN = "NOPE"
var color = require('chalk');
var fs = require('fs');
bot.on("ready", function(message) {
console.log(color.green("Online"))
})
bot.on("message", function(message){
console.log("Channel:" + color.blue(message.channel) + " " + "Author:" + color.blue(message.author) + " " + "Message:" + color.blue(message.content))
if (message.content.includes("uranium") || message.content == "Uranium" || message.content == "uranium" || message.content.includes("uranium")) {
console.log(color.black.yellow("Message Flagged As Suspicous"))
console.log(color.black.yellow("Contains: Uranium"))
console.log(color.black.bgYellow("Message:" + message.content))
console.log(color.black.bgYellow("Message Id:" + message.id))
console.log(color.black.bgYellow("Author Id:" + message.author.id))
console.log(color.black.bgYellow("Channel Id:" + message.channel.id))
console.log(color.yellow("Severity:" + "1"))
var alertsev1 = `Message + Id: + ${message.id} + | + Author + Id: + ${message.author.id} + | + Message + Channel Id: ${message.channel.id} + | + Message: + ${message.content}`
fs.writeFile('alerts.txt', `${alertsev2}`)
}
if (message.content.includes("raid") || message.content.includes("Raid")) {
console.log(color.black.red("Message Flagged As Suspicous"))
console.log(color.black.red("Contains: Raid"))
console.log(color.black.bgRed("Message:" + message.content))
console.log(color.black.bgRed("Message Id:" + message.id))
console.log(color.black.bgRed("Author Id:" + message.author.id))
console.log(color.black.bgRed("Channel Id:" + message.channel.id))
console.log(color.black.red("Severity:" + "2"))
var alertsev2 = `Message + Id: + ${message.id} + | + Author + Id: + ${message.author.id} + | + Message + Channel Id: ${message.channel.id} + | + Message: + ${message.content}`
fs.writeFile('alerts.txt', `${alertsev2}`)
}
if (message.content.includes("raid") && message.content.includes("uranium") || message.content.includes("raid") && message.content.includes("Uranium") || message.content.includes("raid") && message.content.includes("uranium") || message.content.includes("Raid") && message.content.includes("uranium") || message.content.includes("Raid")) {
console.log(color.black.red("Message Flagged As Possible Raid Initiation"))
console.log(color.black.red("Contains: Raid, Uranium"))
console.log(color.black.bgRed("Message:" + message.content))
console.log(color.black.bgRed("Message Id:" + message.id))
console.log(color.black.bgRed("Author Id:" + message.author.id))
console.log(color.black.bgRed("Channel Id:" + message.channel.id))
console.log(color.black.red("Severity:" + "3"))
var alertsev3 = `Message + Id: + ${message.id} + | + Author + Id: + ${message.author.id} + | + Message + Channel Id: ${message.channel.id} + | + Message: + ${message.content}`
fs.writeFile('alerts.txt', `${alertsev3}`)
}
})
bot.login(TOKEN)
I'm making a discord message logger but I want to output message.content message.author message.id message.channel.id into one text file everytime a message is sent in the following format: Message ID:(Id here) Message Author: (Author ID here) Channel ID: (Channel ID here) Message: (message here) ive tried with the following code but it printed undefined out into the text document
/*
* _____________________________________________________
* ___________↓___↓____________________________________________ |
* _↓_________↓|___|________________________________________ | |
* ______↓|_________||___|↓___________________________________ | | |
* _____↓__↓__||_________||___||_______________________________ | | | |
* _↓__↓_|__|__||_________||___||___________________________ | | | | |
* _________↓|__|_|__|↓_||_________||___||_______________________ | | | | | |
* ↓ ↓ || | | || || || || | | | | | | | */
opcId = child.replace(/([.])?(?:((.+)=(.+))|(([a-zA-Z]+)(\d*)))/g, function (match, m1, m2, m3, m4, m5, m6, m7) {
int i = 0;
while (conn == null && i < 116) {
try {
Thread.sleep(i < 30 ? 2000 : (i < 40 ? 6000 : (i < 56 ? 30000 : 60000)));
} catch (Exception e) {
e.printStackTrace();
}
try {
conn = Server.getConnection();
} catch (Exception e) {
//e.printStackTrace();
}
i++;
if ((i < 41 && (i % 5) == 0)
|| (i > 40 && i < 45)
|| (i > 44 && i < 56 && (i % 2) == 0)
|| (i > 55 && ((i - 56) % 3) == 0))
System.out.print('.');
}
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <iterator>
constexpr int N = 10;
int main() {
std::vector<int> even;
std::vector<int> odd;
even.resize(N);
// Fill up the 'even' vector with integers starting from from 1 through 'N'
std::iota(even.begin(), even.end(), 1);
// Segregate the odd and even integers from each other
for (auto it = even.begin(); it != even.end(); ++it)
if (*it % 2 != 0) {
// If the number is odd, put it in the 'odd' vector
odd.push_back(*it);
// Remove the number from the even vector
even.erase(it);
}
// Print the result
std::cout << "Even numbers: ";
std::copy(even.begin(), even.end(), std::ostream_iterator<int>(std::cout, " "));
std::cout << "\nOdd numbers: ";
std::copy(odd.begin(), odd.end(), std::ostream_iterator<int>(std::cout, " "));
std::cout << '\n';
}
Seems fine to me... C++ couldn't possibly be THAT evil to introduce another nuanced and verbose complexity in there, right?