.black {
    color: #000;
}

.not-black {
    color: #999;
}
By Anonymous, 2019-03-04 13:45:29
return [word for word in words if any(all(ch in row for ch in word.lower()) for row in rows)]

Filtering words that can be typed using only one row of the keyboard.

By Mark, 2019-02-27 15:53:46
#include<stdio.h>
#include<stdlib.h>	
#include<string.h>	
	int main(void){
	void run_func(char *map[], char *fnt  , char *km , float *x ,  float *y , int line , int row , int lift    );
				char *long_met[3][8] = {{"mile","0.621371"  ,  "yard","1093.61" , "fut","3280.84" , "duim","39370.1" } ,
							{ "mile" ,"1.60934" , "yard","0.0009144" ,  "fut","0.0003048" ,  "duim","0.0000254"},
 			   				{"kilometer","1"  , "meter","1000"  ,   "stmeter","100000" ,   "mmeter","1000000" } }; 
				char *amount[3][4] = { { "gallon" , "0.264172" ,       "quarta" , "1.05669"     } , 
						{"gallon" , " 3.78541"  ,     "quarta" , "0.946353"   },
						{"litr" , "1"  , "mililitr" , "1000"   }};
				char *mass[3][8] = {   {"eng.tonna","0.984207"  ,  "amer.tonna","1.10231" , "stone","157.473" , "funt","2204.62" } ,
   						{ "eng.tonna" , "1.01605" , "amer.tonna", "0.907185" ,  "stone","0.00635029" ,  "funt","0.000453592"},
						{"tonna","1" ,         "kilogram" , "1000"  , "miligram","100000"   , "microgram","1000000"  }}; 
				char **cp;
				char *buf_data;
				char *fnt_sys;
				char *mtr_sys;
				char *word[100];
	while(1){
	int bg  = 0,convert_ch = 3,y = 0, d = 0, numb = 0;
  	float mn =0  , xm = 0 ;
	printf("%s", "enter data for converter: ");
		fgets( (char *) word, 99 ,stdin);
		buf_data = strtok((char *) word, " ");
		if( ! strcmp(buf_data, "funt.sys"   )     ){
		convert_ch = 0;	
		}
		else	if( ! strcmp(buf_data, "metric.sys"    )     ){
			convert_ch = 1;	
		}
		for( bg = 0 ;  buf_data != NULL;  buf_data = strtok(NULL, " ")  , bg++ ) {
			switch(bg){
				case 1:
					if( !strcmp("long_met" , buf_data  )  ){
			  			 y	=   sizeof(*long_met) / sizeof(long_met[0][0]); 
	          	      	                 d	=   sizeof(long_met) /   sizeof(long_met[0][0]); 
			  		        cp  = &long_met[convert_ch][0]  ;
					}
			   		else if(!strcmp("amount" , buf_data  ) ){
			  			 y	= sizeof(*amount) /  sizeof(amount [0][0]); 
		            	                 d	= sizeof(amount) /  sizeof(amount[0][0]); 
				    	        cp = &amount[convert_ch][0] ;
					}
				 	else if(!strcmp("mass" , buf_data  ) ){
				  		 y	= sizeof(*mass ) /  sizeof(mass[0][0]); 
		         		         d	= sizeof(mass ) /  sizeof(mass[0][0]); 
				 		 cp = &mass[convert_ch][0] ; 
					}
					break;
				case 2:
				fnt_sys = buf_data;
					break;
				case 3:
				mtr_sys = buf_data;
					break;
				case 4:
				numb =   atoi(buf_data);
					break;
			}
		}
		if( !y || !d || !cp || convert_ch == 3 || !numb ){
	
			puts("error");
		}
		else{
			run_func( cp,   fnt_sys ,  mtr_sys , &mn ,  &xm , y  , d , convert_ch );
			if( !mn || !xm  ){
		puts("error");
				} else{
			printf("%f\n" , !convert_ch  ?    (mn  /  xm ) * numb :  (  mn  *  xm   ) * numb         );	
			}
		}
	}
	return 0;
	}
	void run_func(char *map[], char *fnt  , char *km , float *x ,  float *y , int line , int row  , int lift    ){
		int m ;
	if(  ( lift )   ){
			row    -= line;	
		}
	for(  m = 0 ; m <= line   ; m++){
		if(!strcmp(fnt,map[m])){
			*x = atof(map[m  + 1] )  ;
			break;
			}
		}
	for( m =   (row  - line) ; m <=  row - 1  ; m++){
		if( !strcmp( km   ,  map[m] ) ){
			*y = atof(map[m  + 1 ] );
			break;
				}
			}
		}
