Skip to content

Instantly share code, notes, and snippets.

@karrikas
karrikas / *.sublime-project
Created January 12, 2017 09:58
Sublime text disable phpcs in a project
{
"folders":
[
{
"path": "project/path/here"
}
],
"settings": {
"phpcs": {
"phpcs_execute_on_save": false,
@karrikas
karrikas / functions.php
Created January 11, 2017 14:37
Phpmailer wordpress, disable SSL certificate check [allow_self_signed]
<?php
add_action( 'phpmailer_init', 'phpmailer_disable_self_signed' );
function phpmailer_disable_self_signed( PHPMailer $phpmailer ) {
$phpmailer->SMTPOptions = ['ssl'=> ['allow_self_signed' => true]];
}
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
@karrikas
karrikas / funtions.cfc
Created October 4, 2016 08:26
Know Ascii code of each character over a string in coldfusion
<cfargument name="testua" default="0">
<cfloop index="intChar" from="1" to="#Len( testua )#" step="1">
<cfset strChar = Mid( testua, intChar, 1 ) />
<cfdump var="[#intChar#:#asc(strChar)#:#strChar#]">
</cfloop>
<cfabort>
@karrikas
karrikas / functions.php
Last active June 15, 2016 13:26
WPML Custom language menu
<?php
function wpml_languages_list() {
$languages = icl_get_languages('skip_missing=0');
if(!empty($languages)){
echo '<div id="icl_lagunage_menu"><ul>';
foreach($languages as $l){
echo '<li>';
if($l['active']) {
$class = ' class="active"';
}
@karrikas
karrikas / functions.php
Created May 4, 2016 11:07
Bootstrap pagination for Wordpress
function wp_bootstrap_pagination()
{
if( is_singular() ) {
return;
}
global $wp_query;
if( $wp_query->max_num_pages <= 1 ) {
@karrikas
karrikas / robots.txt
Last active April 15, 2016 12:40
robots.txt file for wordpress
# http://jvalenzuela.es/robots-txt-para-wordpress/
User-agent: *
Disallow: /wp-login
Disallow: /wp-admin
Disallow: //wp-includes/
Disallow: /*/feed/
Disallow: /*/trackback/
Disallow: /*/attachment/
Disallow: /author/
Disallow: /*/page/
@karrikas
karrikas / .vimrc
Last active May 13, 2016 06:30
Syntastic optoins - vim
# https://github.com/scrooloose/syntastic
let g:syntastic_always_populate_loc_list = 0
let g:syntastic_auto_loc_list = 0
let g:syntastic_check_on_open = 0
let g:syntastic_check_on_wq = 0
let g:loaded_syntastic_php_phpcs_checker = 0
let g:loaded_syntastic_php_phplint_checker = 0
let g:loaded_syntastic_php_phpmd_checker = 0
@karrikas
karrikas / functions-woocommerce-theme.php
Created January 11, 2016 14:01
Woocommerce integracion in a theme
<?php
// remove plugin default integration
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);
// disable breadcrumbs (optional)
remove_action( 'woocommerce_before_main_content','woocommerce_breadcrumb', 20, 0);
// add defatul shop layaout
add_action('woocommerce_before_main_content', 'my_theme_wrapper_start', 10);
@karrikas
karrikas / dropt-tables-with-foreign-keys.sql
Created November 22, 2015 07:53
Drop tables with foreign keys in mysql
SET FOREIGN_KEY_CHECKS = 0;
drop table if exists customers;
drop table if exists orders;
drop table if exists order_details;
SET FOREIGN_KEY_CHECKS = 1;