Skip to content

Instantly share code, notes, and snippets.

@JacobBennett
JacobBennett / gist:6252004
Created August 16, 2013 17:52
php all errors
error_reporting(E_ALL);
ini_set('display_errors', '1');
@JacobBennett
JacobBennett / Box-Sizing:Border-box
Created October 2, 2013 04:11
Paul Irish Box Sizing FTW
/* apply a natural box layout model to all elements */
*, *:before, *:after {
-moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;
}
@JacobBennett
JacobBennett / Smooth Scroll
Created October 5, 2013 20:26
Chris Coyier Smooth Scroll
$(function() {
$('a[href*=#]:not([href=#])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
|| location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top
@JacobBennett
JacobBennett / .htaccess Mod_Rewrite
Created October 8, 2013 15:11
.htaccess rewrite block
# ##############################################################################
# # URL REWRITES #
# ##############################################################################
# ------------------------------------------------------------------------------
# | Rewrite engine |
# ------------------------------------------------------------------------------
# Turning on the rewrite engine and enabling the `FollowSymLinks` option is
# necessary for the following directives to work.
@JacobBennett
JacobBennett / rotator.html
Last active December 25, 2015 12:38
The simplest jquery rotator I could come up with
<!-- ROTATOR HTML -->
<div class="rotator-container">
<img src="images/preview/1.jpg" class="active"/>
<img src="images/preview/2.jpg" />
<img src="images/preview/3.jpg" />
</div>
/**
* For modern browsers
* 1. The space content is one way to avoid an Opera bug when the
* contenteditable attribute is included anywhere else in the document.
* Otherwise it causes space to appear at the top and bottom of elements
* that are clearfixed.
* 2. The use of `table` rather than `block` is only necessary if using
* `:before` to contain the top-margins of child elements.
*/
.cf:before,
@JacobBennett
JacobBennett / ajaxscript.js
Last active January 2, 2016 17:59
handling ajax failures
$.ajax({}).
.done(
//200 returned but not well formed JSON string
if(!data.status) {return false;}
//200 with well formed JSON & an error
if(data.status === "fail") {
alert(data.message);
@JacobBennett
JacobBennett / script.js
Last active January 3, 2016 03:39
Limits inputs to only accept numbers (Jquery Required)
$('input.valid-number').bind('keypress', function(e) {
return ( e.which!=8 && e.which!=0 && (e.which<48 || e.which>57)) ? false : true ;
})
Fatal error: Call to undefined method Illuminate\Foundation\Application::registerCoreContainerAliases() in /Applications/MAMP/htdocs/laravel-demo/vendor/laravel/framework/src/Illuminate/Foundation/start.php on line 105
Script php artisan clear-compiled handling the post-update-cmd event returned with an error
[RuntimeException]
Error Output:
@JacobBennett
JacobBennett / gist:8450065
Created January 16, 2014 05:04
Laravel FormMacros
<?php
Form::macro('textField', function($name, $label = null, $value = null, $attributes = array())
{
$element = Form::text($name, $value, fieldAttributes($name, $attributes));
return fieldWrapper($name, $label, $element);
});
Form::macro('passwordField', function($name, $label = null, $attributes = array())