Skip to content

Instantly share code, notes, and snippets.

View zeroasterisk's full-sized avatar

alan blount zeroasterisk

View GitHub Profile
@zeroasterisk
zeroasterisk / HttpsUrlTestShell.php
Last active August 29, 2015 14:19
Check any HTTPS URL to validate it - CakePHP Shell/Command
<?php
/**
* Check any HTTPS URL to validate it
*
* - checkdomain verifies the SSL cert only (working, slow)
* - checkcurl verifies the URL can be loaded via CURL (not working)
*
*/
App::uses('HttpSocket', 'Utility');
@zeroasterisk
zeroasterisk / notes
Created June 2, 2015 17:46
Dart scan for terms
In this example, I am scanning for all of these classes
https://github.com/awatson1978/clinical-ui-vocabulary/
@zeroasterisk
zeroasterisk / nginx_partial.conf
Created June 26, 2015 01:48
nginx config (partial) caching reverse proxy example
# ----------------------------¬
# Proxy config/example
# (optional config used inside server/location blocks)¬
# context - server, location¬
# link: http://wiki.nginx.org/HttpProxyModule#proxy_cache¬
# link: http://nginx.org/en/docs/http/ngx_http_proxy_module.html¬
# link: http://nginx.org/en/docs/http/ngx_http_upstream_module.html
# link: http://www.packtpub.com/article/using-nginx-reverse-proxy¬
# ----------------------------¬
@zeroasterisk
zeroasterisk / darren-pluck.php
Created July 6, 2015 14:59
[KyOSS Discuss] Help with PHP - using values in indexed array to traverse multi-dimensional array
<?php
/**
* pluck out a value from a nested array, based on a $path
* where $path is a single-dim list of keys.
*
* @param array $form (multi-dim)
* @param array $path (single dim)
* @reutrn mixed $value from $form, in $path
@zeroasterisk
zeroasterisk / REGEX CakePHP Conventions.regex
Created October 27, 2010 17:37
Find and Replace to add spaces after commas and before&after => within PHP
find:
(\"[^,\n\"\'\(]+\"|\'[^,\n\"\'\(]+\'|\$[a-zA-Z0-9\_\-\>]+|[0-9]+|\'\'|\"\"|null|false|true|\)|\]|\/[a-z]*),([a-zA-Z0-9\'\"\$\)\(\[])
replace:
$1, $2
find:
(\"[^,\n\"\'\(]+\"|\'[^,\n\"\'\(]+\'|\$[a-zA-Z0-9\_\-\>]+|[0-9]+|\'\'|\"\"|null|false|true|\)|\]|\/[a-z]*)=>([a-zA-Z0-9\'\"\$\)\(\[])
replace:
@zeroasterisk
zeroasterisk / .gitconfig
Created July 19, 2011 15:47
.gitconfig -- some useful aliases and configurations
[user]
name = alan bount
email = alan@zeroasterisk.com
[color]
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
@zeroasterisk
zeroasterisk / member.php
Created August 1, 2011 16:36
SP member.php
public function isCta($user=null) {
if (isset($user['MemberCta']['is_active'])) {
return (!empty($user['MemberCta']['is_active'])); // fast if easy
}
if (is_numeric($user) && !empty($user)) {
if (isset($this) && is_object($this->Member)) {
$user = $this->find('first', array('contain' => array('MemberCta'), 'conditions' => array('Member.id' => $user)));
} else {
$MemberCta =& ClassRegistry::init('Member')->find('first', array('contain' => array('MemberCta'), 'conditions' => array('Member.id' => $user)));
}
@zeroasterisk
zeroasterisk / gist:1118940
Created August 1, 2011 20:41
app - /etc/nginx/nginx.conf
We couldn’t find that file to show.
@zeroasterisk
zeroasterisk / www.conf
Created August 1, 2011 21:00
/etc/php5/fpm/pool.d/www.conf
; Start a new pool named 'www'.
[www]
listen = /var/run/php5-fpm.socket
listen.owner = www-data
listen.group = www-data
listen.mode = 0666
user = www-data
@zeroasterisk
zeroasterisk / standard_location_config_cakephp
Created August 1, 2011 20:42
app - /etc/nginx/standard_location_config_cakephp
#
# These are standard location configs which should be setup in all CakePHP apps
# basic php functionality
# basic document resolution configuration
# basic security
# basic optimization
#
#PHP Magic
location ~ \.php(.*)$ {