Document moved to: https://github.com/servo/servo/blob/master/HACKING_QUICKSTART.md
This file contains hidden or 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
| /** | |
| * Create a mock iterator over the given array. | |
| * | |
| * @param array $a | |
| * @param string $class The class to use for the mock, should be/implement/extend Iterator | |
| * @param boolean $complete Whether or not to build a complete iteration. This is | |
| * used when an exception/break is expected in the middle of the iteration. | |
| * @param integer $numElms The number of elements that should be iterated in the case of an | |
| * incomplete iteration. | |
| */ |
This file contains hidden or 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 | |
| /** | |
| * The __halt_compiler() function will stop the PHP compiler when called. | |
| * You can then use the __COMPILER_HALT_OFFSET__ constant to grab the contents of the PHP file after the halt. | |
| * In this example a PHP template is stored after the halt, to allow simple separation of logic from templating. | |
| * The template is stored in a temporary file so it can be included and parsed. | |
| * | |
| * See: https://github.com/bobthecow/mustache.php/blob/dev/src/Mustache/Loader/InlineLoader.php | |
| * http://php.net/manual/en/function.halt-compiler.php | |
| */ |
This file contains hidden or 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
| function worker() { | |
| setInterval(function() { | |
| postMessage({foo: "bar"}); | |
| }, 1000); | |
| } | |
| var code = worker.toString(); | |
| code = code.substring(code.indexOf("{")+1, code.lastIndexOf("}")); | |
| var blob = new Blob([code], {type: "application/javascript"}); |
This file contains hidden or 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
| All of these resources were extremely valuable as I researched regex, finite state machines, and regex in Ruby. Check them out, they're full of fantastic information! | |
| Articles | |
| "Exploring Ruby's Regular Expression Algorithm" by Pat Shaughnessy | |
| http://patshaughnessy.net/2012/4/3/exploring-rubys-regular-expression-algorithm | |
| "Finite State Machines and Regular Expressions" by Eli Bendersky | |
| http://www.gamedev.net/page/resources/_/technical/general-programming/finite-state-machines-and-regular-expressions-r3176 | |
| "Regular Expression Matching Can Be Simple and Fast" by Russ Cox |
This file contains hidden or 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
| # Migration to add cube and earthdistance extensions. | |
| class CreatePostgresExtensions < ActiveRecord::Migration | |
| def up | |
| ActiveRecord::Base.connection.execute("CREATE EXTENSION cube;") | |
| ActiveRecord::Base.connection.execute("CREATE EXTENSION earthdistance;") | |
| end | |
| def down | |
| ActiveRecord::Base.connection.execute("DROP EXTENSION earthdistance;") | |
| ActiveRecord::Base.connection.execute("DROP EXTENSION cube;") |
This file contains hidden or 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
| #!/usr/bin/python | |
| import rtmidi, time | |
| buttons = { | |
| 58: 'track_left', | |
| 59: 'track_right', | |
| 46: 'cycle', | |
| 60: 'marker_set', | |
| 61: 'marker_left', |
This file contains hidden or 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
| # Create your superuser | |
| $ mongo | |
| > use admin | |
| > db.createUser({user:"someadmin",pwd:"secret", roles:[{role:"root",db:"admin"}]}) | |
| > exit | |
| # Alias for convenience (optional and at your own risk) | |
| $ echo 'alias mongo="mongo --port 27017 -u someadmin -p secret --authenticationDatabase admin"' >> ~/.bash_profile | |
| $ source ~/.bash_profile |
This file contains hidden or 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
| /* | |
| actually.js | |
| _ _ _ | |
| __ _ __ _ __ _ __ _ ___| |_ _ _ __ _| | |_ _ | |
| / _` |/ _` |/ _` |/ _` |/ __| __| | | |/ _` | | | | | | | |
| | (_| | (_| | (_| | (_| | (__| |_| |_| | (_| | | | |_| |_ | |
| \__,_|\__,_|\__,_|\__,_|\___|\__|\__,_|\__,_|_|_|\__, ( ) | |
| |___/|/ | |
| */ |
This file contains hidden or 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
| source "https://rubygems.org" | |
| gem "prawn" |