Skip to content

Instantly share code, notes, and snippets.

View vralle's full-sized avatar

Vitaliy Ralle vralle

View GitHub Profile
@vralle
vralle / config.rb
Last active August 29, 2015 14:05
Run Compass with Autoprefixer and make minifed version CSS with CSSO
require "compass"
# Require any additional compass plugins here.
require "autoprefixer-rails"
require "csso"
# Set this to the root of your project when deployed:
http_path = "../"
css_dir = "css"
sass_dir = "_sass"
images_dir = "images"
@vralle
vralle / README.md
Last active July 30, 2022 10:39
jQuery offcanvas.js (based on Bootstrap Modal.js)

#offcanvas.js

##Usage

The offcanvas plugin toggles your hidden content on demand, via data attributes or JavaScript. It also adds .offcanvas-open to the <body> to override default scrolling behavior and generates a .offcanvas-backdrop to provide a click area for dismissing shown offcanvas when clicking outside the offcanvas.

<!-- Button trigger offcanvas -->
<button class="btn btn-primary" data-toggle="offcanvas" data-target="#myOffcanvas" data-fade="false">
 Launch offcanvas
@vralle
vralle / CSS3-Spinner.markdown
Created October 8, 2014 16:29
A Pen by Vitaliy Ralle.
@vralle
vralle / gist:f4c3872a5996969b4f5e
Last active August 29, 2015 14:12
Remove Akismet js
<?php
// Remove Akismet js
function vralle_remove_akismet_script () {
remove_action( 'comment_form', array( 'Akismet', 'load_form_js' ) );
}
if ( ! is_admin() && ( defined( 'AKISMET_VERSION' ) || function_exists( 'akismet_http_post' ) ) ) {
add_action( 'wp_enqueue_scripts', 'vralle_remove_akismet_script' );
}
@vralle
vralle / Bootstrap Modal and popover with Velocity.js animation.markdown
Created July 15, 2015 16:36
Bootstrap Modal and popover with Velocity.js animation
@vralle
vralle / image-shortcake-admin.js
Last active September 22, 2022 19:59
Image-Shortcake: Fix 'media_send_to_editor' for WP Insert Media
function myTest() {
// Save default function
var defaultSend = wp.media.editor.send.attachment;
// new send function
wp.media.editor.send.attachment = function( props, attachment) {
// If not image, return default function
if ( 'image' !== attachment.type )
return defaultSend( props, attachment)
@vralle
vralle / converter.php
Last active December 12, 2015 21:49
Convert images to Shortcode
<?php namespace Vralle\Plugin\Shortcode\Img;
/*-------------------------------------------------------------------
* Convert images to Shortcode
*-----------------------------------------------------------------*/
function html_to_shortcode( $content ) {
// Returns, if content is empty
if( empty( $content ) ) return $content;
if( 'content_save_pre' === current_filter() )
@vralle
vralle / img-shortcode.php
Last active December 12, 2015 00:56
Image Shortcode: Return images with WP markup
<?php namespace Vralle\Plugin\Shortcode\Img;
/*-------------------------------------------------------------------
* Register UI
*-----------------------------------------------------------------*/
function editor_ui() {
global $_wp_additional_image_sizes;
$default_sizes = [
@vralle
vralle / admin.js
Last active November 23, 2015 17:01
Insert embed image as Shortcode by WP Media
// ### Convert an HTML-representation of an object to a string.
function myHTML() {
// Save default function
var defaultHTML = wp.html.string;
// image intercept
wp.html.string = function( options ) {
// If image, send new function
if( 'img' === options.tag ) {
return shortcake.html( options );
}
@vralle
vralle / admin.js
Last active September 22, 2022 19:57
Adding a Media Button to the WordPress Editor.
jQuery(function($) {
$(document).ready(function(){
$('#insert-my-media').click(open_media_window);
});
function open_media_window() {
if (this.window === undefined) {
this.window = wp.media({
title: 'Insert a media',
library: {type: 'image'},