Skip to content

Instantly share code, notes, and snippets.

View cabans's full-sized avatar
:octocat:

Abel Cabans cabans

:octocat:
View GitHub Profile
@cabans
cabans / .htaccess
Last active June 8, 2022 12:47
.htaccess WordPress securize and optimization
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
@cabans
cabans / Add Pinterest Button to all Images in the_content()
Last active March 15, 2022 00:12
Wordpress - Function to wrap all images and adds Pinterest button
// Wraps image with container and add link to share src from all <img> in the content
function gear_pinterest_in_content_images($content) {
$dom = new DOMDocument('UTF-8');
@$dom->loadHTML( utf8_decode($content) ); // Decode to simple ISO to avoid accent errors
$dom->preserveWhiteSpace = false;
$images = $dom->getElementsByTagName('img');
if( count($images) > 0 ) {
foreach ($images as $image) {
@cabans
cabans / consolelog-snippet.xml
Last active February 12, 2021 14:02
Add console log autocompletion snippet to Sublime Text
<snippet>
<!-- put this file in /packages/User/<Folder Name>/console_log.sublime-snippet then restart your Sublime Text -->
<content><![CDATA[console.log($1);$0]]></content>
<tabTrigger>log</tabTrigger>
<scope>text.html,source.js</scope>
<description>console.log()</description>
</snippet>
@cabans
cabans / emojicommits.bash_profile
Last active October 29, 2019 08:27
Own modification of Emoji log for Git commits
#.# Better Git Logs.
### Using EMOJI-LOG (https://github.com/ahmadawais/Emoji-Log).
# Git Commit, Add all and Push — in one step.
function gcap() {
git commit -m "$*"
}
# NEW.
function gnew() {
@cabans
cabans / CSScomb.sublime-settings
Created December 23, 2013 19:08
CSSComb Alphabetical Order
{
"custom_sort_order": true,
"sort_order": [
"-webkit-animation",
"-moz-animation",
"-ms-animation",
"-o-animation",
"animation",
"-webkit-animation-delay",
"-moz-animation-delay",
@cabans
cabans / change-url-in-wordpress-site.sql
Created March 4, 2014 19:12
Wordpress : Change URL in all site (Options, GUID, Post content and meta values)
UPDATE wp_options SET option_value = replace(option_value, 'http://site-to-change.com', 'http://127.0.0.1/site-changed') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = REPLACE (guid, 'http://site-to-change.com', 'http://127.0.0.1/site-changed');
UPDATE wp_posts SET post_content = REPLACE (post_content, 'http://site-to-change.com', 'http://127.0.0.1/site-changed');
UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, 'http://site-to-change.com', 'http://127.0.0.1/site-changed');
@cabans
cabans / send_smtp_with_wpmail.php
Created December 17, 2013 14:30
Wordpress: Add SMTP settings to wp_mail()
add_action('phpmailer_init','send_smtp_email');
function send_smtp_email( $phpmailer )
{
// Define that we are sending with SMTP
$phpmailer->isSMTP();
// The hostname of the mail server
$phpmailer->Host = "your server smtp address";
// Use SMTP authentication (true|false)
// Atom settings
@cabans
cabans / Emmet.sublime-settings
Created April 26, 2017 07:29
Emmet Sublime Settings
{
"preferences": {
"sass.propertyEnd": ";"
}
}
@cabans
cabans / gist:2eb3792b25a57d01634b
Created January 12, 2016 13:49
Netflix Hidden Categories
Netflix category codes:
Action & Adventure: 1365
Action Comedies: 43040
Action Sci-Fi & Fantasy: 1568
Action Thrillers: 43048
Adult Animation: 11881
Adventures: 7442
African Movies: 3761
Alien Sci-Fi: 3327