Skip to content

Instantly share code, notes, and snippets.

//BaseModel.php
protected function dateStringToCarbon($date, $format = 'm/d/Y')
{
if(!$date instanceof Carbon) {
$validDate = false;
try {
$date = Carbon::createFromFormat($format, $date);
$validDate = true;
} catch(Exception $e) { }
var sort_by = function(field, reverse, primer){
var key = primer ?
function(x) {return primer(x[field])} :
function(x) {return x[field]};
reverse = !reverse ? 1 : -1;
return function (a, b) {
return a = key(a), b = key(b), reverse * ((a > b) - (b > a));
@thaenor
thaenor / Bootstrap.html
Created October 27, 2015 11:19
Creating stacked tabs using Bootstrap (from http://www.bootply.com/74926)
<div class="container">
<div class="row">
<div class="col-md-6">
<h3>Tabs</h3>
<!-- tabs -->
<div class="tabbable">
<ul class="nav nav-tabs">
<li class="active"><a href="#one" data-toggle="tab">One</a></li>
<li><a href="#two" data-toggle="tab">Two</a></li>
<li><a href="#twee" data-toggle="tab">Twee</a></li>
@thaenor
thaenor / SassMeister-input.scss
Last active December 22, 2016 12:01
My first grid system
// ----
// Sass (v4.0.0.alpha.1)
// Compass (vundefined)
// ----
$settings: (
maxWidth: 800px,
columns: 12,
margin: 15px,
breakpoints: (
@thaenor
thaenor / gulp_sass_livereload.md
Created December 22, 2016 12:42 — forked from kellishouts/gulp_sass_livereload.md
Gulp + Sass + LiveReload 1.0

Gulp + Sass + LiveReload

This Gist goes over setting up a gulp workflow that will:

  1. watch for any sass changes, then compiles sass source into css
  2. watch for any changes in the public directory, and trigger live-reload
  3. serve static content in public/

<body>
<header>
<h1>My super duper page</h1>
<!-- Header content -->
</header>
<div role="main">
<!-- Page content -->
</div>
<aside role="complementary">
<!-- Secondary content -->
@thaenor
thaenor / index.html
Created January 18, 2017 23:54 — forked from anonymous/index.html
JS Bin // source https://jsbin.com/toqaka
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script src="https://code.jquery.com/jquery-3.1.0.js"></script>
<div id="root"></div>
@thaenor
thaenor / react.js
Last active February 22, 2017 16:21
React Notes - because I'm tired of making pens
//If a child component wants to communicate back to its parent, it can do so through props,
//most commonly by its parent providing a callback property that the child can call when some event happens:
const ParentComponent = () => {
const letMeKnowAboutSomeThing = () => console.log('something happened!')
return (
<ChildComponent letMeKnowAboutSomeThing={letMeKnowAboutSomeThing} />
)
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<input id="filep" type="file" onchange="foo()">
<div id="result"></div>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">