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
# config.yml | |
fos_rest: | |
format_listener: | |
rules: | |
- { path: ^/, priorities: [ json, xml, html ], fallback_format: ~, prefer_extension: false } | |
view: | |
view_response_listener: force | |
sensio_framework_extra: | |
view: { annotations: false } |
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
guard :shell do | |
watch(%r{^spec/.+Spec.php}) { |m| | |
system("clear") | |
system("bin/phpspec run --no-interaction --format=pretty #{m[0]}") | |
} | |
watch(%r{^src/(.+).php}) { | |
system("clear") | |
system("bin/phpspec run --no-interaction --format=pretty") | |
} |
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 (file_exists(__DIR__ . '/' . $_SERVER['REQUEST_URI'])) { | |
return false; // serve the requested resource as-is. | |
} else { | |
include_once 'index.php'; | |
} |
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
RewriteEngine on | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule . index.php [L] |
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 | |
/** | |
* Password hash generator | |
* | |
* @static | |
* @param string $password | |
* @return string | |
*/ | |
public static function passwordHash ($password) |
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 | |
/** | |
* Return URL-Friendly string slug | |
* @param string $string | |
* @return string | |
*/ | |
function seoUrl($string) { | |
//Unwanted: {UPPERCASE} ; / ? : @ & = + $ , . ! ~ * ' ( ) | |
$string = strtolower($string); |
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
/** | |
* 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 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 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 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 |
OlderNewer