Skip to content

Instantly share code, notes, and snippets.

View reinink's full-sized avatar

Jonathan Reinink reinink

View GitHub Profile
@reinink
reinink / svg_replace.js
Created August 2, 2013 15:36
Automatically replace SVG images on non-supporting browsers
// Requires Modernizr
if (!Modernizr.svg || !Modernizr.inlinesvg)
{
$('img').each(function()
{
this.src = this.src.replace('.svg', '.png');
});
}
@reinink
reinink / imagemagick-version.php
Created November 18, 2013 14:36
Check what version of ImageMagick is installed using PHP
<?php
exec("convert -version", $response);
echo '<h1>ImageMagick</h2>';
echo '<ul>';
foreach ($response as $line) {
if (strlen($line)) {
echo '<li>' . $line . '</li>';
<?php
/*
|--------------------------------------------------------------------------
| How to use
|--------------------------------------------------------------------------
|
| From the project's root folder, run:
| php -S localhost:8000 -t public/ server.php
|
@reinink
reinink / boilerplate.sh
Created January 21, 2014 15:36
Create Sculpin boilerplate in one step.
curl -sS https://raw.github.com/php-loep/php-loep.github.com/project-website-theme/boilerplate.php | php
<?php
namespace ChurchSocial\Middleware;
use Closure;
class NullMiddleware
{
public function handle($request, Closure $next)
{
<?php
namespace ChurchSocial\Middleware;
use Closure;
class TrimMiddleware
{
public function handle($request, Closure $next)
{
<?php
// Select all tables from the database
$tables = DB::select("SELECT tablename FROM pg_catalog.pg_tables WHERE schemaname='public'");
// Get array of just the table names
$tables = array_column($tables, 'tablename');
// Loop through and drop each table
// The "cascade" option is important otherwise foreign keys constraints will fail
@reinink
reinink / tailwind-docs.sh
Last active November 3, 2017 14:57
Generating the Tailwind docs
# Clone the Tailwind repo locally
git clone git@github.com:tailwindcss/tailwindcss.git tailwind
# Go to Tailwind folder
cd tailwind
# Install Tailwind JS dependencies
npm install
# Go to docs folder
<?php
Collection::macro('treeMap', function ($child, $parent, $callback) {
$buildTree = function (array $elements, $parentKey = null) use (&$buildTree, $child, $parent, $callback) {
$branch = [];
foreach ($elements as $element) {
if ($element[$parent] === $parentKey) {
$branch[] = $callback($element, $buildTree($elements, $element[$child]));
}
This file has been truncated, but you can view the full file.
/* Base */
/*! normalize.css v7.0.0 | MIT License | github.com/necolas/normalize.css */
/* Document
========================================================================== */
/**
* 1. Correct the line height in all browsers.
* 2. Prevent adjustments of font size after orientation changes in
* IE on Windows Phone and in iOS.
*/
html {