By Gne4do, 2019-02-26 14:38:14
    if (model.env.Trim().ToUpper() == "Release")
    {
        retVal = false;
        if (!string.IsNullOrEmpty(model.Server_Core))
        {
            // Perform a trim in case user specified just whitespace...
            string tmpStr = model.Server_Core.Trim();
            if (!string.IsNullOrEmpty(tmpStr))
            {
                retVal = true;
            }
        }
    }
By Anonymous, 2019-02-25 17:12:31
function uberURLREPLACER(dtTEXTVALUE,boolVALUE){
    
// If statement? what's that?? 
// Naming conventions? Of course not! 
// true/false keywords? I never heard it.
boolVALUE != !1 && dtTEXTVALUE.indexOf('http://') != -1 && (dtTEXTVALUE = dtTEXTVALUE.replace('http://','')) && dtTEXTVALUE.indexOf('.aspx') == -1 && (dtTEXTVALUE += '.aspx');

return dtTEXTVALUE;

}

Here's the weirdest way to create if statement with terrible naming conventions. Its based on real events and production code.

By I've no idea, 2019-02-16 13:16:07
function urlREPLACER(dtTEXTVALUE){
    
    dtTEXTVALUE.indexOf('http://') != -1 && (dtTEXTVALUE = dtTEXTVALUE.replace('http://','')) && dtTEXTVALUE.indexOf('.aspx') == -1 && (dtTEXTVALUE += '.aspx');
    
    return dtTEXTVALUE;
}
By I'm glad, 2019-02-16 13:10:54

