- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
setInterval(
setTimeout(){
function(){
updater();
},
10
}
,2000);
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+161
setInterval(
setTimeout(){
function(){
updater();
},
10
}
,2000);
Просто увидел в коде
+135
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
main(){
FILE *filein, *fileout;
char fname1[15], fname2[15];
int n, m;
int i, j;
printf("Enter name of input file: "); scanf("%s", &fname1);
printf("Enter name of output file: "); scanf("%s", &fname2);
filein=fopen(fname1, "r");
fileout=fopen(fname2, "w");
if(filein==NULL){
fprintf(stderr, "\nError: can't open file \"%s\"\n\n", fname1);
fclose(filein);
fclose(fileout);
getch();
}
else{
fscanf(filein, "%d%d", &n, &m);
char ch[m][n];
int array[m][n];
int V[m][n];
for(i=0;i<m;i++){
for(j=0;j<n;j++){
V[i][j]=0;
}
}
for(i=0;i<m;i++){
for(j=0;j<n;j++){
fscanf(filein, "%s", &ch[i][j]);
if(ch[i][j]=='+') array[i][j]=1;
else if(ch[i][j]=='-') array[i][j]=0;
}
}
int sum;
for(i=0;i<m;i++){
sum=0;
for(j=0;j<n;j++){
sum+=array[i][j];
}
if(sum==1){
for(j=0;j<n;j++){
V[i][j]=array[i][j];
}
}
else continue;
}
int mm=0, c;
for(i=0;i<m;i++){
for(j=0;j<n;j++){
mm+=V[i][j];
}
}
c = m-mm;
int VoteArray[n];
for(j=0;j<n;j++){
sum=0;
for(i=0;i<m;i++){
sum+=V[i][j];
VoteArray[j]=sum;
}
}
float percent[n];
float per;
per = 100/(float)c;
for(i=0;i<n;i++){
if((percent[i]=per*VoteArray[i])>=7.0) fprintf(fileout, "%d ", i+1);
}
}
fclose(fileout);
fclose(filein);
puts("\nMission comleted\nPress any key...\n");
getch();
}
Фу, блять
+140
virtual QModelIndex parent(const QModelIndex &child) const = 0;
virtual QModelIndex sibling(int row, int column, const QModelIndex &idx) const;
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const = 0;
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const = 0;
virtual bool hasChildren(const QModelIndex &parent = QModelIndex()) const;
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const = 0;
virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
virtual QVariant headerData(int section, Qt::Orientation orientation,
int role = Qt::DisplayRole) const;
virtual bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value,
int role = Qt::EditRole);
virtual QMap<int, QVariant> itemData(const QModelIndex &index) const;
virtual bool setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles);
virtual QStringList mimeTypes() const;
virtual QMimeData *mimeData(const QModelIndexList &indexes) const;
virtual bool canDropMimeData(const QMimeData *data, Qt::DropAction action,
int row, int column, const QModelIndex &parent) const;
virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action,
int row, int column, const QModelIndex &parent);
ну, вы поняли. они написали тысячи говнокода и говорят, что это круто.
они написали говно-пример, и говорят, что это круто.
а вы что думаете по этому поводу?
+57
bool operator ==( const CClass& lhs, const CClass& rhs )
{
bool rc = true;
// No self-comparison...
if ( &lhs != &rhs )
{
// Do not compare fields if result is already false...
if ( rc )
{
rc = ( lhs.frameId() == rhs.frameId());
}
if ( rc )
{
rc = ( lhs.objectId() == rhs.objectId());
}
if ( rc )
{
rc = ( lhs.type() == rhs.type() );
}
if ( rc )
{
rc = ( lhs.transition() == rhs.transition() );
}
if ( rc )
{
rc = ( lhs.rotation() == rhs.rotation() );
}
}
return rc;
}
+55
bool nt_utils::enum_processes(std::vector<uint32_t>& pids)
{
pids.clear();
PDWORD process_ids = NULL;
DWORD cb = ALLOC_SIZE;
DWORD bytes_returned = 0;
BOOL complete = FALSE;
__try {
while (!complete) {
process_ids = static_cast<PDWORD>(
::HeapAlloc(
::GetProcessHeap(),
HEAP_GENERATE_EXCEPTIONS | HEAP_ZERO_MEMORY,
cb
)
);
if (::EnumProcesses(process_ids, cb, &bytes_returned)) {
if (cb == bytes_returned) {
::HeapFree(::GetProcessHeap(), 0, process_ids);
process_ids = NULL;
cb *= 2;
} else {
complete = TRUE;
}
} else {
::HeapFree(::GetProcessHeap(), 0, process_ids);
process_ids = NULL;
complete = TRUE;
}
}
if (process_ids) {
DWORD size = bytes_returned / sizeof(DWORD);
pids.reserve(size);
for (DWORD i = 0; i < size; ++i) {
assert(process_ids[i]);
pids[i] = process_ids[i];
}
::HeapFree(::GetProcessHeap(), 0, process_ids);
}
} __except (EXCEPTION_EXECUTE_HANDLER) {
if (process_ids) {
::HeapFree(::GetProcessHeap(), 0, process_ids);
}
return false;
}
return !!process_ids;
}
Получение id всех процессов
+152
function init() {
if (!document.body) return;
var body = document.body;
var html = document.documentElement;
// ...
}
// ...
https://gist.github.com/galambalazs/6477177/
Плавный скролл, я вот только не пойму, почему "if (!document.body) return;"?
Типа <body> тэга может не существовать?!
+156
for($i = 1; $i < $conf->nb_images + 1; $i++)
{
$ext_name = chr(ord('a')+$i-1);
?>
<label for="ad_picture<?php echo $i;?>"><?php echo ADSMANAGER_FORM_AD_PICTURE." ".$i; ?></label>
<input id="ad_picture<?php echo $i;?>" type="file" name="ad_picture<?php echo $i;?>" />
<?php
if ($isUpdateMode) {
$pic = $mosConfig_absolute_path."/images/$option/projects/".$ad_id.$ext_name."_t.jpg";
if ( file_exists( $pic)) {
echo "<img src='".$mosConfig_live_site."/images/$option/projects/".$ad_id.$ext_name."_t.jpg' align='top' border='0' alt='image$ad_id' />";
echo "<input type='checkbox' name='cb_image$i' value='delete' />".ADSMANAGER_AD_DELETE_IMAGE;
}
}
echo "<br />";
}
Угадайте что за CMS :)))
+57
if (!this) return;
+135
Public CallGridRowModel(CallView callView)
{
. . .
Caller = GetCallerOrCalleeNameColumn(callView, true)
Callee = GetCallerOrCalleeNameColumn(callView, false)
. . .
}
private object GetCallerOrCalleeNameColumn(CallView callView, bool isCallerNameColumn)
{
if(isCallerNameColumn)
{
if(. . .) return . . .;
}
if(!isCallerNameColumn)
{
if(. . .) return . . .;
}
if(isCallerNameColumn)
{
return . . .;
}
else
{
return . . .;
}
}
+87
public BarrierAssessment(int id, Client client, int homephone, int mobile, int email, int transport, int licence, boolean notInWorkForce, boolean unpaidWork, boolean cdeProgram, boolean notWorkingBut, int paidWork,
String employerOcc, String reason, int highlevel, String further, int stableAccomodation, int loneParent, int livingWith, int policeProblems, int courtPending, int preventFrom, int medical, int drugTest, int currentBusy,
String scurrentBusy, String reasonForNotGettingJob, int startTomorrow, String jobGoals, int currentResume, int canvasLetter, int referees, int interviewClothing, String otherBarriers, int ec, LastModified lastModified,
Date datestamp, Date bupdated, String disabilityBarriers, Date licenceDueToExpire, Date licenceDueBack, String currentSkills, String possibleSkills) {
...
}
Мать всех конструкторов!