int main() {
int error_code = some_function();
if (error_code == 1) {
// In case of error, crash the program by eating up memory
while (true) new int;
}
}
//class tworzenie.FaceOknoDodatki
var b = 2;
var wlosyT = [tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,7,4,4,7,8,9,10,6,8,6,5,5,7,8,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b];
var brwiT = [tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b];
var oczyT = [tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,5,6,6,7,8,8,8,9,9,9,10,10,10,10,10,10];
var nosT = [tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b];
var brodaT = [tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,5,6,7,7,8,9];
var ustaT = [tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,10,10];
var czachyT = [tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,10];
var tatuazT = [tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,3,7,7,7,7,8,8,8,9,9,9,10,10,0,0,0,0,0,0,0,0,0,0,0,0,0];
var opaskaT = [tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,8,9,10,7,8,9,8,9,10,10,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
var kolczykiT = [tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,3,3,4,4,5,6,5,6,7,8,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
var kolczyki2T = [tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,3,3,6,5,8,9,4,7,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
var bliznaT = [tworzenie.FaceOknoDodatki.prototype.b,tworzenie.FaceOknoDodatki.prototype.b,5,7,8,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
code from some shitty polish game, character face creator
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;
});
};
const [glossaries, prompts] = [await getGlossaries(), await getPromps()];
// instead of
// const [glossaries, prompts] = await Promise.all([getGlossaries(), getPrompts()]);
When I was writing the code, I thought for a moment that getGlossaries() and getPrompts() will be executed in parallel
/*
* _____________________________________________________
* ___________↓___↓____________________________________________ |
* _↓_________↓|___|________________________________________ | |
* ______↓|_________||___|↓___________________________________ | | |
* _____↓__↓__||_________||___||_______________________________ | | | |
* _↓__↓_|__|__||_________||___||___________________________ | | | | |
* _________↓|__|_|__|↓_||_________||___||_______________________ | | | | | |
* ↓ ↓ || | | || || || || | | | | | | | */
opcId = child.replace(/([.])?(?:((.+)=(.+))|(([a-zA-Z]+)(\d*)))/g, function (match, m1, m2, m3, m4, m5, m6, m7) {
#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?
string sum_numbers(string a, string b) {
char ca, cb, ci, out, co = '0';
string result = "";
while (a.size() > 0 || b.size() > 0 || co != '0') {
ci = co; ca = '0'; cb = '0';
if (a.size() > 0) {ca = a.back(); a.pop_back();}
if (b.size() > 0) {cb = b.back(); b.pop_back();}
result = ((((ca != cb) ? '1' : '0') != ci) ? '1' : '0') + result;
co = ((((ca == '1' && cb == '1') ? '1' : '0') == '1' ||
((((ca != cb) ? '1' : '0') == '1' && ci == '1') ? '1' : '0') == '1') ? '1' : '0');
}
return result;
}
Scary stuff
def even?(number)
if number > 0
result = number
else
result = -number
end
while result > 2 or result == 2
result = result - 2
end
if result == 0
true
else
false
end
end
Best solution to find out if a number is even.
// this.collectPairs() returns data from the UI form
// this.alert.alarmReasons contains empty array or alarmReason-Category pair objects
let newAlarmReasonsToAdd = []
this.collectPairs().forEach(categoryAndAlarmReasonPair => {
!!!this.searchAmidExisting(categoryAndAlarmReasonPair, this.alert.alarmReasons) ? newAlarmReasonsToAdd.push(categoryAndAlarmReasonPair) : null
})
searchAmidExisting(alarmReasonToAdd, existingAlarmReasons){
let res = existingAlarmReasons.find(existing => {
if(alarmReasonToAdd.categoryDictEntryKey === existing.category && alarmReasonToAdd.reasonDictEntryKey === existing.reason){
return true
} else return false
})
return res
}
fn add_unsafe(a: i32, b: i32) -> i32 {
a + b
}
fn add_safer(a: i32, b: i32) -> std::io::Result<i32> {
Ok(add_unsafe(a, b))
}
fn add_option(a: i32, b:i32) -> Option<std::io::Result<i32>> {
Some(add_safer(a, b))
}
fn main() {
println!("{:?}", add_option("4".parse::<i32>().unwrap(), "5".parse::<i32>().unwrap()).unwrap().unwrap());
}
it unwraps
export const LandingReducer=createSlice({
name:'MAIN_SLICE',
initialState:initialStates,
reducers: {
changeStateValue:(state,action) => {
state[action.payload.name] = action.payload.value
const check = action.payload.name.includes('.')
if (!check) {
state[action.payload.name] = action.payload.value
}else{
const groups=action.payload.name.split('.')
console.log(groups);
if(groups.length===2){
state[groups[0]][groups[1]]=action.payload.value;
}else if(groups.length===3){
state[groups[0]][groups[1]][groups[2]]=action.payload.value;
}else if(groups.length===4){
state[groups[0]][groups[1]][groups[2]][groups[3]]=action.payload.value;
}
}
}
}
});
public static String arrayToString(List list) {
if (list == null) {
throw new IllegalArgumentException("list is null");
}
return list.toString()
.replace("[", "") //remove the right bracket
.replace("]", "") //remove the left bracket
.trim();
}
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('.');
}
<style type="text/css">
<?php echo file_get_contents(
\realpath(ROOT_PATH . '/public/').$this->assetPath('css/styles.css', true)
); ?>
</style>
Including style file (about 100kb) directly to HTML page. Thanks for developer, it's in
.bool calculateLeapYear(uint8_t year) {
if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) {
return true;
} else {
return false;
}
}
uint8_t and a useless if.