Skip to content

Instantly share code, notes, and snippets.

View tomaskavalek's full-sized avatar
:octocat:
Hardworking anytime 👍

Tomáš Kavalek tomaskavalek

:octocat:
Hardworking anytime 👍
View GitHub Profile
@jakubenglicky
jakubenglicky / .zshrc
Last active January 9, 2022 08:43
Terminál - aliasy
alias dcu='docker-compose up -d'
alias dcd='docker-compose down'
alias dcs='docker-compose stop'
alias dcps='docker-compose ps'
alias dce='docker-compose exec web'
alias rbm='git fetch && git rebase origin/master'
alias rbmi='git fetch && git rebase -i origin/master'
alias dc='docker-compose'
alias dps='docker ps'
alias dcr='docker-compose run'
@EdenK
EdenK / wp-cf7-add-custom-form-tag.php
Created January 22, 2018 21:30
Wordpress: Contact form 7, Add form tag (shortcode) current url example
<?php
/**
* Wordpress: Contact form 7, Add form tag (shortcode) current url example
*/
add_action( 'wpcf7_init', 'wpcf7_add_form_tag_current_url' );
function wpcf7_add_form_tag_current_url() {
// Add shortcode for the form [current_url]
wpcf7_add_form_tag( 'current_url',
'wpcf7_current_url_form_tag_handler',
array(
@lukecav
lukecav / functions.php
Created December 29, 2017 16:38
Get All orders IDs for a given product ID in WooCommerce
/**
* Get All orders IDs for a given product ID.
*
* @param integer $product_id (required)
* @param array $order_status (optional) Default is 'wc-completed'
*
* @return array
*/
function get_orders_ids_by_product_id( $product_id, $order_status = array( 'wc-completed' ) ){
global $wpdb;
@nathanhannig
nathanhannig / js
Created August 22, 2017 21:18
Iteration & Iterable Protocol Quiz
const james = {
name: 'James',
height: `5'10"`,
weight: 185,
[Symbol.iterator]: function() {
const object = this;
const keys = Object.keys(object);
let index = 0;
return {
@fldtrace
fldtrace / functions.php
Last active July 3, 2021 18:26
Better, Faster, Responsive Images for Divi – Upload in Divi child theme.
<?php
// enable divi functions
add_action( 'wp_enqueue_scripts', 'my_enqueue_assets' );
function my_enqueue_assets() {
wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
}
//add 1440px image size
add_image_size('image_1440', 1440, 9999, false);
@pixeline
pixeline / ajax-handler-wp.php
Last active October 5, 2022 13:09
Custom ajax handler for Wordpress. Using admin-ajax.php, as is usually recommended, is very slow and does not allow the use of plugin shortcodes. Using a custom ajax handler like this bypasses that. http://wordpress.stackexchange.com/questions/170808/the-content-shows-shortcode-instead-of-parsing-it
<?php
/*
WORDPRESS SPECIFIC AJAX HANDLER (because admin-ajax.php does not render plugin shortcodes).
by alexandre@pixeline.be
credits: Raz Ohad https://coderwall.com/p/of7y2q/faster-ajax-for-wordpress
*/
//mimic the actual admin-ajax
define('DOING_AJAX', true);
if (!isset( $_REQUEST['action']))
@macbleser
macbleser / wp-permissions-script
Created February 21, 2014 15:37
WordPress Permissions Configuration Script
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro
#
WP_OWNER=changeme # &lt;-- wordpress owner
WP_GROUP=changeme # &lt;-- wordpress group
WP_ROOT=/home/changeme # &lt;-- wordpress root directory
@jirutka
jirutka / rules-both.iptables
Created September 18, 2012 12:42
Basic iptables template for ordinary servers (both IPv4 and IPv6)
###############################################################################
# The MIT License
#
# Copyright 2012-2014 Jakub Jirutka <jakub@jirutka.cz>.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
@justintv
justintv / .bashrc
Created August 17, 2009 00:53
Display git branch in bash prompt
# If you work with git, you've probably had that nagging sensation of not knowing what branch you are on. Worry no longer!
export PS1="\\w:\$(git branch 2>/dev/null | grep '^*' | colrm 1 2)\$ "
# This will change your prompt to display not only your working directory but also your current git branch, if you have one. Pretty nifty!
# ~/code/web:beta_directory$ git checkout master
# Switched to branch "master"
# ~/code/web:master$ git checkout beta_directory
# Switched to branch "beta_directory"