string date = user.RegistrationDate.ToShortDateString().ToString();
By Anonymous, 2019-02-13 14:51:41
#335 SQL +14
		CREATE OR REPLACE FUNCTION melodious.query_flags(user_name varchar(32), chan_name varchar(32), igroup_name varchar(32), iflag_name varchar(32), flagcheck bool)
		RETURNS TABLE (
			group_holders jsonb [],
			flag_id int4,
			flag_name varchar(32),
			flag jsonb
		)
		LANGUAGE plpgsql
		AS $$
		DECLARE
			uid int4 := NULL;
			cid int4 := NULL;
			gid int4 := NULL;
		BEGIN
			IF user_name <> '' THEN
				SELECT id INTO uid FROM melodious.accounts WHERE username=user_name;
				IF uid IS NULL THEN
					RAISE EXCEPTION 'no such user';
				END IF;
			END IF;
			IF chan_name <> '' THEN
				SELECT id INTO cid FROM melodious.channels WHERE name=chan_name;
				IF cid IS NULL THEN
					RAISE EXCEPTION 'no such channel';
				END IF;
			END IF;
			IF igroup_name <> '' THEN
				SELECT id INTO gid FROM melodious.groups WHERE name=igroup_name;
				IF gid IS NULL THEN
					RAISE EXCEPTION 'go such group';
				END IF;
			END IF;

			IF igroup_name = '' THEN
				IF iflag_name = '' THEN
					IF user_name = '' AND chan_name = '' THEN
						RETURN QUERY SELECT
							ARRAY_AGG(JSONB_SET(ROW_TO_JSON(gh)::JSONB, '{group_name}'::TEXT[], TO_JSONB((SELECT name FROM melodious.groups WHERE id=gh.group_id LIMIT 1)))) AS group_holders,
							gf.id flag_id,
							gf.name flag_name,
							gf.flag flag
						FROM melodious.group_holders gh
						INNER JOIN melodious.group_flags gf
						ON gh.group_id = gf.group_id
						WHERE (NOT flagcheck) OR (flagcheck AND gh.user_id IS NULL AND gh.channel_id IS NULL)
						GROUP BY gf.id, gf.name;
					ELSIF user_name <> '' AND chan_name <> '' THEN
						RETURN QUERY SELECT
							ARRAY_AGG(JSONB_SET(ROW_TO_JSON(gh)::JSONB, '{group_name}'::TEXT[], TO_JSONB((SELECT name FROM melodious.groups WHERE id=gh.group_id LIMIT 1)))) AS group_holders,
							gf.id flag_id,
							gf.name flag_name,
							gf.flag flag
						FROM melodious.group_holders gh
						INNER JOIN melodious.group_flags gf
						ON gh.group_id = gf.group_id
						WHERE (gh.user_id = uid AND gh.channel_id = cid)
							 OR (flagcheck AND gh.user_id = uid AND gh.channel_id IS NULL)
							 OR (flagcheck AND gh.user_id IS NULL AND gh.channel_id = cid)
							 OR (flagcheck AND gh.user_id IS NULL AND gh.channel_id IS NULL)
						GROUP BY gf.id, gf.name;
					ELSIF user_name <> '' AND chan_name = '' THEN
						RETURN QUERY SELECT
							ARRAY_AGG(JSONB_SET(ROW_TO_JSON(gh)::JSONB, '{group_name}'::TEXT[], TO_JSONB((SELECT name FROM melodious.groups WHERE id=gh.group_id LIMIT 1)))) AS group_holders,
							gf.id flag_id,
							gf.name flag_name,
							gf.flag flag
						FROM melodious.group_holders gh
						INNER JOIN melodious.group_flags gf
						ON gh.group_id = gf.group_id
						WHERE (NOT flagcheck AND gh.user_id = uid)
							 OR (flagcheck AND gh.user_id = uid AND gh.channel_id IS NULL)
							 OR (flagcheck AND gh.user_id IS NULL AND gh.channel_id IS NULL)
						GROUP BY gf.id, gf.name;
					ELSIF user_name = '' AND chan_name <> '' THEN
						RETURN QUERY SELECT
							ARRAY_AGG(JSONB_SET(ROW_TO_JSON(gh)::JSONB, '{group_name}'::TEXT[], TO_JSONB((SELECT name FROM melodious.groups WHERE id=gh.group_id LIMIT 1)))) AS group_holders,
							gf.id flag_id,
							gf.name flag_name,
							gf.flag flag
						FROM melodious.group_holders gh
						INNER JOIN melodious.group_flags gf
						ON gh.group_id = gf.group_id
						WHERE (NOT flagcheck AND gh.channel_id = cid)
							 OR (flagcheck AND gh.user_id IS NULL AND gh.channel_id = cid)
							 OR (flagcheck AND gh.user_id IS NULL AND gh.channel_id IS NULL)
						GROUP BY gf.id, gf.name;
					END IF;
				ELSE
					IF user_name = '' AND chan_name = '' THEN
						RETURN QUERY SELECT
							ARRAY_AGG(JSONB_SET(ROW_TO_JSON(gh)::JSONB, '{group_name}'::TEXT[], TO_JSONB((SELECT name FROM melodious.groups WHERE id=gh.group_id LIMIT 1)))) AS group_holders,
							gf.id flag_id,
							gf.name flag_name,
							gf.flag flag
						FROM melodious.group_holders gh
						INNER JOIN melodious.group_flags gf
						ON gh.group_id = gf.group_id
						WHERE (gf.name = iflag_name)
							AND (
								(NOT flagcheck)
								OR (flagcheck AND gh.user_id IS NULL AND gh.channel_id IS NULL)
							)
						GROUP BY gf.id, gf.name;
					ELSIF user_name <> '' AND chan_name <> '' THEN
						RETURN QUERY SELECT
							ARRAY_AGG(JSONB_SET(ROW_TO_JSON(gh)::JSONB, '{group_name}'::TEXT[], TO_JSONB((SELECT name FROM melodious.groups WHERE id=gh.group_id LIMIT 1)))) AS group_holders,
							gf.id flag_id,
							gf.name flag_name,
							gf.flag flag
						FROM melodious.group_holders gh
						INNER JOIN melodious.group_flags gf
						ON gh.group_id = gf.group_id
						WHERE gf.name = iflag_name
						  AND (
								(gh.user_id = uid AND gh.channel_id = cid)
							 	OR (flagcheck AND gh.user_id = uid AND gh.channel_id IS NULL)
								OR (flagcheck AND gh.user_id IS NULL AND gh.channel_id = cid)
								OR (flagcheck AND gh.user_id IS NULL AND gh.channel_id IS NULL)
							)
						GROUP BY gf.id, gf.name;
					ELSIF user_name <> '' AND chan_name = '' THEN
						RETURN QUERY SELECT
							ARRAY_AGG(JSONB_SET(ROW_TO_JSON(gh)::JSONB, '{group_name}'::TEXT[], TO_JSONB((SELECT name FROM melodious.groups WHERE id=gh.group_id LIMIT 1)))) AS group_holders,
							gf.id flag_id,
							gf.name flag_name,
							gf.flag flag
						FROM melodious.group_holders gh
						INNER JOIN melodious.group_flags gf
						ON gh.group_id = gf.group_id
						WHERE gf.name = iflag_name
							AND (
								(NOT flagcheck AND gh.user_id = uid)
								OR (flagcheck AND gh.user_id = uid AND gh.channel_id IS NULL)
								OR (flagcheck AND gh.user_id IS NULL AND gh.channel_id IS NULL)
							)
						GROUP BY gf.id, gf.name;
					ELSIF user_name = '' AND chan_name <> '' THEN
						RETURN QUERY SELECT
							ARRAY_AGG(JSONB_SET(ROW_TO_JSON(gh)::JSONB, '{group_name}'::TEXT[], TO_JSONB((SELECT name FROM melodious.groups WHERE id=gh.group_id LIMIT 1)))) AS group_holders,
							gf.id flag_id,
							gf.name flag_name,
							gf.flag flag
						FROM melodious.group_holders gh
						INNER JOIN melodious.group_flags gf
						ON gh.group_id = gf.group_id
						WHERE gf.name = iflag_name
							AND (
								(NOT flagcheck AND gh.channel_id = cid)
								OR (flagcheck AND gh.channel_id = cid AND gh.user_id IS NULL)
								OR (flagcheck AND gh.channel_id IS NULL AND gh.user_id IS NULL)
							)
						GROUP BY gf.id, gf.name;
					END IF;
				END IF;
			ELSE
				IF iflag_name = '' THEN
					IF user_name = '' AND chan_name = '' THEN
						RETURN QUERY SELECT
							ARRAY_AGG(JSONB_SET(ROW_TO_JSON(gh)::JSONB, '{group_name}'::TEXT[], TO_JSONB(igroup_name))) AS group_holders,
							gf.id flag_id,
							gf.name flag_name,
							gf.flag flag
						FROM melodious.group_holders gh
						INNER JOIN melodious.group_flags gf
						ON gh.group_id = gf.group_id
						WHERE gh.group_id = gid
							AND (
								(NOT flagcheck)
								OR (flagcheck AND gh.user_id IS NULL AND gh.channel_id IS NULL)
							)
						GROUP BY gf.id, gf.name;
					ELSIF user_name <> '' AND chan_name <> '' THEN
						RETURN QUERY SELECT
							ARRAY_AGG(JSONB_SET(ROW_TO_JSON(gh)::JSONB, '{group_name}'::TEXT[], TO_JSONB(igroup_name))) AS group_holders,
							gf.id flag_id,
							gf.name flag_name,
							gf.flag flag
						FROM melodious.group_holders gh
						INNER JOIN melodious.group_flags gf
						ON gh.group_id = gf.group_id
						WHERE gh.group_id = gid
							AND (
								(gh.channel_id = cid AND gh.user_id = uid)
								OR (flagcheck AND gh.channel_id = cid AND gh.user_id IS NULL)
								OR (flagcheck AND gh.channel_id IS NULL AND gh.user_id = uid)
								OR (flagcheck AND gh.channel_id IS NULL AND gh.user_id IS NULL)
							)
						GROUP BY gf.id, gf.name;
					ELSIF user_name <> '' AND chan_name = '' THEN
						RETURN QUERY SELECT
							ARRAY_AGG(JSONB_SET(ROW_TO_JSON(gh)::JSONB, '{group_name}'::TEXT[], TO_JSONB(igroup_name))) AS group_holders,
							gf.id flag_id,
							gf.name flag_name,
							gf.flag flag
						FROM melodious.group_holders gh
						INNER JOIN melodious.group_flags gf
						ON gh.group_id = gf.group_id
						WHERE gh.group_id = gid
							AND (
								(NOT flagcheck AND gh.user_id = uid)
								OR (flagcheck AND gh.user_id = uid AND gh.channel_id IS NULL)
								OR (flagcheck AND gh.user_id IS NULL AND gh.channel_id IS NULL)
							)
						GROUP BY gf.id, gf.name;
					ELSIF user_name = '' AND chan_name <> '' THEN
						RETURN QUERY SELECT
							ARRAY_AGG(JSONB_SET(ROW_TO_JSON(gh)::JSONB, '{group_name}'::TEXT[], TO_JSONB(igroup_name))) AS group_holders,
							gf.id flag_id,
							gf.name flag_name,
							gf.flag flag
						FROM melodious.group_holders gh
						INNER JOIN melodious.group_flags gf
						ON gh.group_id = gf.group_id
						WHERE gh.group_id = gid
							AND (
								(NOT flagcheck AND gh.channel_id = cid)
								OR (flagcheck AND gh.channel_id = cid AND gh.user_id IS NULL)
								OR (flagcheck AND gh.channel_id IS NULL AND gh.user_id IS NULL) 
							)
						GROUP BY gf.id, gf.name;
					END IF;
				ELSE
					IF user_name = '' AND chan_name = '' THEN
						RETURN QUERY SELECT
							ARRAY_AGG(JSONB_SET(ROW_TO_JSON(gh)::JSONB, '{group_name}'::TEXT[], TO_JSONB(igroup_name))) AS group_holders,
							gf.id flag_id,
							gf.name flag_name,
							gf.flag flag
						FROM melodious.group_holders gh
						INNER JOIN melodious.group_flags gf
						ON gh.group_id = gf.group_id
						INNER JOIN melodious.groups g
						ON g.id = gh.group_id
						WHERE (gf.name = iflag_name AND gh.group_id = gid)
							AND (
								(NOT flagcheck)
								OR (flagcheck AND gh.channel_id IS NULL AND gh.user_id IS NULL)
							)
						GROUP BY gf.id, gf.name;
					ELSIF user_name <> '' AND chan_name <> '' THEN
						RETURN QUERY SELECT
							ARRAY_AGG(JSONB_SET(ROW_TO_JSON(gh)::JSONB, '{group_name}'::TEXT[], TO_JSONB(igroup_name))) AS group_holders,
							gf.id flag_id,
							gf.name flag_name,
							gf.flag flag
						FROM melodious.group_holders gh
						INNER JOIN melodious.group_flags gf
						ON gh.group_id = gf.group_id
						WHERE (gf.name = iflag_name AND gh.group_id = gid)
							AND (
								(gh.user_id = uid AND gh.channel_id = cid)
								OR (flagcheck AND gh.user_id = uid AND gh.channel_id IS NULL)
								OR (flagcheck AND gh.user_id IS NULL AND gh.channel_id = cid)
								OR (flagcheck AND gh.user_id IS NULL AND gh.channel_id IS NULL)
							)
						GROUP BY gf.id, gf.name;
					ELSIF user_name <> '' AND chan_name = '' THEN
						RETURN QUERY SELECT
							ARRAY_AGG(JSONB_SET(ROW_TO_JSON(gh)::JSONB, '{group_name}'::TEXT[], TO_JSONB(igroup_name))) AS group_holders,
							gf.id flag_id,
							gf.name flag_name,
							gf.flag flag
						FROM melodious.group_holders gh
						INNER JOIN melodious.group_flags gf
						ON gh.group_id = gf.group_id
						WHERE (gh.group_id = gid AND gf.name = iflag_name)
							AND (
								(NOT flagcheck AND gh.user_id = uid)
								OR (flagcheck AND gh.user_id = uid AND gh.channel_id IS NULL)
								OR (flagcheck AND gh.user_id IS NULL AND gh.channel_id IS NULL)
							)
						GROUP BY gf.id, gf.name;
					ELSIF user_name = '' AND chan_name <> '' THEN
						RETURN QUERY SELECT
							ARRAY_AGG(JSONB_SET(ROW_TO_JSON(gh)::JSONB, '{group_name}'::TEXT[], TO_JSONB(igroup_name))) AS group_holders,
							gf.id flag_id,
							gf.name flag_name,
							gf.flag flag
						FROM melodious.group_holders gh
						INNER JOIN melodious.group_flags gf
						ON gh.group_id = gf.group_id
						WHERE (gf.name = iflag_name AND gh.group_id = gid)
							AND (
								(NOT flagcheck AND gh.channel_id = cid)
								OR (flagcheck AND gh.channel_id = cid AND gh.user_id IS NULL)
								OR (flagcheck AND gh.channel_id IS NULL AND gh.user_id IS NULL)
							)
						GROUP BY gf.id, gf.name;
					END IF;
				END IF;
			END IF;
		END;
		$$;
