Skip to content

Instantly share code, notes, and snippets.

@Transfusion
Last active August 29, 2015 14:02
Show Gist options
  • Save Transfusion/b6d82a4e92f2aaa3bf33 to your computer and use it in GitHub Desktop.
Save Transfusion/b6d82a4e92f2aaa3bf33 to your computer and use it in GitHub Desktop.

Awk

17 characters

/42/{print"SIGN"}

Bash

18 characters

grep 42&&echo SIGN

Contributors: xnrand, EXio4

Brainfuck

41 characters

>,<,[-->+>+++>+++<<<]>++++++.>--.--.>+++.

Contributors: Transfusion

C

54 characters

Note: Compile with clang.

main(){char*b;gets(b);if(strstr(b,"42"))puts("SIGN");}

CoffeeScript

32 characters

Note: Assumes a browser.

prompt().match(42)&&alert 'SIGN'

Contributors: michealharker

Haskell

69 characters

p[]="";p('4':'2':_)="SIGN";p(_:xs)=p xs;main=do x<-getLine;putStr$p x

Contributors: EXio4

JavaScript

33 characters

Note: Assumes a browser.

prompt().match(42)&&alert('SIGN')

Contributors: michealharker

LiveScript

29 characters

Note: Assumes a browser.

prompt!match(42)&&alert \SIGN

Contributors: michealharker

Perl

20 characters

<>=~42&&print 'SIGN'

PHP

45 characters

<?strpos($argv[1],'42')!==FALSE&&print SIGN;

Python 2

32 characters

if'42'in raw_input():print'SIGN'

Contributors: xnrand

Python 3

30 characters

if'42'in input():print('SIGN')

Contributors: xnrand

QBasic

39 characters

IF INSTR(COMMAND$,"42")THEN PRINT"SIGN"

Ruby

20 characters

p'SIGN'if gets['42']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment