Skip to content

Instantly share code, notes, and snippets.

View ljanecek's full-sized avatar

Ladislav Janeček ljanecek

View GitHub Profile
@ljanecek
ljanecek / gist:eba7c44b6dc518458951
Last active September 9, 2015 13:16 — forked from anonymous/gist:38a56d1749a9982e6b5a
How to find Wordpress featured images together with respective post directly from DB query (for imports, migrations etc.)
SELECT p.*
FROM wp_postmeta AS pm
INNER JOIN wp_posts AS p ON pm.meta_value=p.ID
INNER JOIN wp_posts AS parent ON p.post_parent = parent.`ID`
WHERE pm.meta_key = '_thumbnail_id'
AND parent.post_status = 'publish'
/* You can add more conditions for posts like post type etc. */
ORDER BY p.post_date DESC
module.exports = {
http: function(cont, options, next) {
if (cont.$root.$get('nanobar.value') > 1) {
return false;
}
cont.$root.$get('nanobar').go(20)
.htaccess
-----
RewriteEngine on
RewriteRule ^([a-z]{2}(-[A-Z]{2})?)/(.*) $3?lang=$1 [L,QSA]
index.php
-----
<?php
ffmpeg -loop 1 -i img.jpg -t 30 output.mp4
@ljanecek
ljanecek / killhttpd.sh
Created February 7, 2017 11:16
Apach Ampps Kill Disable Restart
sudo killall httpd
sudo apachectl -k restart
sudo apachectl -k stop
sudo apachectl stop
var sviti = 0;
function rozsvit() {
var zarovka = document.getElementById('zarovka');
if (sviti == 0) {
zarovka.src = "zarovka_sviti.jpg";
sviti = 1;
} else {
#ctverec{
width: 200px;
height: 200px;
background-color: pink;
position: absolute;
top: 100px;
left: 100px;
border-radius: 100%;
$file = __DIR__ . '/../data/twitter.json';
$tweets = array();
if(!file_exists($file) || (file_exists($file) && time()-filemtime($file) >= 3600)){
try {
$data = self::get_twitter_data();
} catch (Exception $e) {
$data = array();
}
@ljanecek
ljanecek / gist:812b7f5c96c4aa77ffa81a609056d7fa
Created March 21, 2018 18:35
Mandrill, WP, wp_mail, How to Send Mandrill Email via wp_mail
add_action('phpmailer_init', function( PHPMailer $phpmailer ){
$phpmailer->isSMTP();
$phpmailer->Host = 'smtp.mandrillapp.com';
$phpmailer->SMTPAuth = true;
$phpmailer->Port = 587;
$phpmailer->Username = 'USERNAME';
$phpmailer->Password = 'APIKEY';
$phpmailer->SMTPSecure = 'tls';
$phpmailer->addCustomHeader('X-MC-Subaccount', 'SUBACCOUNT');
$phpmailer->setFrom('[email protected]', 'Default Title');
configure: creating cache /Users/ladislavjanecek/.phpbrew/cache/config.cache
./configure: line 3188: /Users/ladislavjanecek/.phpbrew/cache/config.cache: No such file or directory
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking build system type... x86_64-apple-darwin19.4.0
checking host system type... x86_64-apple-darwin19.4.0
checking target system type... x86_64-apple-darwin19.4.0
checking for cc... cc
checking whether the C compiler works... yes