By Anonymous, 2019-02-05 15:36:52
public class NullableFloatToNullableDoubleConverter : ITypeConverter<float?, double?>
    {
        public double? Convert(float? source, double? destination, ResolutionContext context)
        {
            if (source == null)
            {
                return null;
            }

            var floatAsString = source.Value.ToString(CultureInfo.InvariantCulture);

            return double.Parse(floatAsString);
        }
    }
By Anonymous, 2019-01-31 12:05:33
if (responseCode / 100 == 2) {//success
    return handleSuccess();
} else if (responseCode == 401) {
    return handleNotAuthorized();
} else {
    // something else
} 
By Anonymous, 2019-01-29 09:41:13
doit({txs, [Tx]}) ->
    X = tx_pool_feeder:absorb(Tx),
    Y = case X of
	    ok -> hash:doit(testnet_sign:data(Tx));
	    _ -> <<"error">>
		     end,
    {ok, Y};

In my opinion api response should be as confusing as possible. This method is used for sending tx into Amoveo blockchain. It returns ["ok", ] in success, and ["ok", <base64 encoded «error» word>] I hope I inspired you to make your code totally confusing and irrational.

By Zack Hess, 2019-01-24 12:19:04
date('Y-m-d').'T'.date("H:i:s", strtotime("- 1 hour")).'Z'

