Skip to content

Instantly share code, notes, and snippets.

View dsturm's full-sized avatar

Daniel Sturm dsturm

View GitHub Profile
@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
@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
@lukechilds
lukechilds / get_latest_release.sh
Created August 9, 2016 19:43
Shell - Get latest release from GitHub
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Usage
# $ get_latest_release "creationix/nvm"
# v0.31.4
@glueckpress
glueckpress / wp-rocket-cpt-clean-posts-cache-example.php
Last active April 8, 2022 19:49
[WordPress][WP Rocket]Clear the cache only for certain pages when a new post of a certain custom post type is published, deleted or changed
<?php
/**
* UNTESTED EXAMPLE!
* Please don’t use in production without having tested it before!
* @param integer $post_id Current post ID
* @return integer Current post ID
*/
function example__cpt_clean_posts_cache( $post_id ) {
$post = get_post( $post_id );
@kurtextrem
kurtextrem / index.js
Created July 30, 2016 06:22
Throttle Function
function on_resize(namespace, callback, t) {
$(window).on('resize.' + namespace, function () {
clearTimeout(t);
t = setTimeout(callback, 100);
});
return callback;
}
@joshmoto
joshmoto / _forms.scss
Last active September 21, 2017 12:46
Gravity Forms SASS overides inconjunction with Jay Hoffmann's `add_bootstrap_container_class` php function.
/**
* @description Gravity Forms SASS overides inconjunction with Jay Hoffmann's add_bootstrap_container_class
*
* @author Jay Hoffmann (modified by Josh Cranwell)
*
* @source https://jayhoffmann.com/using-gravity-forms-bootstrap-styles/
*
* @instructions
* - Gravity Form settings: HTML 5 [true], CSS OUTPUT [false].
* - Repsonsive column classes must be added to each field in the admin to control inputs .col-[screen-size]-[column-count]
@aaemnnosttv
aaemnnosttv / mamp-to-valet.md
Last active March 1, 2023 14:40
MAMP to Valet

MAMP to Valet

One-time Dependency Setup/Configuration

Install Composer

wget https://getcomposer.org/download/1.1.0/composer.phar && chmod +x composer.phar && sudo mv /usr/local/bin/composer && composer self-update

#Laravel Valet HTTPS

Prior to Valet 1.1 you could user HAproxy After the introduction of Caddy server in Valet 1.1 you can add a simple file. (Recommend still generating a certificate to use for now).

Assuming we are using .dev domain.

#Valet 1.1+

Build a certificate (see next section)

@jalogisch
jalogisch / Netflix - Unitymedia | Customer Hell!
Last active May 15, 2016 09:45
I have since last Monday(2016-02-22) - first day i notice - problems getting Netflix Content into my home. - Lost in a Customer Hell between Netflix and Unitymedia
2016-02-22
During the Day (2016-01-22) i notice that Netflix is not working on my TV. I tried other Devices but always getting an Error pointing me to http://netflix.com/proxy.
I called netflix (Germany) and over 30 min the agent followed his script what need to be done (reboot the modem, change devices and use mobile data) to show me that netflix does not have a problem and i should call my ISP.
Short after that, i called my ISP. The Agent told me that this morning they got notified by the tech department that unitymedia tech is working with netflix tech on this issue.
If i use another connection - a VPN to my Server, mobile data - connection is possible. Netflix relax and say "look your ISP has an issue"
Detailed Information are written down as note to my Account.
@pavelthq
pavelthq / custom_view.js
Last active February 4, 2025 18:33
Visual Composer: Custom markup element example
(function($) {
window.VcCustomElementView = vc.shortcode_view.extend( {
elementTemplate: false,
$wrapper: false,
changeShortcodeParams: function ( model ) {
var params;
window.VcCustomElementView.__super__.changeShortcodeParams.call( this, model );
params = _.extend( {}, model.get( 'params' ) );
if ( ! this.elementTemplate ) {