def possibilities():
    alphabets=(n,o,r,t,h,e,a,s,u,w,m,y)
    combinations=list()
    for n in range(9,-1,-1):
            for o in range(9,-1,-1):
                    for r in range(9,-1,-1):
                            for t in range(9,-1,-1):
                                    for h in range(9,-1,-1):
                                            for e in range(9,-1,-1):
                                                    for a in range(9,-1,-1):
                                                            for s in range(9,-1,-1):
                                                                    for u in range(9,-1,-1):
                                                                            for w in range(9,-1,-1):
                                                                                    for m in range(9,-1,-1):
                                                                                            for y in range(9,-1,-1):
                                                                                                    if len(set([n,o,r,t,h,e,a,s,u,w,m,y]))==12:
                                                                                                    north=10000*n + 1000*o +100*r +10*t +h
                                                                                                    east=1000*e +100*a +10*s +t
                                                                                                    south=10000*s + 1000*o +100*u +10*t +h
                                                                                                    west=1000*w + 100*e +10*s +t
                                                                                                    earth= 10000*e + 1000*a + 100*r +10*t +h
                                                                                                    if north +east +south +west == earth:
                                                                                                            combinations.append((north,east,south,west,earth))

    return combinations
By Dusk Code, 2018-04-25 11:47:49
Console.WriteLine("|"+ Espace(x-1) + (h==3?" o":""));
Console.WriteLine("|"+ Espace(x-1) + (h==2?" o":(h==3?"/|\\":"")));
Console.WriteLine("|"+ Espace(x-1) + (h==1?" o":(h==2?"/|\\":(h==3?" |":""))));
Console.WriteLine("|"+ Espace(x-1) + (h==0?" o":(h==1?"/|\\":(h==2?" |":(h==3?"/ \\":"")))));
Console.WriteLine("|"+ Espace(x-1) + (h==0?"/|\\":(h==1?" |":(h==2?"/ \\":""))));
Console.WriteLine("|"+ Espace(x-1) + (h==0?" |":(h==1?"/ \\":"")));
Console.WriteLine("|"+ Espace(x-1) + (h==0?"/ \\" : ""));
By Caribou décoiffé, 2018-04-29 20:27:53
// IsFooBar being a boolean, we check if it's different from true and from false
if (x.IsFooBar != true && x.IsFooBar != false)
{
    return "error";
}

x.IsFooBar is juste a regular bool

By A senior developer, 2018-05-14 14:46:14
const int ONLY_ONE_ITEM = 1;

if (myList.Count > ONLY_ONE_ITEM)
{
    DoSomething();
}
else
{
    DoSomethingElse();
}
By Anonymous, 2018-05-15 17:04:22
public enum YesNoEnum
{
	Yes = 0,
	No = 1
}

I also like how they defined the enum values.

By Anonymous, 2018-05-19 19:33:44
Update.update_all_updated(updates) # Update updated updates
By anon, 2018-05-25 16:45:41
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

By Anonymous, 2018-06-02 22:09:57
div.body:first-child:nth-last-child(n+12),
div.body:first-child:nth-last-child(n+12) ~ div.body {
  padding: 3px 5px 2px !important;

  div.rect {
    top: 6px !important;
  }

  div.legend-action {
    top: 3px !important;
  }
}
By Anonymous, 2018-06-04 10:46:38
const newReply = (reply !== null) ? reply : null;
By foxy, 2018-06-04 21:19:27
public class MandateData {

    public final UUID coreId;
    public final UUID accountId;
    public final String accountRef;
    public final String creditorId;
    public final String creditorName;
    public final String debtorFirstName;
    public final String debtorLastName;
    public final String branchCode;
    public final String accountNumber;
    public final LocalDate signingDate;
    public final Address debtorAddress;

    private MandateData(UUID coreId, UUID accountId, String accountRef, String creditorId, String creditorName, String branchCode, String accountNumber, String debtorFirstName, String debtorLastName,
                        LocalDate signingDate, Address debtorAddress) {
        this.coreId = coreId;
        this.accountId = accountId;
        this.accountRef = accountRef;
        this.creditorId = creditorId;
        this.creditorName = creditorName;
        this.debtorFirstName = debtorFirstName;
        this.debtorLastName = debtorLastName;
        this.branchCode = branchCode;
        this.accountNumber = accountNumber;
        this.signingDate = signingDate;
        this.debtorAddress = debtorAddress;
    }

