Skip to content

Instantly share code, notes, and snippets.

View dsturm's full-sized avatar

Daniel Sturm dsturm

View GitHub Profile
@afragen
afragen / local-symlink.sh
Last active February 10, 2020 08:42
For use with Local by Flywheel (Pressmatic) Volumes Addon to create symlinks for better IDE integration
@Jakobud
Jakobud / _leastSquaresFit.scss
Last active November 26, 2017 02:05
Least Squares Fit Linear Regression SASS function
/// leastSquaresFit
/// Calculate the least square fit linear regression of provided values
/// @param {map} $map - A SASS map of viewport width and size value combinations
/// @return Linear equation as a calc() function
/// @example
/// font-size: leastSquaresFit((576: 24, 768: 24, 992: 34));
/// @author Jake Wilson <[email protected]>
@function leastSquaresFit($map) {
// Get the number of provided breakpoints
@smutek
smutek / Bootstrap4Nav-Sage9.md
Last active July 30, 2022 06:50
Bootstrap 4 Walker for Sage 9

Credit

This is a frankensteind version of the current Soil nav walker, by the Roots team, and Michael Remoero's Sagextras walker. All credit goes to those good folks. :)

Use

  • Replace the contents of header.blade.php with the attached header.
  • Copy the walker.php file to the /app directory.
  • Add walker.php to the Sage required files array in resources/functions.php - eg. on a stock Sage install the entry would look like:
/**
@tlhunter
tlhunter / average-geolocation.js
Created May 17, 2017 18:00
Calculate the center/average of multiple GeoLocation coordinates
/**
* Calculate the center/average of multiple GeoLocation coordinates
* Expects an array of objects with .latitude and .longitude properties
*
* @url http://stackoverflow.com/a/14231286/538646
*/
function averageGeolocation(coords) {
if (coords.length === 1) {
return coords[0];
}
@goranseric
goranseric / Access-Control-Allow-Origin.php
Created May 23, 2017 17:54 — forked from brunoleles/Access-Control-Allow-Origin.php
Access-Control-Allow-Origin Snipet
<?php
// tells the CDN that the content 'Vary' depending on 'Origin' request header
header('Vary: Origin', true);
// allowed origins
$allowed_http_origins = array(
'http://example.com',
'http://www.example.com',
'http://127.0.0.1',
@mookofe
mookofe / githubController.php
Last active December 7, 2018 07:52
Github Webhooks
<?php
namespace App\Http\Controllers;
use Route;
use Illuminate\Http\Request;
class GitHubController extends Controller
{
@MWDelaney
MWDelaney / advanced-custom-fields.php
Last active February 20, 2019 14:51
Advanced Custom Fields drop-in functionality for Sage 9
<?php
namespace App;
/**
* Advanced Custom Fields drop-in functionality for Sage 9
* Version: 1.0
* Author: Michael W. Delaney
*/
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48">
<title>Switcher</title>
<g class="nc-interact_switcher-c-48">
<rect x="2" y="11" width="44" height="26" rx="13" ry="13" fill="#d1d1d1"/>
<rect class="nc-switcher-background" x="2" y="11" width="44" height="26" rx="13" ry="13" fill="#72C472" opacity="0"/>
<circle cx="15" cy="24" r="11" fill="#fff"/>
</g>
<script>
(function() {
@ianmjones
ianmjones / build-as3cf-aws2.sh
Last active March 21, 2025 19:21
A script for downloading the AWS PHP SDK v2, stripping down to S3 functionality and then applying a custom namespace.
#!/usr/bin/env bash
set -e
if [ ! -d src/amazon-s3-and-cloudfront ]; then
echo 'This script must be run from the repository root.'
exit 1
fi
for PROG in composer find sed
@Shelob9
Shelob9 / links.md
Last active February 13, 2019 14:01
Install WP CLI's scaffold command, create a plugin, add two blocks to the plugin and then activate it.