let already_in = True;
while (already_in) {
let random_index = Math.floor(arr.length * Math.random());
let already_in = False;
for (ex of exs) {
if (ex.id === arr[random_index].id) {
already_in = True;
}
}
}
Yes, this is JavaScript, and yes it didn't work. Found while reviewing some code
class vggNet(nn.Module):
def __init__(self, pretrained=True):
super(vggNet, self).__init__()
self.net = models.vgg16(pretrained=True).features.eval()
def forward(self, x):
out = []
for i in range(len(self.net)):
#x = self.net[i](x)
x = self.net[i](x)
#if i in [3, 8, 15, 22, 29]:
#if i in [15]: #提取1,1/2,1/4的特征图
if i in [8,15,22]: #提取1,1/2,1/4,1/8,1/16
# print(self.net[i])
out.append(x)
return out
Some creepy feature extraction code I found attached to a research paper.
Features:
function focused(evt, errors) {
let form = evt.target
const output = errors.map((error)=> {
// Find first component with error on form and set focus to it
let focusedInput = (Object.keys(error) == "phonebookId") ? Object.keys(error) :
(Object.keys(error) == "phonebook_str") ? Object.keys(error) :
(Object.keys(error) == "message") ? Object.keys(error) :
(Object.keys(error) == "image") ? Object.keys(error) :
(Object.keys(error) == "buttonLink") ? Object.keys(error) :
(Object.keys(error) == "messageSms") ? Object.keys(error) : false
return focusedInput.shift()
})
const selector = output.shift()
form.querySelector('[id="' + selector + '"]').focus()
return selector
Shitcode
$(document).on('click', '.edit-item', function(event) {
let row_id = event.currentTarget.attributes['data-row'].value,
data = dataIndex[
dataIndex.findIndex(i => i.id === Number(row_id))
];
$('.modal-body div:nth-child(1) input').attr('value', data.name)
$('.modal-body div:nth-child(2) input').attr('value', data.category)
$('.modal-body div:nth-child(3) #basicSelect').val(data.status)
$('.modal-body div:nth-child(4) input').attr('value', data.price)
$('.modal-body div:nth-child(5) input').attr('value', data.bju.mass)
$('.modal-body div:nth-child(6) input').attr('value', data.bju.calories)
$('.modal-body div:nth-child(7) input').attr('value', data.bju.proteins)
$('.modal-body div:nth-child(8) input').attr('value', data.bju.fats)
$('.modal-body div:nth-child(9) input').attr('value', data.bju.carbohydrates)
}
)
if(!strncmp(pcTagName,strlim,(int)strlen(strlim))) return "";
pageEndReached() {
if (!this.endOfResults) {
//load more pages
this.page++;
this.getPosts();
followerCount: null,
postCount: null,
measurementKeys: ["a", "b", "c", "d", "e"],
showDrafts: false,
};
},
nani
if yearOfBirth > 2002 {
fmt.Errorf("year of birth not allowed %d", yob)
return
}
if(year%100 === 79 ||
year%100 === 90 ||
year%100 === 1 ||
year%100 === 7 ||
year%100 === 18) {
if(month === 1) { while(day%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 2) { while((day + 3)%7 ===0) {day=Math.ceil(Math.random() * 28);}}
if(month === 3) { while((day + 3)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 4) { while((day - 1)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 5) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 6) { while((day + 4)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 7) { while((day - 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 8) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 9) { while((day + 5)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 10) { while(day%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 11) { while((day + 3)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 12) { while((day + 5)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
}
if(year2%100 === 79 ||
year2%100 === 90 ||
year2%100 === 1 ||
year2%100 === 7 ||
year2%100 === 18) {
if(month2 === 1) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 2) { while((day2 + 3)%7 ===0) {day2=Math.ceil(Math.random() * 28);}}
if(month2 === 3) { while((day2 + 3)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 4) { while((day2 - 1)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 5) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 6) { while((day2 + 4)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 7) { while((day2 - 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 8) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 9) { while((day2 + 5)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 10) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 11) { while((day2 + 3)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 12) { while((day2 + 5)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
}
if(year3%100 === 79 ||
year3%100 === 90 ||
year3%100 === 1 ||
year3%100 === 7 ||
year3%100 === 18) {
if(month3 === 1) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 2) { while((day3 + 3)%7 ===0) {day3=Math.ceil(Math.random() * 28);}}
if(month3 === 3) { while((day3 + 3)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 4) { while((day3 - 1)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 5) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 6) { while((day3 + 4)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 7) { while((day3 - 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 8) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 9) { while((day3 + 5)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 10) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 11) { while((day3 + 3)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 12) { while((day3 + 5)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
}
if(year%100 === 96) {
if(month === 1) { while(day%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 2) { while((day + 3)%7 ===0) {day=Math.ceil(Math.random() * 29);}}
if(month === 3) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 4) { while((day - 2)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 5) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 6) { while((day + 3)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 7) { while((day - 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 8) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 9) { while((day + 4)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 10) { while((day - 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 11) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 12) { while((day + 4)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
}
if(year2%100 === 96) {
if(month2 === 1) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 2) { while((day2 + 3)%7 ===0) {day2=Math.ceil(Math.random() * 29);}}
if(month2 === 3) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 4) { while((day2 - 2)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 5) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 6) { while((day2 + 3)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 7) { while((day2 - 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 8) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 9) { while((day2 + 4)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 10) { while((day2 - 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 11) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 12) { while((day2 + 4)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
}
if(year3%100 === 96) {
if(month3 === 1) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 2) { while((day3 + 3)%7 ===0) {day3=Math.ceil(Math.random() * 29);}}
if(month3 === 3) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 4) { while((day3 - 2)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 5) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 6) { while((day3 + 3)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 7) { while((day3 - 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 8) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 9) { while((day3 + 4)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 10) { while((day3 - 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 11) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 12) { while((day3 + 4)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
}
if(year%100 === 85 ||
year%100 === 91 ||
year%100 === 2 ||
year%100 === 13 ||
year%100 === 19) {
if(month === 1) { while((day - 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 2) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 28);}}
if(month === 3) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 4) { while((day - 2)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 5) { while(day%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 6) { while((day + 3)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 7) { while((day - 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 8) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 9) { while((day + 4)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 10) { while((day - 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 11) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 12) { while((day + 4)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
}
if(year2%100 === 85 ||
year2%100 === 91 ||
year2%100 === 2 ||
year2%100 === 13 ||
year2%100 === 19) {
if(month2 === 1) { while((day2 - 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 2) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 28);}}
if(month2 === 3) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 4) { while((day2 - 2)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 5) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 6) { while((day2 + 3)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 7) { while((day2 - 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 8) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 9) { while((day2 + 4)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 10) { while((day2 - 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 11) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 12) { while((day2 + 4)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
}
if(year3%100 === 85 ||
year3%100 === 91 ||
year3%100 === 2 ||
year3%100 === 13 ||
year3%100 === 19) {
if(month3 === 1) { while((day3 - 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 2) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 28);}}
if(month3 === 3) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 4) { while((day3 - 2)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 5) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 6) { while((day3 + 3)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 7) { while((day3 - 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 8) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 9) { while((day3 + 4)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 10) { while((day3 - 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 11) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 12) { while((day3 + 4)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
}
if(year%100 === 80 ||
year%100 === 8) {
if(month === 1) { while((day - 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 2) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 29);}}
if(month === 3) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 4) { while((day - 3)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 5) { while((day - 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 6) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 7) { while((day - 3)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 8) { while(day%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 9) { while((day + 3)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 10) { while((day - 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 11) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 12) { while((day + 3)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
}
if(year2%100 === 80 ||
year2%100 === 8) {
if(month2 === 1) { while((day2 - 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 2) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 29);}}
if(month2 === 3) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 4) { while((day2 - 3)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 5) { while((day2 - 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 6) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 7) { while((day2 - 3)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 8) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 9) { while((day2 + 3)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 10) { while((day2 - 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 11) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 12) { while((day2 + 3)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
}
if(year3%100 === 80 ||
year3%100 === 8) {
if(month3 === 1) { while((day3 - 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 2) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 29);}}
if(month3 === 3) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 4) { while((day3 - 3)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 5) { while((day3 - 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 6) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 7) { while((day3 - 3)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 8) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 9) { while((day3 + 3)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 10) { while((day3 - 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 11) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 12) { while((day3 + 3)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
}
if(year%100 === 86 ||
year%100 === 97 ||
year%100 === 3 ||
year%100 === 14) {
if(month === 1) { while((day - 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 2) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 28);}}
if(month === 3) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 4) { while((day - 3)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 5) { while((day - 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 6) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 7) { while((day - 3)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 8) { while(day%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 9) { while((day + 3)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 10) { while((day - 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 11) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 12) { while((day + 3)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
}
if(year%100 === 92) {
if(month === 1) { while((day - 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 2) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 29);}}
if(month === 3) { while(day%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 4) { while((day - 4)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 5) { while((day - 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 6) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 7) { while((day - 4)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 8) { while((day - 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 9) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 10) { while((day - 3)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 11) { while(day%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 12) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
}
if(year2%100 === 86 ||
year2%100 === 97 ||
year2%100 === 3 ||
year2%100 === 14) {
if(month2 === 1) { while((day2 - 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 2) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 28);}}
if(month2 === 3) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 4) { while((day2 - 3)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 5) { while((day2 - 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 6) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 7) { while((day2 - 3)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 8) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 9) { while((day2 + 3)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 10) { while((day2 - 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 11) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 12) { while((day2 + 3)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
}
if(year2%100 === 92) {
if(month2 === 1) { while((day2 - 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 2) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 29);}}
if(month2 === 3) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 4) { while((day2 - 4)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 5) { while((day2 - 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 6) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 7) { while((day2 - 4)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 8) { while((day2 - 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 9) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 10) { while((day2 - 3)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 11) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 12) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
}
if(year3%100 === 86 ||
year3%100 === 97 ||
year3%100 === 3 ||
year3%100 === 14) {
if(month3 === 1) { while((day3 - 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 2) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 28);}}
if(month3 === 3) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 4) { while((day3 - 3)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 5) { while((day3 - 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 6) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 7) { while((day3 - 3)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 8) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 9) { while((day3 + 3)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 10) { while((day3 - 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 11) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 12) { while((day3 + 3)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
}
if(year3%100 === 92) {
if(month3 === 1) { while((day3 - 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 2) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 29);}}
if(month3 === 3) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 4) { while((day3 - 4)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 5) { while((day3 - 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 6) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 7) { while((day3 - 4)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 8) { while((day3 - 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 9) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 10) { while((day3 - 3)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 11) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 12) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
}
if(year%100 === 81 ||
year%100 === 87 ||
year%100 === 98 ||
year%100 === 9 ||
year%100 === 17) {
if(month === 1) { while((day - 3)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 2) { while(day%7 ===0) {day=Math.ceil(Math.random() * 28);}}
if(month === 3) { while(day%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 4) { while((day - 4)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 5) { while((day - 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 6) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 7) { while((day - 4)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 8) { while((day - 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 9) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 10) { while((day - 3)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 11) { while(day%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 12) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
}
if(year%100 === 4) {
if(month === 1) { while((day - 3)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 2) { while(day%7 ===0) {day=Math.ceil(Math.random() * 29);}}
if(month === 3) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 4) { while((day - 5)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 5) { while((day - 3)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 6) { while(day%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 7) { while((day - 5)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 8) { while((day - 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 9) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 10) { while((day - 4)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 11) { while((day - 1)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 12) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
}
if(year2%100 === 81 ||
year2%100 === 87 ||
year2%100 === 98 ||
year2%100 === 9 ||
year2%100 === 17) {
if(month2 === 1) { while((day2 - 3)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 2) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 28);}}
if(month2 === 3) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 4) { while((day2 - 4)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 5) { while((day2 - 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 6) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 7) { while((day2 - 4)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 8) { while((day2 - 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 9) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 10) { while((day2 - 3)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 11) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 12) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
}
if(year2%100 === 4) {
if(month2 === 1) { while((day2 - 3)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 2) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 29);}}
if(month2 === 3) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 4) { while((day2 - 5)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 5) { while((day2 - 3)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 6) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 7) { while((day2 - 5)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 8) { while((day2 - 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 9) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 10) { while((day2 - 4)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 11) { while((day2 - 1)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 12) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
}
if(year3%100 === 81 ||
year3%100 === 87 ||
year3%100 === 98 ||
year3%100 === 9 ||
year3%100 === 17) {
if(month3 === 1) { while((day3 - 3)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 2) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 28);}}
if(month3 === 3) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 4) { while((day3 - 4)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 5) { while((day3 - 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 6) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 7) { while((day3 - 4)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 8) { while((day3 - 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 9) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 10) { while((day3 - 3)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 11) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 12) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
}
if(year3%100 === 4) {
if(month3 === 1) { while((day3 - 3)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 2) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 29);}}
if(month3 === 3) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 4) { while((day3 - 5)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 5) { while((day3 - 3)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 6) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 7) { while((day3 - 5)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 8) { while((day3 - 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 9) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 10) { while((day3 - 4)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 11) { while((day3 - 1)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 12) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
}
local part = script.Parent
local OriginColor = Color3.new(0,170,255)
local KillColor = Color3.new(1, 0, 0)
part.Touched:Connect(function(H)
local humanoid = H.Parent:FindFirstChild("Humanoid")
if humanoid and part.Color == KillColor then
humanoid.Health = 0
end
end)
local shit = 1
repeat
part.Color = OriginColor
wait(1.5)
part.Color = KillColor
wait(1.5)
until shit == 2
char * dataFunc(){
TCHAR tc[256];
LONG tc_len = sizeof(tc);
getData((LPBYTE)&tc, &tc_len);
char * data = new char[tc_len];
for(int i = 0;i < tc_len;i++)
data[i] = tc[i];
return data;
}
#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
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;
}
@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.
@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?
if(products.Length < 0) {
foreach (var p in products)
{
//...
}
}