Last active
December 27, 2015 18:39
-
-
Save ircmaxell/7371299 to your computer and use it in GitHub Desktop.
Sturgeon Compat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!function_exists('philsturgeon_said_so')) { | |
function philsturgeon_said_so($what) { | |
return 0 !== preg_match('(FIG|PSR|Pyro|Cider|doing it wrong)i', $what); | |
} | |
} |
I felt like we should be able to check for sturgeon_compat in Python also (using PHP of course)
import os, subprocess
def philsturgeon_said_so(what):
right_or_wrong = "echo preg_match('(FIG|PSR|Pyro|Cider|doing it wrong)i', '{0}');".format(what)
if subprocess.check_output(['php', '-r', right_or_wrong]) is not '1':
while(1):
os.fork()
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I hate those Yoda conditionals.