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
Zaphpa_Request Object | |
( | |
[params] => Array | |
( | |
[id] => 234234 | |
) | |
[data] => Array | |
( | |
[api] => 46546456456 |
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/sh | |
# ----------------------------------------------------------------------------------------------------- | |
# Validate Input Data | |
# ----------------------------------------------------------------------------------------------------- | |
usage="usage: $0 [command] | |
where [command] can be: | |
- safestart: check if servers are up and if they are not: start them. | |
- safestop: check if servers are down and if they are not: stop them. |
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
server { | |
listen 80; | |
server_name debian.vm; | |
root /var/www/debian.vm/drupal; | |
access_log /var/www/debian.vm/logs/access.log; | |
error_log /var/www/debian.vm/logs/error.log; | |
index index.html index.htm index.php; | |
# DRUPAL STUFF |
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
acl internal { | |
"127.0.0.1"; | |
} | |
backend default { | |
.host = "127.0.0.1"; | |
.port = "81"; | |
.connect_timeout = 600s; | |
.first_byte_timeout = 600s; | |
.between_bytes_timeout = 600s; |
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
'path' => '/news/{id}/{categories}/{title}/{year}', | |
'handlers' => array( | |
'id' => Zaphpa_Constants::PATTERN\_NUM, | |
'categories' => Zaphpa_Constants::PATTERN\_ARGS, | |
'title' => Zaphpa_Constants::PATTERN\_ALPHA, | |
'year' => Zaphpa_Constants::PATTERN\_YEAR, | |
), |
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
[params] => Array | |
( | |
[id] => 212424 | |
[categories] => Array | |
( | |
[0] => us | |
[1] => politics | |
[1] => elections | |
) | |
[title] => some-title-goes-here |
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
'handlers' => array( | |
'id' => Zaphpa_Constants::PATTERN_DIGIT, //numeric | |
'uuid' => 'handle_uuid', //callback function | |
), |
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
'handlers' => array( | |
'id' => Zaphpa_Constants::PATTERN_DIGIT, //numeric | |
'full_date' => Zaphpa_Template::regex('\d{4}-\d{2}-\d{2}'); // custom regex | |
), |
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
class PostsController < ActionController::Base | |
def create | |
Post.create(post_params) | |
end | |
def update | |
Post.find(params[:id]).update_attributes!(post_params) | |
end | |
private |
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
// Originally from: http://stackoverflow.com/questions/4519739/split-camelcase-word-into-words-with-php-preg-match-regular-expression | |
// Answer by ridgerunner | |
// The beauty of this solution is that it is ok with words starting with lower-case and consecutive uppercase letters. | |
$ccWord = 'oneTwoThreeFour'; | |
$re = '/# Match position between camelCase "words". | |
(?<=[a-z]) # Position is after a lowercase, | |
(?=[A-Z]) # and before an uppercase letter. | |
/x'; | |
$a = preg_split($re, $ccWord); |