Skip to content

Instantly share code, notes, and snippets.

View vanderb's full-sized avatar

Freerk van Zeijl vanderb

  • fpvz
  • Mannheim, Germany
View GitHub Profile
@vanderb
vanderb / CollectionMacro.php
Created July 2, 2021 09:50
Laravel Collection Pagination
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Collection;
use Illuminate\Pagination\Paginator;
use Illuminate\Pagination\LengthAwarePaginator;
class CollectionServiceProvider extends ServiceProvider
@vanderb
vanderb / spacer-classes.blade.php
Last active April 24, 2020 14:52
MJML Spacer-Classes with PHP & Laravel-Blade
@foreach([5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 75, 100] as $space)
@foreach(["top", "bottom", "left", "right"] as $side)
<mj-class name="p{{ substr($side, 0, 1) }}-{{ $space }}" padding-{{ $side }}="{{ $space }}px"/>
@endforeach
@endforeach
@vanderb
vanderb / _flex-order.sass
Created August 26, 2019 14:41
Bulm - Flex-Column-Order in SASS
@for $n from 1 through 12
.is-order-#{$n}
order: #{$n} !important
+mobile
.is-order-#{$n}-mobile
order: #{$n} !important
+tablet
@vanderb
vanderb / _flex-order.scss
Last active August 26, 2019 15:06
Bulma - Flex-Column-Order for SCSS
/*
<div class="columns is-flex is-multiline">
<div class="column is-full is-half-desktop is-order-2 is-order-1-desktop">Mobile 2 | Desktop 1</div>
<div class="column is-full is-half-desktop is-order-1 is-order-2-desktop">Mobile 1 | Desktop 2</div>
</div>
*/
@for $n from 1 through 12 {
.is-order-#{$n} {
order: #{$n} !important;
@vanderb
vanderb / .bash_profile
Last active June 21, 2024 13:41
Copy ssh public-key to clipboard on MacOS
alias sshkey="pbcopy < ~/.ssh/id_rsa.pub"
@vanderb
vanderb / inky.js
Created February 11, 2019 16:58
Node Inky
var inky = require('./i.js');
var argv = process.argv.slice(2);
var cheerio = require('cheerio');
var path = require('path');
var through = require('through2');
var vfs = require('vinyl-fs');
var Inky = require('inky/lib/inky');
@vanderb
vanderb / _spacer.scss
Last active April 9, 2019 13:14
Responsive Spacer-Mixin for foundation 6
$spaceamounts: (0, 5, 10, 15, 20, 30, 40, 50); // Adjust this to include the pixel amounts you need.
$sides: (top, bottom);
$space-attr: ("margin", "padding"); // margin or padding
@each $breakpoint in $breakpoint-classes {
@if $breakpoint == 'small' {
@each $space in $spaceamounts {
@each $side in $sides {
@vanderb
vanderb / LocalizeViewPath.php
Last active February 29, 2020 16:59
Laravel | language-based view-path Middleware
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Support\Facades\View;
class LocalizeViewPath {
/**
@vanderb
vanderb / add_menu_page.php
Last active August 29, 2015 14:06
Wordpress: Passing parameters through add_menu_page()
<?php
// Our parameters-array, where all params stored (for all custom pages)
$params = array();
add_action('admin_menu', 'my_admin_menu');
function my_admin_menu()
{
global $params;
$hook = add_menu_page('My Page', 'My Page', 'administrator', 'my-page', 'get_my_template');