public abstract class AbstractInventoryProductFactoryManagerSingletonServiceManagerFactoryExceptionHandlerResourceHandlerDatabaseConnectionHandlerImpl {
private static AbstractInventoryProductFactoryManagerSingletonServiceManagerFactoryExceptionHandlerResourceHandlerDatabaseConnectionHandlerImpl theOneAndOnlyInstance;
private Connection theUnbreakableEverlastingDatabaseLifeline;
public static AbstractInventoryProductFactoryManagerSingletonServiceManagerFactoryExceptionHandlerResourceHandlerDatabaseConnectionHandlerImpl summonTheSingleton() {
if (theOneAndOnlyInstance == null) {
theOneAndOnlyInstance = new ConcreteImplementation();
}
return theOneAndOnlyInstance;
}
public abstract void initiateUnswervingDatabaseLinkWithCompulsiveRetriesAndUnyieldingTimeout();
public abstract InventoryProduct concoctAndJumpstartBrandNewInventoryProductPostRigorousValidation();
public abstract Service bootstrapAndEnrollNovelServicePostInfallibleAvailabilityCheck();
public abstract void seizeAndChronicleExceptionWithStackTrackAndSignalDeveloper(Exception e);
public abstract void manageAndFineTuneResourceConsumptionForPeakEfficiency(Resource resource);
public abstract void launchDatabaseTransactionWithOptimumIsolationLevel();
public abstract void ratifyDatabaseTransactionAndScourForPossibleConflicts();
public abstract void revokeDatabaseTransactionInEventOfUnforeseenErrors();
public abstract void safelySeverDatabaseConnectionAndLiberatePreciousResources();
}
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.
if student_id:
assignments = Assignment.objects.filter(week__in=weeks)
unenrolled_students = Wave.objects.filter(week__in=weeks).values_list('unenrolled_students', flat=True)
# Construct responses based on assignment type
Assignment.build_assignments_for_weeks(responses, assignments, students, unenrolled_students)
max_num_assessments = Assessment.build_assessments_for_weeks(responses)
Comment.build_comments_for_weeks(responses, weeks, students, unenrolled_students)
elif wave_id:
assignments = Assignment.objects.filter(week__in=weeks)
unenrolled_students = Wave.objects.filter(week__in=weeks).values_list('unenrolled_students', flat=True)
# Construct responses based on assignment type
Assignment.build_assignments_for_weeks(responses, assignments, students, unenrolled_students)
max_num_assessments = Assessment.build_assessments_for_weeks(responses)
Comment.build_comments_for_weeks(responses, weeks, students, unenrolled_students)
else:
# can't happen
pass
const ws = new WebSocket('wss://echo.websocket.org', {
agent: new HttpsProxyAgent(`https://${proxy}`)
});
wsz.push(ws);
ws.onopen = () => {
if (ws.readyState === WebSocket.OPEN) {
.....
ws.close();
}
};
ws.onerror = () => {
ws.close();
};
u just cant trust, just cant......
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;
}
}
#define omae
#define wa (void)0
#define mou (void)0
#define shinderu ;
#define nani (void)
#define return 0; return
int main(void) {
omae wa, mou shinderu
nani!
return 0;
}
maybeSomething match {
case Some(x) => true
case None => false
}
maybeSomething.getOrElse(false) Short code and readable
function edit_vehality: locality,
google_place_id: '1'
};
let opts = { 'method': 'put', 'route': '/border/' + border_id, 'status': status, 'account_access_token': saved_values.superadmin.account_access_token, 'params': params };
request(opts)
.then(function(res) {
resolve(res.result);
}).catch(reject);
})
}
var div = '<div class="imgdiv" '+(user[5] ? 'style="display: flex; flex-direction: column; padding: 10px; justify-content: flex-end; background-image: url(\''+user[5]+'\');"' : '')+'>'
+ (usersVideos[userId] && <?= ($authuser ? 'true' : 'false') ?> ? '<i class="f7-icons icon-acc" onclick="videoShow('+user[uID]+')" style="color: white; font-size: 50px; margin-bottom: 5px; cursor: pointer; text-align: left;">play_round</i>' : '')
+ (iam && page=='home' ? '<div> <input id="video-input" onchange="uploadVideo(files)" type="file" accept="video/*" style="display: none; width: 80%; height: 100px; margin: auto; padding-top: 20px;"/> </div> <p class="action_cont" style="padding: 0; padding-top: 12;"> <a class="act_btn" onmousedown=document.getElementById("video-input").click() href="javascript:void(0)" style="text-decoration: none; margin: auto; width: calc(100% - 26px); text-align: center;"> ' + (myMods['video'] ? 'Загрузить новое видео' : 'Добавить видео-превью' ) + ' </a> </p>' : '')
+ '</div>'
JS + CSS + PHP + HTML
<ng-container *ngIf="!errors">
<div *ngIf="errors" class="no-content-wrapper">
<esel-components-error [error]="errors"></esel-components-error>
</div>
</ng-container>
Make your code error prone with effective error handling!
const newReply = (reply !== null) ? reply : null;
function renderGroupSelectedSuccessors() {
var index = 0;
if (tempSuccessorsGroupsList != null && tempSuccessorsGroupsList.length > 0) {
var groups = tempSuccessorsGroupsList.splice(0, PageSettings.lazyRenderItemsPerPage);
var groupSuccessors = '';
for (var i = 0; i < groups.length; i++) {
if (index % 10 == 0) {
groupSuccessors += '<div style="float: left;"><ul>';
}
groupSuccessors += '<li><a data-groupid="'+groups[i].GroupID+'">' + groups[i].GroupName + '</a></li>';
index++;
if (index % 10 == 0 || i == groups.length - 1) {
groupSuccessors += '</ul></div>';
}
}
$('#divGroupSuccessorsList').append(groupSuccessors);
SetCheckBoxState();
setTimeout(renderGroupSelectedSuccessors, 50);
}
}
Where does the data come from? Where does it go? Why isn't this an endless recursive loop? Why has this worked for three years?
<?php
$k =1;
for($v = 0; $v < $nt; $v++) {
$bgClass= 'blueBg';
if($k > 1 && $k%2 == 0){
$bgClass= 'whiteBg';
}
?>
<tr class="row_tr <?php echo $bgClass;?>">
<td class="row_td td_column_0"> </td>
<td class="row_td column_1"><?php echo $rows[$v]['nothing'];?></td>
...
<td class="row_td td_column_0"> </td>
</tr>
<?php
$k++;
}
?>
return isDisabled == false ? false : true;
function clean(toClean, source){
if (typeof(toClean) !== 'string') return true;
if (typeof(source) !== 'string') return true;
return source.replace(toClean, String('CLEANED')).toString();
}
Found this in a project at work and someone clearly doesn't trust JavaScripts typeof function