Skip to content

Instantly share code, notes, and snippets.

View josanua's full-sized avatar
🎯
Focusing

Andrew josanua

🎯
Focusing
View GitHub Profile
@josanua
josanua / is_dir.php
Created September 22, 2020 12:25 — forked from Dare-NZ/is_dir.php
Connect via FTP and check if directory exists
<?php
// FTP login details
$ftp_server = 'yourserver.com';
$ftp_server_path = '/public_html/';
$ftp_user_name = 'username';
$ftp_user_pass = 'password';
// Connect to the FTP
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
@josanua
josanua / gist:d1544752467c6f438fc041a630938278
Last active February 16, 2024 08:32 — forked from itsmattsoria/gistfil1.textile
Mac Terminal Cheat Sheet

SHORTCUTS

Key/Command Description
Tab Auto-complete files and folder names
Ctrl + A Go to the beginning of the line you are currently typing on
Ctrl + E Go to the end of the line you are currently typing on
Ctrl + U Clear the line before the cursor
Ctrl + K Clear the line after the cursor
Ctrl + W Delete the word before the cursor
Ctrl + T Swap the last two characters before the cursor
@josanua
josanua / send_smtp_with_wpmail.php
Last active January 30, 2021 03:05 — forked from cabans/send_smtp_with_wpmail.php
Wordpress: Add SMTP settings to wp_mail()
// Action for change default system settings, it work's!
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
@rveitch
rveitch / sass-7-1-pattern.scss
Last active June 24, 2024 12:21
Sass 7-1 Pattern
sass/
|
|– base/
| |– _reset.scss # Reset/normalize
| |– _typography.scss # Typography rules
| ... # Etc…
|
|– components/
| |– _buttons.scss # Buttons
| |– _carousel.scss # Carousel
@gokulkrishh
gokulkrishh / media-query.css
Last active June 28, 2024 09:07
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
/* CSS */
@mgibbs189
mgibbs189 / test.php
Last active March 11, 2022 18:07
FacetWP - change proximity placeholder text
<?php
function change_proximity_label( $translated_text ) {
if ( 'Enter location' == $translated_text ) {
return 'My new placeholder text';
}
return $translated_text;
}
add_filter( 'gettext', 'change_proximity_label' );
@vishalbasnet23
vishalbasnet23 / functions.php
Created October 31, 2014 08:57
User Registration Front End WordPress with Ajax
<?php
add_action('wp_ajax_register_user_front_end', 'register_user_front_end', 0);
add_action('wp_ajax_nopriv_register_user_front_end', 'register_user_front_end');
function register_user_front_end() {
$new_user_name = stripcslashes($_POST['new_user_name']);
$new_user_email = stripcslashes($_POST['new_user_email']);
$new_user_password = $_POST['new_user_password'];
$user_nice_name = strtolower($_POST['new_user_email']);
$user_data = array(
'user_login' => $new_user_name,
@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)
@steveosoule
steveosoule / php-ftp-file-upload-function.php
Last active October 14, 2020 06:31
PHP FTP File Upload Function
<?
$ftp_server = "ftp.domainname.com";
$ftp_user_name = "ftp_username";
$ftp_user_pass = "ftp_password";
$ftp_directory = 'path/to/folder/'; // leave blank
$ftp_source_file_name = "data.xml";
$ftp_dest_file_name = $ftp_source_file_name;
if( ftp_file( $ftp_server, $ftp_user_name, $ftp_user_pass, $ftp_source_file_name, $ftp_directory, $ftp_dest_file_name) ){
echo "Success: FTP'd data\n";
@franz-josef-kaiser
franz-josef-kaiser / wpmail_exceptions.php
Last active May 28, 2024 07:30
WP Mail Error/Exception handling and SMTP settings
<?php
defined( 'ABSPATH' ) OR exit;
/**
* Plugin Name: (WCM) PHPMailer Exceptions & SMTP
* Description: WordPress by default returns <code>FALSE</code> instead of an <code>Exception</code>. This plugin fixes that.
*/
add_action( 'phpmailer_init', 'WCMphpmailerException' );
function WCMphpmailerException( $phpmailer )
{