Skip to content

Instantly share code, notes, and snippets.

@jgresalfi
jgresalfi / shiftCipher.js
Last active November 24, 2022 06:40
Write a function which takes a ROT13 encoded string as input and returns a decoded string.
//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 / .bash_profile
Created January 28, 2017 21:16
bash_profile with some useful alias', etc
#   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 / .eslintrc
Created February 1, 2017 03:47 — 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).
{
// 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 / yoast_seo_canonical_remove.php
Created September 28, 2017 21:22 — forked from amboutwe/yoast_seo_canonical_change_woocom_shop.php
Code snippets for the Yoast SEO canonical output
<?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 / divi-button-min-size
Created August 7, 2018 04:49
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.
.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; }