Skip to content

Instantly share code, notes, and snippets.

View danrichards's full-sized avatar
🎯
Focusing

Dan Richards danrichards

🎯
Focusing
View GitHub Profile
@danrichards
danrichards / $.addPasswordStrengthMeter.js
Last active July 19, 2016 19:43
Add a password strength meter to your sign up forms.
(function ( $ ) {
$.fn.addPasswordStrengthMeter = function(meter_el) {
var that = this;
if (typeof meter_el == 'undefined') {
meter_el = $('.password-strength-meter');
}
var bars = meter_el.children();
{{-- This area is for mounting global JS objects. --}}
<script>
"use strict";
/**
* Please keep App and its dependencies lean. It's loaded everywhere.
*
* @constructor
@danrichards
danrichards / handlebars.ifCond.js
Created July 27, 2016 13:57
Comparison Helper for Handlebars JS.
// @see http://bdadam.com/blog/comparison-helper-for-handlebars.html
(function() {
function checkCondition(v1, operator, v2) {
switch(operator) {
case '==':
return (v1 == v2);
case '===':
return (v1 === v2);
case '!==':
@danrichards
danrichards / Model.php
Last active August 27, 2016 23:35
$queryProps property for Eloquent Model with example.
<?php
namespace App;
use Illuminate\Database\Eloquent\Model as BaseModel;
/**
* Class Model
*/
abstract class Model extends BaseModel
@danrichards
danrichards / Model.php
Last active June 5, 2020 02:42
Laravel Base Model with some simple caching mechanisms using attribute mutators.
<?php
namespace App;
use App\Utils\Data;
use App\Utils\Str;
use Cache;
use Closure;
use DateTime;
use DB;