Skip to content

Instantly share code, notes, and snippets.

View vincurekf's full-sized avatar

Filip Vincůrek vincurekf

View GitHub Profile
@vincurekf
vincurekf / stickyuNav.js
Created November 4, 2014 15:56
Sticky nav
/**
* Sticky nav
*/
$(document).ready(function() {
var stickyNavTop = $('.nav').offset().top;
var stickyNav = function(){
var scrollTop = $(window).scrollTop();
if (scrollTop > stickyNavTop) {
@vincurekf
vincurekf / functions.php
Created June 4, 2015 14:28
WP scripts include
/**
* Enqueue scripts and styles.
*/
function faei_scripts() {
wp_enqueue_style( 'faei-style', get_stylesheet_uri() );
wp_enqueue_script( 'faei-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120206', true );
wp_enqueue_script( 'faei-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true );
@vincurekf
vincurekf / handy.js
Last active September 30, 2015 18:20
Select element; apply css from array; set/get cookie
// jQuery alternative
var $el = function(id) {
var element;
if( id[0] === '#'){
return document.getElementById(id.substr(1))
}else if( id[0] === '.'){
return document.getElementsByClassName(id.substr(1));
}else{
return document.getElementsByTagName(id);
}
@vincurekf
vincurekf / App_Http_VideoStream.php
Created January 21, 2017 13:16 — forked from vluzrmos/App_Http_VideoStream.php
Laravel VideoStream.
<?php
namespace App\Http;
/**
* Description of VideoStream
*
* @author Rana
* @link https://gist.github.com/vluzrmos/d5682ad426525196d069
*/
@vincurekf
vincurekf / upload.php
Last active March 10, 2017 14:07
Upload test script
<?php
/**
* Velmi jednoduchý příklad zpracování fotek z aplikace
*/
$uploads_path = "uploads/";
//
$upload = $_POST["upload"];
$op = $_POST["op"];
$user_id = $_POST["user_id"];
$category_id = $_POST["category_id"];
@vincurekf
vincurekf / ImagePicker.java
Created March 15, 2017 11:39 — forked from Mariovc/ ImagePicker.java
Utility for picking an image from Gallery/Camera with Android Intents
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.content.res.AssetFileDescriptor;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.media.ExifInterface;
@vincurekf
vincurekf / letsencrypt-vesta+fix.md
Last active May 30, 2017 21:12
VestaCP SSL Certificate automation Ubuntu 16.04

VestaCP + letsencrypt-vesta + certbot

Install VestaCP

bash vst-install.sh --nginx yes --apache yes --phpfpm no --named yes --remi yes --vsftpd yes --proftpd no --iptables yes --fail2ban yes --quota no --exim yes --dovecot yes --spamassassin yes --clamav yes --mysql yes --postgresql no --hostname DOMAIN.COM --email [email protected] --password NEW_VESTA_PASSWORD

installer

letsencrypt-vesta installation summary + fix

From letsencrypt-vesta

@vincurekf
vincurekf / hdgif.sh
Created February 26, 2018 11:10
This script takes videofile and converts it to high quality GIF, using ffmpeg.
#!/bin/bash
# Usage:
# hdgif -f='/path/to/video.mp4' -w=720 -q=2 -fps=22 -a=1
# -f = input video file
# -w = width of the final gif
# -q = quality, sets the bayer scale, lower number mean higher quality
# -fps = frames per second in the final gif
# -a = convert automatically, uses default options if not set and converts without asking
# -d = destination of where to save the final gif
@vincurekf
vincurekf / wp_append_menu_items.php
Created February 18, 2021 09:03
Add a custom link to the end of a specific menu that uses the wp_nav_menu() function
<?php
/**
* Add a custom link to the end of a specific menu that uses the wp_nav_menu() function
*/
add_filter('wp_nav_menu_items', 'add_admin_link', 10, 2);
function add_admin_link($items, $args){
if( $args->theme_location == 'footer_menu' ){
$items .= '<li><a title="Admin" href="'. esc_url( admin_url() ) .'">' . __( 'Admin' ) . '</a></li>';
}
@vincurekf
vincurekf / woocommerce_js_events.md
Last active March 17, 2021 19:35
Woocommerce Javascript events

Source https://wordpress.stackexchange.com/a/352171/91948

Woocommerce Checkout JS events

$( document.body ).trigger( 'init_checkout' );
$( document.body ).trigger( 'payment_method_selected' );
$( document.body ).trigger( 'update_checkout' );
$( document.body ).trigger( 'updated_checkout' );
$( document.body ).trigger( 'checkout_error' );
$( document.body ).trigger( 'applied_coupon_in_checkout' );