Skip to content

Instantly share code, notes, and snippets.

View celsobessa's full-sized avatar

Celso Bessa celsobessa

View GitHub Profile
@celsobessa
celsobessa / wordpress_export-post-data.php
Created July 16, 2018 04:08 — forked from robinnorth/wordpress_export-post-data.php
WordPress: Simple, configurable script to export post data to a CSV file
<?php
/**
* Export WordPress post data to CSV
* Based on <http://stackoverflow.com/a/3474698> and <http://ran.ge/2009/10/27/howto-create-stream-csv-php/>
*/
/**
*********************************************************************
* Configuration
*********************************************************************
@celsobessa
celsobessa / regexCheatsheet.js
Created January 15, 2019 17:53 — forked from sarthology/regexCheatsheet.js
A regex cheatsheet 👩🏻‍💻 (by Catherine)
let regex;
/* matching a specific string */
regex = /hello/; // looks for the string between the forward slashes (case-sensitive)... matches "hello", "hello123", "123hello123", "123hello"; doesn't match for "hell0", "Hello"
regex = /hello/i; // looks for the string between the forward slashes (case-insensitive)... matches "hello", "HelLo", "123HelLO"
regex = /hello/g; // looks for multiple occurrences of string between the forward slashes...
/* wildcards */
regex = /h.llo/; // the "." matches any one character other than a new line character... matches "hello", "hallo" but not "h\nllo"
regex = /h.*llo/; // the "*" matches any character(s) zero or more times... matches "hello", "heeeeeello", "hllo", "hwarwareallo"
@celsobessa
celsobessa / .gitignore
Last active June 18, 2019 23:02 — forked from salcode/.gitignore
a fork of salcode .gitignore file for a general web project - Bare Minimum Git
# -----------------------------------------------------------------
# .gitignore
# Bare Minimum Git
# http://ironco.de/bare-minimum-git/
# ver 20181206
#
# From the root of your project run
# curl -O https://gist.githubusercontent.com/celsobessa/67e02d08bf89ada501e7ea8531cc0624/raw/a6a4ff4cd71112a566ed893846dd4ab8d14035c0/.gitignore
# to download this file
#
@celsobessa
celsobessa / shrinkpdf.sh
Created July 19, 2019 18:55 — forked from cbessadejusticia/shrinkpdf.sh
shrinkpdf.sh script by Alfred Klomp for optimizing (shrinking) PDF files using Ghostscript
#!/bin/sh
# http://www.alfredklomp.com/programming/shrinkpdf
# Licensed under the 3-clause BSD license:
#
# Copyright (c) 2014, Alfred Klomp
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@celsobessa
celsobessa / multiple_ssh_setting.md
Created November 2, 2019 23:40 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@celsobessa
celsobessa / GoogleHackMasterList.txt
Created January 27, 2020 15:37 — forked from cmartinbaughman/GoogleHackMasterList.txt
The definitive super list for "Google Hacking".
admin account info" filetype:log
!Host=*.* intext:enc_UserPassword=* ext:pcf
"# -FrontPage-" ext:pwd inurl:(service | authors | administrators | users) "# -FrontPage-" inurl:service.pwd
"AutoCreate=TRUE password=*"
"http://*:*@www&#8221; domainname
"index of/" "ws_ftp.ini" "parent directory"
"liveice configuration file" ext:cfg -site:sourceforge.net
"parent directory" +proftpdpasswd
Duclassified" -site:duware.com "DUware All Rights reserved"
duclassmate" -site:duware.com
@celsobessa
celsobessa / 1. Refactoring - Original.js
Last active February 23, 2020 17:34 — forked from Integralist/1. Refactoring - Original.js
The importance of refactoring... (by Mark McDonnell ( https://gist.github.com/Integralist )
var isProxyBased = (/S40[\w]{3,5}Browser|Opera\sMini\//i).test(navigator.userAgent);
if (('querySelector' in document && 'localStorage' in window && 'addEventListener' in window && !isProxyBased) || (isIE > 6 && document.getElementById('js-holepunched'))) {
// do stuff
}
@celsobessa
celsobessa / trap_focus.js
Created June 5, 2021 20:39 — forked from myogeshchavan97/trap_focus.js
Code for trapping focus inside modal
// add all the elements inside modal which you want to make focusable
const focusableElements =
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
const modal = document.querySelector('#exampleModal'); // select the modal by it's id
const firstFocusableElement = modal.querySelectorAll(focusableElements)[0]; // get first element to be focused inside modal
const focusableContent = modal.querySelectorAll(focusableElements);
const lastFocusableElement = focusableContent[focusableContent.length - 1]; // get last element to be focused inside modal
@celsobessa
celsobessa / Links
Created June 5, 2021 20:41 — forked from lukecav/Links
Speed Up Your WordPress Site with These 3 Advanced Techniques Workshop - WordSesh 2021
@celsobessa
celsobessa / bandwidth.js
Last active June 25, 2021 14:58 — forked from debloper/bandwidth.js
Determine client's connection speed with JavaScript
// Let's initialize the primitives
var startTime, endTime, fileSize, result, unit = {kbps:1,kBps:8};
// Set up the AJAX to perform
var xhr = new XMLHttpRequest();
// Rig the call-back... THE important part
xhr.onreadystatechange = function () {
// we only need to know when the request has completed