Skip to content

Instantly share code, notes, and snippets.

$('.flickity-slider').flickity({
draggable: Modernizr.touchevents
});
<?php
// add hook
add_filter( 'wp_nav_menu_objects', 'my_wp_nav_menu_objects_sub_menu', 10, 2 );
// filter_hook function to react on sub_menu flag
function my_wp_nav_menu_objects_sub_menu( $sorted_menu_items, $args ) {
if ( isset( $args->sub_menu ) ) {
$current_id = 0;
$root_id = 0;
@levymetal
levymetal / app.component-partial.ts
Last active November 1, 2022 02:47
How to show the keyboard accessory bar in Ionic 2.0.0-rc.1. Full blog post here: http://christianvarga.com/how-to-show-the-ios-keyboard-accessory-bar-in-ionic-2-0-0-rc-1/
import { StatusBar, Splashscreen, Keyboard } from 'ionic-native';
@levymetal
levymetal / api-service.ts
Last active November 1, 2022 02:48
Example of using observable from within a Service on Ionic 2. Full blog post here: http://christianvarga.com/how-to-create-and-monitor-observables-in-ionic-2-service/
import { Injectable } from '@angular/core';
import { Http, Headers, RequestOptions } from '@angular/http';
import { Observable } from 'rxjs/Observable';
import 'rxjs/Rx';
@Injectable()
export class ApiService {
private errorObserver: any;
public error: any;
@levymetal
levymetal / functions.php
Created March 29, 2018 00:30
Show a warning on the WordPress admin screen when a user uploads a PNG image to an ACF gallery, content area, or featured image.
<?php
/**
* Add a big fucking warning when the client uploads a PNG when they should
* be using a JPG
*/
function varga_62341_admin_png_warning() {
global $post_type;
echo '<script>var varga_62341_post_type="'.$post_type.'";</script>';
?>
@levymetal
levymetal / scss-syntax-test.scss
Created May 4, 2018 07:35
scss-syntax-test.scss
div,
%test,
.test,
#test-#{$test},
.test:not(.test),
.test:not(div),
.test[test] {}
&-test,
&.test {
@extend %test, .test;
<?php
// add hook
add_filter( 'wp_nav_menu_objects', 'my_wp_nav_menu_objects_sub_menu', 10, 2 );
// filter_hook function to react on sub_menu flag
function my_wp_nav_menu_objects_sub_menu( $sorted_menu_items, $args ) {
if ( isset( $args->sub_menu ) ) {
$root_id = 0;