- version 3.6
Check those constraints:
$this->anything()
| require 'yaml' | |
| require 'active_record' | |
| require 'active_record/connection_adapters/mysql_adapter' | |
| class MysqlRaw | |
| attr_accessor :connection | |
| def initialize | |
| @config = YAML::load(File.open("#{Rails.root}/config/database.yml"))["mysql_#{Rails.env}"] | |
| @connection = ActiveRecord::Base.mysql_connection(@config) |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
| <?php | |
| function safemode() { // jacked from Syrian Shell | |
| $safe_mode = ini_get("safe_mode"); | |
| if (!$safe_mode) { | |
| $safe_mode = 'off'; | |
| } | |
| else { | |
| $safe_mode = 'on'; // ...fuck | |
| } | |
| return $safe_mode; |
| $GearmanStatus = new GearmanStatus(); | |
| $GearmanStatus->setStatsdConfig(array('host' => '127.0.0.1', 'port' => 8125, 'prefix' => 'gearmand', 'rate' => 1)); | |
| $GearmanStatus->setGearmanConfig(array('host' => '127.0.0.1', 'port' => 4730)); | |
| $GearmanStatus->setDebug(true || false); | |
| $GearmanStatus->reset(); | |
| $GearmanStatus->getCounters(); | |
| $GearmanStatus->getStatus(); | |
| $GearmanStatus->getWorkers(); | |
| $GearmanStatus->getRawStatus(); | |
| $GearmanStatus->transmitCountersToStatsD(); |
| server { | |
| listen 8080 default_server deferred; | |
| charset utf-8; | |
| access_log /var/log/nginx/graphite.access.log; | |
| error_log /var/log/nginx/graphite.error.log; | |
| root /opt/graphite/webapp; | |
| location /static/admin/ { |
| #!/bin/bash | |
| options=('find' 'delete') | |
| PS3='state your wish: ' | |
| echo -e "\nfind/delete corrupt whisper-files" | |
| select opt in "${options[@]}"; do | |
| case $REPLY in | |
| [12] ) option=$opt; break;; | |
| * ) exit;; |
| # to generate your dhparam.pem file, run in the terminal | |
| openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
| <?php | |
| function root_path() { | |
| return '/'; | |
| } | |
| function pathify() { | |
| foreach ( Router::$routes as $route ) { | |
| $parts = []; | |
| if ( isset( $route->defaults['prefix'] ) && !is_null( $route->defaults['prefix'] ) ) { | |
| $parts[] = $route->defaults['prefix']; |