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
if(!isset($obj->{'s5_4-1'})) {
$obj->{'s5_4-1'} = 0;
}
if(!isset($obj->{'s5_4-2'})) {
$obj->{'s5_4-2'} = 0;
}
if(!isset($obj->{'s5_4-3'})) {
$obj->{'s5_4-3'} = 0;
}
if(!isset($obj->{'s5_4-4'})) {
$obj->{'s5_4-4'} = 0;
}
<?php
class CasinoCode
{
CONST POST = 'POST';
CONST GET = 'GET';
$data = $this->callAPI('/hidden', [], self::POST);
production code of an API with dozens of millions of requests per day.
if [ $product == "consul" ]
then
aws s3 cp s3://${path}/${product}/prem/${version}/${product}-enterprise_${version}+prem_linux_amd64.zip .
unzip ${product}-enterprise_${version}+prem_linux_amd64.zip
rm ${product}-enterprise_${version}+prem_linux_amd64.zip
else
aws s3 cp s3://${path}/${product}/prem/${version}/${product}-enterprise_${version}+prem_linux_amd64.zip .
unzip ${product}-enterprise_${version}+prem_linux_amd64.zip
rm ${product}-enterprise_${version}+prem_linux_amd64.zip
fi
if (!recruiters
.stream().map(UserData::getUserName).collect(Collectors.toList())
.contains(recruiter.getUserData().getUserName())) {
}
if (!response ||
!response.data ||
!response.data.success ||
response.data.success == false ) {
//process stuff
}
Not talking about the '===' warning, here
/**
* Creates hash of client/customer password
* @param string $password The actual password
* @return string MD5 hash of password with salt
*/
public static function hashPassword($password)
{
return md5($password . $password. 'SOME-SECRET-STRING' . $password);
}
pageEndReached() {
if (!this.endOfResults) {
//load more pages
this.page++;
this.getPosts();
followerCount: null,
postCount: null,
measurementKeys: ["a", "b", "c", "d", "e"],
showDrafts: false,
};
},
nani
socket.on('newMessage', (messageObj) => {
if (roomNumber === messageObj.roomNumber) {
console.log("message received:" + messageObj.message);
$('#messages').append($('<li>').text(messageObj.userName + ' : ' + messageObj.message));
}
});
socket.in wasn't behaving as advertised (broadcasting to all rooms). I decided to take matters into my own hands.
public class CustomBoolean {
private Container<java.lang.Boolean> booleanContainer;
public CustomBoolean(Container<Boolean> booleanContainer) {
CustomBoolean custom_boolean = getThis();
custom_boolean.booleanContainer = booleanContainer;
}
private <T extends Object> T getThis() {
return (T) (Object) (T) this;
}
public Container<Boolean> getBooleanContainer() {
return booleanContainer;
}
public static CustomBoolean create(Boolean value) {
return new CustomBoolean(Container.builder().setValue(true).build());
}
public static void main(String[] args) {
System.out.println(CustomBoolean.create(Boolean.TRUE).getBooleanContainer().getObject());
}
public static class Container<T extends Object> {
private T object = null;
private Container(T object) {
Container<T> _this = getThis();
_this.object = (T) (Object) object;
}
private <T extends Object> T getThis() {
return (T) (Object) (T) this;
}
public static Builder builder() {
return new Builder();
}
public T getObject() {
return object;
}
public static class Builder<T extends Object> {
private T value;
public Builder<T> setValue(T value) {
Container<T> _this = getThis();
_this.object = (T) (Object) value;
return this;
}
private <T extends Object> T getThis() {
return (T) (Object) (T) this;
}
public Container build() {
return new Container(value);
}
}
}
} // Dort#0001
trolled
case ClientMessage:
if (*XGetAtomName(GLWin.dpy, event.xclient.message_type)
== *"WM_PROTOCOLS")
{ printf("Exiting sanely...\n");
done = True;
}
break;
someone just want to watch the world burn
// We have this enum.
enum Formula {
case proposition(String)
indirect case negation(Formula)
indirect case operation(op: String, lhs: Formula, rhs: Formula)
var nnf: Formula { /* ... */ }
}
// And now ...
switch formula.nnf {
case .proposition(_):
return formula.nnf
case .negation(_):
return formula.nnf
case .operation(_, _, _):
return formula.nnf
}
let verificaAdmin_Role = (req, res, next) => {
let usuario = req.usuario;
if (usuario.role === 'ADMIN_ROLE') {
next();
} else {
return res.status(409).json({
ok: false,
err: {
message: 'El usuario no es administrador.'
}
})
}
};
He's our company CTO, with 25+ years of experience. Author https://github.com/juang77"
if (cookiesBannerHeight !== 0 && isMobile) {
style = {
top: cookiesBannerHeight === 0 ? 0 : cookiesBannerHeight
}
}
const setFormFlag(state){
state.formFlag ? state.formFlag = false : state.formFlag = true;
}