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
| /** | |
| * 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
| start westeros=node(0) | |
| set westeros.name = "Westeros" | |
| create targaryen={house:"Targaryen"}, | |
| stark={house:"Stark"}, | |
| lannister={house:"Lannister"}, | |
| baratheon={house:"Baratheon"}, | |
| tully={house:"Tully"} |
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
| (ns ring.middleware.x-forwarded-for | |
| (:use [clojure.string :only (split)])) | |
| (defn wrap-x-forwarded-for [handler] | |
| (fn [request] | |
| (if-let [xff (get-in request [:headers "x-forwarded-for"])] | |
| (handler (assoc request :remote-addr (last (split xff #"\s*,\s*")))) | |
| (handler request)))) |
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
Show hidden characters
| { | |
| "cmd": ["buster-test", "--reporter", "xUnitConsole", "--color", "none"], | |
| "working_dir": "${project_path}", | |
| "selector": "source.js", | |
| "file_regex": "@(.*?):([0-9]*)" | |
| } |
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/env ruby | |
| # update git submodules | |
| `git submodule init && git submodule update` | |
| # update symlinks | |
| # inspired by http://errtheblog.com/posts/89-huba-huba | |
| home = File.expand_path('~') |
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
| require "csv" | |
| class HerokuEnvLogger | |
| PREFIX = "HerokuRequest" | |
| TIME_STEP = 1.minute * 1000 # ms | |
| EXPIRE_IN = 6.hours | |
| KEYS = %w[HTTP_X_REQUEST_START | |
| HTTP_X_HEROKU_QUEUE_WAIT_TIME | |
| HTTP_X_HEROKU_QUEUE_DEPTH | |
| HTTP_X_HEROKU_DYNOS_IN_USE] |
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
| # To install the Python client library: | |
| # pip install -U selenium | |
| # Import the Selenium 2 namespace (aka "webdriver") | |
| from selenium import webdriver | |
| # iPhone | |
| driver = webdriver.Remote(browser_name="iphone", command_executor='http://172.24.101.36:3001/hub') | |
| # Android |
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/env ruby | |
| # | |
| # Uses Stas Malyshev's migrate.php script to check code style | |
| # | |
| require ENV['TM_SUPPORT_PATH'] + '/lib/textmate' | |
| version = %x{#{ENV['TM_PHP'] || 'php'} -v}.split[0..2].join(' ') | |
| result = `#{ENV['TM_PHP'] || 'php'} /Users/olle/opensource/php/migrate/migrate.php '#{ENV['TM_FILEPATH']}'` | |
| result.gsub!("in file #{ENV['TM_FILEPATH']}", '') | |
| puts "OK!" if result.empty? | |
| puts result |