Skip to content

Instantly share code, notes, and snippets.

View JVMartin's full-sized avatar

Jacob Martin JVMartin

  • Vancouver, WA
  • 14:17 (UTC -08:00)
View GitHub Profile
@JVMartin
JVMartin / Foo.php
Last active August 29, 2015 14:05
How to call a parent's constructor if it exists, or gracefully continue if not.
<?php
class Foo extends Mystery {
public function __construct()
{
$reflection = new ReflectionClass(__CLASS__);
if (method_exists($reflection->getParentClass()->name, '__construct')) {
parent::__construct();
}
@JVMartin
JVMartin / _bootstrap.scss
Created September 3, 2014 02:36
Media query mixins for BootStrap.
@mixin when($size) {
@if $size == 'xl' {
@media only screen and (min-width: 1200px) {
@content;
}
} @else if $size == 'l' {
@media only screen and (min-width: 992px) and (max-width: 1199px) {
@content;
}
} @else if $size == 'm' {
@JVMartin
JVMartin / foundation-6.blade.php
Created August 29, 2016 02:32
Laravel 5.3 Pagination View for Foundation for Sites 6
<ul class="pagination" aria-label="Pagination">
<!-- Previous Page Link -->
@if ($paginator->onFirstPage())
<li class="pagination-previous disabled"></li>
@else
<li class="pagination-previous">
<a href="{{ $paginator->previousPageUrl() }}" rel="prev"></a>
</li>
@endif
@JVMartin
JVMartin / User.js
Last active September 12, 2016 01:06
Private data from public methods in stampit
import stampit from 'stampit';
let numUsers = 0;
let map = new WeakMap();
function setData(object, key, value) {
let data = map.get(object);
data[key] = value;
}