Skip to content

Instantly share code, notes, and snippets.

Jonas Goslow jgoslow

Block or report user

Report or block jgoslow

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View WP Excerpt Funcs
/**
* Filter the "read more" excerpt string link to the post.
*
* @param string $more "Read more" excerpt string.
* @return string (Maybe) modified "read more" excerpt string.
*/
function wpdocs_excerpt_more( $more ) {
return sprintf( '<a class="read-more" href="%1$s">%2$s</a>',
get_permalink( get_the_ID() ),
__( 'Read More', 'textdomain' )
View Lyra Modal Mixin
//Modal styles - mostly based on Bootstrap
@mixin modal() {
position: fixed;
pointer-events: none;
opacity: 0;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1050;
@jgoslow
jgoslow / Limit String Length - end of word
Last active Sep 29, 2018
Limits the length of a string but ensures you end on a word
View Limit String Length - end of word
// javascript word cut
function cut(n) {
return function textCutter(i, text) {
var short = text.substr(0, n);
if (/^\S/.test(text.substr(n)))
return short.replace(/\s+\S*$/, "");
return short;
};
}
View Cookie Functions
View get_url_query_params.js
function getQueryParams(qs) {
qs = qs.split('+').join(' ');
var params = {},
tokens,
re = /[?&]?([^=]+)=([^&]*)/g;
while (tokens = re.exec(qs)) {
params[decodeURIComponent(tokens[1])] = decodeURIComponent(tokens[2]);
}
View ga_scroll_tracking.js
/* Scroll Tracking */
!function(a,b,c){"use strict";function d(){return a.querySelector&&a.body.getBoundingClientRect?(c.dataLayerName=c.dataLayerName||"dataLayer",c.distances=c.distances||{},h(),void o(b,"scroll",n(h,500))):!1}function e(a,b){var d={},e=[],h=[];if(c.distances.percentages&&(c.distances.percentages.each&&(e=e.concat(c.distances.percentages.each)),c.distances.percentages.every)){var i=g(c.distances.percentages.every,100);e=e.concat(i)}if(c.distances.pixels&&(c.distances.pixels.each&&(h=h.concat(c.distances.pixels.each)),c.distances.pixels.every)){var j=g(c.distances.pixels.every,a);h=h.concat(j)}return d=f(d,e,"%",a,b),d=f(d,h,"px",a,b)}function f(a,b,c,d,e){var f;for(f=0;f<b.length;f++){var g=parseInt(b[f],10),h="%"!==c?g+e:d*(g/100)+e,i=g+c;d+e>=h&&(a[i]=h)}return a}function g(a,b){var c,d=parseInt(a,10),e=b/d,f=[];for(c=1;e+1>c;c++)f.push(c*d);return f}function h(){var a,b=j(c.bottom),d=j(c.top),f=m(b,d),g=e(f,d||0),h=k();for(a in g)h>g[a]&&!p[a]&&(p[a]=!0,i(a))}function i(a){var d=b.GoogleA
@jgoslow
jgoslow / permissions_ssh.bash
Last active Jun 9, 2016
Here are some things you can do with Gists in GistBox.
View permissions_ssh.bash
Default:
find * -type d -exec chmod 755 {} \;
find * -type f -exec chmod 644 {} \;
For Groups:
find * -type d -exec chmod 775 {} \;
find * -type f -exec chmod 664 {} \;
You can’t perform that action at this time.