Want to create a Gist from your editor, the command line, or the Services menu? Here's how.
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 | |
class FlyingObject extends Exception { | |
public $object; | |
public function __construct($object) { | |
$this->object = $object; | |
} | |
} | |
abstract class Object { | |
public function outOfWindow() { |
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
#!/bin/bash | |
LINES=$(tput lines) | |
COLUMNS=$(tput cols) | |
declare -A snowflakes | |
declare -A lastflakes | |
clear |
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
#!/bin/bash | |
LINES=$(tput lines) | |
COLUMNS=$(tput cols) | |
declare -A snowflakes | |
declare -A lastflakes | |
clear |
Some improvements have been made for parser and lexer grammars in Jison 0.3 (demonstrated in the FlooP/BlooP example below.)
For lexers:
- Patterns may use unquoted characters instead of strings
- Two new options,
%options flex case-insensitive
flex
: the rule with the longest match is used, and no word boundary patterns are addedcase-insensitive
: all patterns are case insensitive- User code section is included in the generated module
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 | |
class ♥ { | |
} | |
$♥ = new ♥(); |
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
#include <stdio.h> | |
#define CONFIG_FOO 1 | |
#define CONFIG_NOO 0 | |
#define is_set(macro) is_set_(macro) | |
#define macrotest_1 , | |
#define is_set_(value) is_set__(macrotest_##value) | |
#define is_set__(comma) is_set___(comma 1, 0) | |
#define is_set___(_, v, ...) v |
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
AW Map Editor file format specifications. | |
- by João Pedro S. Francese (Roma_emu) [joaofrancese@gmail.com] | |
- last updated on February 04, 2008 | |
Please inform me before using this file format in your project - but please DO use it, | |
if it involves AW maps! A standard file format is good for everyone, because it makes sure | |
the files are compatible between different programs. If you use it, please credit Kamek | |
(the file format's creator) and me (the map editor's creator) somewhere. :) | |
Personally I would prefer if you didn't try to make another editor... | |
But it's not really up to me, is it? |
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 | |
$input = "root(27,3)"; | |
$number = '(?:-?\d+(?:\.\d+)?)'; | |
while (!preg_match('/^'.$number.'$/', $input)) { | |
$input = preg_replace_callback('/\(\s*('.$number.')\s*\)/', function ($matches) { | |
return $matches[1]; | |
}, $input); | |
$input = preg_replace_callback('/('.$number.')\s*\^\s*('.$number.')/', function ($matches) { | |
return pow($matches[1], $matches[2]); |
OlderNewer