    public static MandateData creationMandateData(UUID coreId, UUID accountId, String accountRef, String creditorId, String creditorName, String branchCode, String accountNumber, String debtorFirstName, String debtorLastName,
                                                  LocalDate signingDate, Address debtorAddress) {
        return new MandateData(coreId, accountId, accountRef, creditorId, creditorName, branchCode, accountNumber, debtorFirstName, debtorLastName, signingDate, debtorAddress);
    }
}

There is an ancient and mysterious legend about public static constructor, called createShit. If anyone want's just to create an instance of Shit be aware of it! This is too obvious! just Implement static method with the exactly the same fields, and make constructor private. Don't write a shit!

By Anonymous, 2018-06-07 13:03:44
if((substr($onefile, -4) == ".Mp3") OR 
    (substr($onefile, -4) == ".ogg") OR 
    (substr($onefile, -4) == ".OGG") OR 
    (substr($onefile, -4) == ".oGG") OR 
    (substr($onefile, -4) == ".OGg") OR 
    (substr($onefile, -4) == ".Ogg") OR 
    (substr($onefile, -4) == ".OgG") OR 
    (substr($onefile, -4) == ".mP3") OR 
    (substr($onefile, -4) == ".MP3") OR 
    (substr($onefile, -4) == ".mp3")){
    
    // do stuff
} 

gotta make sure you account for capitalization

