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 | |
| if (file_exists(__DIR__ . '/' . $_SERVER['REQUEST_URI'])) { | |
| return false; // serve the requested resource as-is. | |
| } else { | |
| include_once 'index.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
| RewriteEngine on | |
| RewriteCond %{REQUEST_FILENAME} !-d | |
| RewriteCond %{REQUEST_FILENAME} !-f | |
| RewriteRule . index.php [L] |
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 | |
| /** | |
| * Password hash generator | |
| * | |
| * @static | |
| * @param string $password | |
| * @return string | |
| */ | |
| public static function passwordHash ($password) |
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 | |
| /** | |
| * Return URL-Friendly string slug | |
| * @param string $string | |
| * @return string | |
| */ | |
| function seoUrl($string) { | |
| //Unwanted: {UPPERCASE} ; / ? : @ & = + $ , . ! ~ * ' ( ) | |
| $string = strtolower($string); |
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
| /** | |
| * insertTextAtCursor | |
| * An Utility function | |
| * @param href | |
| * @param selectedText | |
| */ | |
| function insertTextAtCursor(href, selectedText) { | |
| var html = "<a href='" + href + "'>" + selectedText + "</a>"; | |
| var selectPastedContent = false; | |
| var sel, range; |
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
| // Don't care much about inheritance at this point, but I'll probably attempt it at | |
| // some point via cloning ancestor schema's | |
| var mongoose = require('mongoose'), | |
| Schema = mongoose.Schema; | |
| var Contact = new Schema({ | |
| _type: String, | |
| name: String | |
| }); |
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
| /* | |
| * Selenium WebDriver JavaScript test with Mocha and NodeJS | |
| * | |
| * Start with: SELENIUM=PATH_TO_SELENIUM_JAR/selenium-server-standalone-2.31.0.jar mocha -t 10000 -R list google-sample.js | |
| * | |
| * Download selenium-server-standalone-2.31.0.jar from https://selenium.googlecode.com/files/selenium-server-standalone-2.31.0.jar | |
| * 'sudo su' and 'npm install -g colors mocha selenium-webdriver' | |
| * | |
| * http://visionmedia.github.io/mocha/ | |
| * https://code.google.com/p/selenium/wiki/WebDriverJs |
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
| RSpec.configure do |config| | |
| config.before(:suite) do | |
| DatabaseCleaner.clean_with(:truncation) | |
| end | |
| config.before(:each) do | |
| DatabaseCleaner.strategy = :transaction | |
| end | |
| config.before(:each, js: true) do |
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
| module Constraint | |
| class Staff | |
| def matches?(request) | |
| warden(request).authenticated? && | |
| warden(request).user.staff? | |
| end | |
| private |
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
| class VirtualProxy < BasicObject | |
| def initialize(&loader) | |
| @loader = loader | |
| @object = nil | |
| end | |
| def method_missing(name, *args, &block) | |
| __load__ | |
| @object.public_send(name, *args, &block) | |
| end |