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( ! preg_match('/^'.Config::get('app.domain').'$/', Request::server('HTTP_HOST')) ) { | |
// Setup the host | |
$host = Request::server('HTTP_HOST'); | |
$domain = preg_replace('/^www\./', '', $host); | |
// Setup domain configuration | |
Config::set('app.url', 'http://' . $host); |
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 | |
class foo { | |
protected $registry = []; | |
public function __construct() | |
{ | |
$that = $this; | |
$containers = [ |
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
import commands | |
import platform | |
import os.path | |
# Check distribution | |
distro = platform.linux_distribution()[0] | |
# Find out distribution we're on (version and architecture wouldn't matter) | |
if distro == 'Ubuntu': | |
httpServices = ['apache2', 'nginx'] |
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 | |
App::uses('AuthComponent', 'Controller/Component'); | |
class AuthExtensionComponent extends AuthComponent { | |
// AuthExtension Notes | |
// This will override default routines of AuthComponent | |
// `$this->Auth->user()` as per the default will return as an array | |
// `$this->user()` is modified to only contain `Account.id` |
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
set nocompatible | |
filetype off | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
Plugin 'gmarik/Vundle.vim' | |
Plugin 'airblade/vim-gitgutter' | |
Plugin 'bling/vim-airline' | |
Plugin 'kien/ctrlp.vim' |
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
require 'curb' | |
x = 500 | |
i = 0 | |
while x > i do | |
# Creates a random string | |
o = [('a'..'z'), ('A'..'Z')].map { |i| i.to_a }.flatten | |
string = (0...10).map { o[rand(o.length)] }.join |
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
require 'open-uri' | |
urls = [ | |
'http://example.com/image.jpg', | |
'http://example.com/image2.jpg' | |
] | |
urls.each do |url| | |
open(url, :http_basic_authentication => [user, pass]) {|f| | |
File.open(File.basename(url),"wb") do |file| |
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
# Install Nginx | |
echo "Installing Nginx.." | |
sleep 2 | |
cat <<EOF > /etc/yum.repos.d/nginx.repo | |
[nginx] | |
name=nginx repo | |
baseurl=http://nginx.org/packages/centos/6/\$basearch/ | |
gpgcheck=0 | |
enabled=1 | |
EOF |
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 | |
class Repository | |
{ | |
/** | |
* Mass assignment based on fillable, hidden, and guarded attributes | |
* | |
* @param obj $model | |
* @param arr $insertArray |
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 | |
use Phalcon\Mvc\View; | |
class Controller extends \Phalcon\Mvc\Controller | |
{ | |
/** | |
* | |
* @return \Phalcon\Http\Response | |
*/ |
OlderNewer