Skip to content

Instantly share code, notes, and snippets.

Jason Gresalfi jgresalfi

Block or report user

Report or block jgresalfi

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
@jgresalfi
jgresalfi / divi-button-min-size
Created Aug 7, 2018
Divi buttons normally scale with text, which can look crappy. Set a minimum width with this CSS - buttons will scale up depending on text content.
View divi-button-min-size
.et_pb_button { min-width: 180px; text-align:center; }
//Or for more targeted styles, apply your own class
.your-css-class .et_pb_button { min-width: 180px; text-align:center; }
@jgresalfi
jgresalfi / yoast_seo_canonical_remove.php
Created Sep 28, 2017 — forked from amboutwe/yoast_seo_canonical_change_woocom_shop.php
Code snippets for the Yoast SEO canonical output
View yoast_seo_canonical_remove.php
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Remove Yoast SEO Canonical From All Pages
* Credit: Yoast Team
* Last Tested: Jun 16 2017 using Yoast SEO 4.9 on WordPress 4.8
*/
add_filter( 'wpseo_canonical', '__return_false' );
@jgresalfi
jgresalfi / .eslintrc
Created Feb 1, 2017 — forked from cletusw/.eslintrc
ESLint Reset - A starter .eslintrc file that resets all rules to off and includes a description of what each rule does. From here, enable the rules that you care about by changing the 0 to a 1 or 2. 1 means warning (will not affect exit code) and 2 means error (will affect exit code).
View .eslintrc
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"defaultParams": false, // enable default function parameters
"forOf": false, // enable for-of loops
"generators": false, // enable generators
"objectLiteralComputedProperties": false, // enable computed object literal property names
@jgresalfi
jgresalfi / .bash_profile
Created Jan 28, 2017
bash_profile with some useful alias', etc
View .bash_profile
#   Set Paths
#   ------------------------------------------------------------
    export PATH="$PATH:/usr/local/bin/"
    export PATH="/usr/local/git/bin:/sw/bin/:/usr/local/bin:/usr/local/:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
#   Set Default Editor (change 'Nano' to the editor of your choice)
#   ------------------------------------------------------------
    export EDITOR=/usr/bin/nano
# Misc shortcuts
@jgresalfi
jgresalfi / shiftCipher.js
Last active Sep 25, 2016
Write a function which takes a ROT13 encoded string as input and returns a decoded string.
View shiftCipher.js
//All letters to uppercase. Don't transform non-alphabetic characters (i.e. spaces, punctuation), but do pass them on.
function rot13(str) {
var codeArr = [], seq, final = "";
for (var i = 0; i < str.length; i++) {
uCode = str.charCodeAt([i]);
if ((uCode > 64 && uCode < 78) || (uCode > 96 && uCode < 110)) {
uCode += 13;
codeArr.push(uCode);
} else if ((uCode > 77 && uCode < 91) || (uCode > 109 && uCode < 123)){
@jgresalfi
jgresalfi / sortAndAdd.js
Last active Sep 23, 2016
Return lowest possible index position of second argument after it is added to the first arg's array and sorted...
View sortAndAdd.js
function getIndexToIns(arr, num) {
let numArr = arguments[0],
addNum = arguments[1];
numArr.push(addNum);
numArr.sort(function(a, b) {
return a - b;
});
return numArr.indexOf(addNum);
}
@jgresalfi
jgresalfi / seekAndDestroy.js
Created Sep 21, 2016
Remove all elements from the initial array that are of the same value as the arguments that follow array.
View seekAndDestroy.js
function destroyer(args) {
var args = [...arguments]
, finalArray = []
, targetArray = args.shift();
finalArray = targetArray.filter(function(el) {
return args.every(function(arg) {
return ( el !== arg);
});
});
@jgresalfi
jgresalfi / falsyBouncer.js
Created Sep 19, 2016
Remove all falsy values from an array.
View falsyBouncer.js
function bouncer(arr) {
var newArr = arr.filter( function(el) {
if (el) {
return el;
}
});
return newArr;
}
bouncer([7, "ate", "", false, 9]);
@jgresalfi
jgresalfi / mutations.js
Created Sep 18, 2016
Verify that all characters in second array element are contained in first element.
View mutations.js
function mutation(arr) {
var str1 = arr.slice(0, 1).join(" ").toLowerCase(),
str2 = arr.slice(1).join(" ").toLowerCase(),
hits = 0;
for (var i = 0; i < str2.length; i++) {
if (str1.indexOf(str2[i]) !== -1) {
hits += 1;
}
}
if (hits === str2.length) {
@jgresalfi
jgresalfi / chunkyMonkey.js
Created Sep 15, 2016
Splitting array into two dimensional array based on size parameter
View chunkyMonkey.js
// Write a function that splits an array (first argument) into groups the length of size (second argument) and returns them as a two-dimensional array.
function chunkArrayInGroups(arr, size) {
var newArr = [];
beginSlice = 0,
endSlice = size;
for (var i = 0; i < (arr.length/size); i++) {
newArr.push(arr.join("").slice(beginSlice, endSlice).split());
beginSlice += size;
You can’t perform that action at this time.