Back to the future

By loutre, 2018-12-19 15:37:45
class FileReader extends EventTarget(...READER_EVENTS) {
    // [...]
    readAsArrayBuffer() {
        throw new Error('FileReader.readAsArrayBuffer is not implemented');
    }
}

React Native's way of saying they don't support FileReader.readAsArrayBuffer()

By Aurovik, 2018-12-12 12:50:22
for data1, data2 in zip(results, results[1:]):
    assert data1 <= data1
    if data1 == data1:
        assert data1 >= data1

A nice loop for making sure that data1 is equal to data1!

By 1133, 2018-12-10 14:43:50
17 *	* * *	root	[[ $(ping -c1 8.8.8.8 | tail -n2 | head -n1 | cut -d"," -f2 | cut -d" " -f2) != "1" ]] && { { /etc/init.d/networking restart && /etc/init.d/network-manager restart && curl "https://api.telegram.org/XXX:XXX/sendMessage?chat_id=XXX&text=\%22networking\%20and\%20network-manager\%20restarted\%22" ;} && { wget -O /dev/null -o /dev/null https://nyifiles.pfsense.org/mirror/downloads/pfSense-CE-2.3.5-RELEASE-2g-i386-nanobsd.img.gz && curl "https://api.telegram.org/XXX:XXX/sendMessage?chat_id=XXX&text=\%22wget\%20download\%20OK\%22" || curl "https://api.telegram.org/XXX:XXX/sendMessage?chat_id=XXX&text=\%22wget\%20download\%20KO\%22" ;} ;}

With me! Sing! It's gonna ping! If not it's gonna restart the net! If yes is gonna send you a text! And then is gonna download a file, just to check!

By AnonimaBazhi, 2018-12-04 19:33:23