Instance | Branch |
---|
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 | |
# JSONP "callback" param explanation, via basic PHP script. | |
# | |
# "Cowboy" Ben Alman | |
# http://benalman.com/ | |
# Set $data to something that will be serialized into JSON. You'll undoubtedly | |
# have your own code for this. | |
$data = array("some_key" => "some_value"); |
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
#!/usr/bin/env ruby | |
# This pre-commit hook will prevent any commit to forbidden branches | |
# (by default, "staging" and "production"). | |
# Put this file in your local repo, in the .git/hooks folder | |
# and make sure it is executable. | |
# The name of the file *must* be "pre-commit" for Git to pick it up. | |
FORBIDDEN_BRANCHES = ["staging", "production"] |
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 :application, "My Static Content" | |
set :servername, 'test.example.com' | |
# no git? simply deploy a directory | |
set :scm, :none | |
set :repository, "." # the directory to deploy | |
# using git? deploy from local git repository | |
# set :scm, :git | |
# set :repository, 'file//.' # path to local git repository |
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 | |
Route::get('protected', array('before' => 'auth|role:admin', function() { | |
return "Only admins can see this"; | |
})); | |
Route::filter('role', function ($role) { | |
if ( ! Auth::user()->has_role( $role ) ) | |
{ | |
return Response::error("401"); // not authorized |
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
Enable tracing example: | |
zend_extension="/usr/lib/php5/20090626+lfs/xdebug.so" | |
xdebug.auto_trace=1 | |
xdebug.trace_output_dir="/tmp/xdebug/" | |
xdebug.collect_params=4 | |
xdebug.collect_return=1 | |
xdebug.trace_options=1 | |
xdebug.show_local_vars=1 |
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
public function afterExecuteRoute($dispatcher) { | |
$is_ajax = isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'; | |
if ($is_ajax) { | |
$this->view->disableLevel(\Phalcon\Mvc\View::LEVEL_MAIN_LAYOUT); | |
$eventsManager = new \Phalcon\Events\Manager(); | |
$eventsManager->attach('view:afterRender', function ($event, $view) { | |
$view->setContent(json_encode(array( | |
'content' => $view->getContent(), |
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
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
SSHPass is a tiny utility, which allows you to provide the ssh password without using the prompt. This will very helpful for scripting. SSHPass is not good to use in multi-user environment. If you use SSHPass on your development machine, it don't do anything evil.
apt-get install sshpass
OlderNewer