Skip to content

Instantly share code, notes, and snippets.

View victorfdes's full-sized avatar
🏡
Working remotely

Victor Fernandes victorfdes

🏡
Working remotely
View GitHub Profile
@victorfdes
victorfdes / flatten.js
Created March 28, 2020 14:58
Array Flatten
function flattenArray (arr) {
return arr.reduce(function (a, b) {
return Array.isArray(b) ? a.concat(flattenArray(b)) : a.concat(b)
}, [])
}
# Update self-hosted embeds (images, iframes, scripts, etc.)
UPDATE wp_posts SET post_content = REPLACE(post_content, 'http://yoursite.com', 'https://yoursite.com');
UPDATE wp_posts SET post_content = REPLACE(post_content, 'http://www.yoursite.com', 'https://www.yoursite.com');
# Update internal pingbacks
UPDATE wp_comments SET comment_author_url = REPLACE(comment_author_url, 'http://yoursite.com', 'https://yoursite.com');
UPDATE wp_comments SET comment_author_url = REPLACE(comment_author_url, 'http://www.yoursite.com', 'https://www.yoursite.com');
# Update YouTube embeds
UPDATE wp_posts SET post_content = REPLACE(post_content, 'http://www.youtube.com', 'https://www.youtube.com');
@victorfdes
victorfdes / ack.cpp
Last active October 7, 2017 20:49
Ackermann's function (recursive)
#include <bits/stdc++.h>
using namespace std;
int ack(int m, int n){
int ans;
if( m == 0 ) ans = n + 1;
else if( n == 0 ) ans = ack(m - 1, 1);
else ans = ack(m - 1, ack(m, n-1));
return (ans);
}
int main(){