By Kyuunex, 2018-07-02 04:58:09
switch (kafkaStreams.state()) {
                case RUNNING: {
                    if (kafkaStreams.state().isRunning()) {
                        countDownLatch.countDown();
                    }
                }
                break;
By Anonymous, 2018-07-05 18:05:59
<div class="scrollContent">
	{foreach $animations as $index => $a}
		{if $index > 2}
			{if $a.filename == '9_1447691013_3726.png'}
			{else}
				{if $a.filename == '9_1423150010_6441.png'}
				{else}
					{if $a.filename == '9_1423149959_5909.png'}
					{else}
						{if $a.filename == '9_1423149908_5874.png'}
						{else}
							{if $a.filename == '9_1528213223_6374.jpg'}
							{else}
								{if $a.filename == '9_1527670984_3732.jpg'}
								{else}

							<div class="spotlightFrame frame{$index+1} contains1" data-index="{$index}">
								{if $a.link}<a href="{$a.link}">{/if}
								<img src="/upload/{$a.filename}" alt="{$a.title}" />
								{if $a.link}</a>{/if}
							</div>

								{/if}
							{/if}
						{/if}
					{/if}
				{/if}
			{/if}
		{/if}
	{/foreach}
</div>

Handovers are great.

By Anonymous, 2018-07-09 14:50:36
SELECT 
	tblPosts.idPost,
	tblPosts.postTitle, 
	tblPosts.postCode, 
	tblPostsStatus.scsTitle, 
	concat(code, '<br>', pTitle) AS pTitle, (CASE WHEN postResult = 1 THEN 'yes' ELSE 'no' END) AS postResult , 
	concat(date_format(postStartedDate, '%d.%m.%Y'), '<br>', date_format(postStartedDate, '%H:%i')) AS dateStart, 
	date_format(tblPosts.updated_at, '%d.%m.%Y %H:%i') AS dtUpdated, tblPerson.mobile, tblPerson.mail, tblPerson.isoLang, tblPostsReason.surname, 
	concat(coalesce(clientFName, ''), ' ', coalesce(clientName, '')) AS client, 
	concat(coalesce(concat(tblGender.gender, ' '), ''), coalesce(eFName, ''), ' ', coalesce(eName, '')) AS pers, 
	(CASE WHEN tblPosts.idCollab is NULLTHEN '' ELSE concat(coalesce(tblCol.cFName, ''), ' ', coalesce(tblCol.cName, '')) END) AS starter, 
	concat("<img src='img/status_", tblPosts.status, ".png' height='12px' border='1' />") AS displaystat,
	concat("<a href='index.php?arg=posts&id=", tblPosts.idPost, "&idAccess=", coalesce(tblAccess.idAccess, ''), "' title='Prepare Interface'><img src='../DG/styles/flat/images/edit.gif' style='height:14px; width:32px;' border='0'></a>") AS elink, 
	concat("<a href='email.php?frame=1&idPost=", tblPosts.idPost, "&source=PERS&idSrc=", tblPerson.idPerson, "&lang=", tblPerson.isoLang, "&from=", ";;SENDER", "&to=", tblPerson.persMail, "&idTperslate=CLI_diff_joindre_can,PERS_demande_contact,PERS_demande_CV&title=", replace(replace(replace(coalesce(pTitle, ''), "'", ";;APO"), "(", ";;PLT"), ")", ";;PGT"), "' title='", concat(coalesce(persName, ''), ' ', coalesce(persFname, '')), "' class='fancybox fancybox.iframe'><img src='img/email.png' height='12px' border='1' title='Messages' ></a>") AS mailink, 
	concat("<a href='post_email.php?frame=1&op=resend&idPosts=", tblPosts.idPost, "&idPerson=", tblPerson.idPerson, "&lang=", tblPerson.isoLang, "&idAccess=", coalesce(tblAccess.idAccess, ''), "&title=", replace(replace(replace(coalesce(pTitle, ''), "'", ";;APO"), "(", ";;PLT"), ")", ";;PGT"), "' title='", concat(coalesce(perName, ''), ' ', coalesce(perFName, '')), "' class='fancybox fancybox.iframe'><img src='img/emailNew.png' height='12px' border=1 title='New Posts' ></a>") AS newlink, 
	concat("<a href='comment.php?idPosts=", tblPosts.idPost, "&idPostsElem=-1&idClient=", tblPosts.idClient, "&frame=1&title=", replace(replace(replace(pTitle, "'", ";;APO"), "(", ";;PLT"), ")", ";;PGT"), "' title='", concat(coalesce(persName, ''), ' ', coalesce(persFName, '')), "' class='fancyboxstepreload fancybox.iframe'><div id='divBadgeComm", tblPosts.idPost, "' class='divBadge'>", (select count(*) from tblComment where idPosts=tblPosts.idPost and idElem is NULLand visibleClient=1), "</div><img src='img/comment.png' height='12px' border='1' title='Comments' /></a>") AS comments, 
	concat("<a href='docs.php?frame=1&idPosts=", tblPosts.idPost, "&title=", replace(replace(replace(pTitle, "'", ";;APO"), "(", ";;PLT"), ")", ";;PGT"), "' title='", concat(coalesce(persName, ''), ' ', coalesce(persFname, '')), "' class='fancyboxstep fancybox.iframe'><div id='divBadgeDocument", tblPosts.idPost, "' class='divBadge'>", (select count(*) from tblDocs where idPosts=tblPosts.idPost and docFileName <> '' and status=1), "</div><img src='img/dir.png' height='12px' border='1' title='Docs' /></a>") AS documents, 
FROM tblPosts
-- lots of LEFT JOIN
WHERE 1;

Maybe he didn't know how to do it in PHP ?

By Not a real programmer, 2018-07-10 11:03:17

    def dow_to_dict_from_self(self):
        # res = {'name': self.name, 'enabled': self.enabled }
        res = {'sun': 0, 'mon': 0, 'tue': 0, 'wed': 0, 'thr': 0, 'fri': 0,
               'sat': 0,
               'enabled': 0, 'dow': 0, 'name': 'untitled'}

        if (int(self.days_of_week) & 0x01) == 0x01:  # sun
            res['sun'] = 1
        if (int(self.days_of_week) & 0x02) == 0x02:  # mon
            res['mon'] = 1
        if (int(self.days_of_week) & 0x04) == 0x04:  # tue
            res['tue'] = 1
        if (int(self.days_of_week) & 0x08) == 0x08:  # wed
            res['wed'] = 1
        if (int(self.days_of_week) & 0x10) == 0x10:  # thr
            res['thr'] = 1
            res['thu'] = 1  # '%a' returns thu for Thursday
        if (int(self.days_of_week) & 0x20) == 0x20:  # fri
            res['fri'] = 1
        if (int(self.days_of_week) & 0x40) == 0x40:  # sat
            res['sat'] = 1
        if (int(
                self.days_of_week) & 0x40) == 0x80:  # enabled # new enable#
            # flag -- duplicate in db
            res['enabled'] = 1

        res['enabled'] = self.enabled  # remove this
        res['dow'] = self.days_of_week
        res['name'] = self.name

        return res

kept the original comments - they're very helpful

By Anonymous, 2018-07-11 19:40:44