Skip to content

Instantly share code, notes, and snippets.

View csdy's full-sized avatar
💵
Working on the next big thing

David Cassidy csdy

💵
Working on the next big thing
View GitHub Profile
@csdy
csdy / view.ctp
Created March 1, 2013 12:43
Disable HTML5 browser validation in CakePHP
<?php
echo $this->Form->create(
'Model',
array(
'inputDefaults' => array(
'required' => false,
),
),
);
?>
@csdy
csdy / file.html
Last active January 3, 2019 19:50
Javascript vendor libraries via CDN with local fallback
<!-- JQUERY -->
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="/js/vendor/jquery-2.0.3.min.js"><\x3C/script>')</script>
<!-- JQUERY UI -->
<script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<script>window.jQuery.ui || document.write('<script src="/js/vendor/jquery.ui-1.10.3.min.js"><\x3C/script>')</script>
<!-- JQUERY VALIDATE -->
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.11.1/jquery.validate.min.js"></script>
@csdy
csdy / file.html
Last active December 16, 2015 18:20
jQuery validation with HTML5 browser validation fallback
<!-- jQuery -->
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="/js/vendor/jquery-2.0.3.min.js"><\x3C/script>')</script>
<!-- jQuery Validate -->
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.11.1/jquery.validate.min.js"></script>
<script>window.jQuery.validator || document.write('<script src="/js/vendor/jquery.validate-1.11.1.min.js"><\x3C/script>')</script>
<script>
// DOM ready
@csdy
csdy / file.html
Last active December 16, 2015 18:38
Disable LESS.js caching
<!-- CLIENT-SIDE SCRIPTS: BEGIN -->
<script>
var less = {
env: "development"
}
</script>
<script src="//cdnjs.cloudflare.com/ajax/libs/less.js/1.4.1/less.min.js"></script>
<script>window.less || document.write('<script src="/js/vendor/less-1.4.1.min.js"><\x3C/script>')</script>
<!-- CLIENT-SIDE SCRIPTS: CLOSE -->
@csdy
csdy / file.js
Created May 24, 2013 05:23
Check the tabindex of page elements using Inspector/Firebug
$('[tabindex]').each(function() {
console.log($(this).attr('tabindex'));
});
@csdy
csdy / file.js
Last active December 17, 2015 16:49
Fix modal window focus for Twitter Bootstrap
$(".modal").on("shown", function() {
document.activeElement.blur()
$(this).find(".modal-body :input:visible:first").focus();
});
@csdy
csdy / file.js
Created May 24, 2013 07:06
Show currently focused element (useful for debugging tabindex)
alert(document.activeElement.innerHTML);
@csdy
csdy / .bashrc
Last active December 17, 2015 22:49
Bash Profile (Colors + Fortune)
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific aliases and functions
# Colors
@csdy
csdy / watch.sh
Last active January 7, 2022 07:12
Show HTTP connections in cPanel
watch -n 2 "/usr/bin/lynx -dump -width 500 http://127.0.0.1/whm-server-status | tail -n +26 | grep -v 'OPTIONS' | grep -v '::1' | grep -v 'whm-server-status' | grep -v 'cptemplate.hostek.com' | grep -v 'hostname --ip-address' | grep -v 'NULL'"
# Generic
watch -n 2 "/usr/bin/lynx -dump -width 500 http://127.0.0.1/whm-server-status | tail -n +26"
# WordPress/Joomla/vBulletin
watch -n 2 "/usr/bin/lynx -dump -width 500 http://127.0.0.1/whm-server-status | grep -e "wp-login.php" -e "administrator/index.php" -e "*vbulletin""
# Wordpress XMLRPC
watch -n 2 "/usr/bin/lynx -dump -width 500 http://127.0.0.1/whm-server-status | grep -e "xmlrpc.php""
@csdy
csdy / generate.sh
Last active August 29, 2015 14:03
Generate Zero-Filled FIle of SIze
# Generate data file
dd if=/dev/zero of=output.dat bs=1M count=10
# Zip data file (no compression)
zip -0 output.zip output.dat