Skip to content

Instantly share code, notes, and snippets.

View arbitrarily's full-sized avatar

Marko Bajlovic arbitrarily

View GitHub Profile
@ciaranmahoney
ciaranmahoney / mixpanel-page-linktracking-wordpress.php
Last active March 24, 2017 15:12
This gist inserts MixPanel link click and pageview tracking scripts into a WordPress blog. It is intended to be included in footer.php so it can track pageview and clicks for all pages. In order for this to work, you must have a Mixpanel account and have Mixpanel tags setup on your website.
<!-- MixPanel Link click tracking - track clicks for all links -->
<script type="text/javascript">// <![CDATA[
mixpanel.track_links("a", "Link Click", {
"referrer": document.referrer
});
// ]]>
</script>
<!-- MixPanel Pageview tracking -->
<?php if( is_page()) { // Sets page type to Page for all pages ?>
@jbwyme
jbwyme / Mixpanel PHP API Example Index.php
Last active August 4, 2017 12:32
Mixpanel PHP API Usage
<?php
require_once("/path/to/vendor/mixpanel/mixpanel-php/lib/Mixpanel.php"); // import the Mixpanel class
// get the Mixpanel singelton (will be created if it doesn't exist)
$mp = Mixpanel::getInstance("MIXPANEL_PROJECT_TOKEN");
// this would likely come from a database or session variable
$user_id = 12345;
// Disable support for comments and trackbacks in post types
function df_disable_comments_post_types_support() {
$post_types = get_post_types();
foreach ($post_types as $post_type) {
if(post_type_supports($post_type, 'comments')) {
remove_post_type_support($post_type, 'comments');
remove_post_type_support($post_type, 'trackbacks');
}
}
}
@Poordeveloper
Poordeveloper / Water drop loader CSS animation.markdown
Created November 10, 2015 16:12
Water drop loader CSS animation

Water drop loader CSS animation

Every now and then I make something without JS just to make sure I still can :p

Fun fact, I originally made this with just HTML elements and border-radius for the circles. (As I suspected it would) the frame rate sucked. So I swapped in SVG circles and it is much better. The moral of this story is try to avoid using border-radius in your CSS anims if possible.

A Pen by Rachel Smith on CodePen.

License.

@hanleybrand
hanleybrand / requests_image.py
Created December 6, 2012 03:56
Download images with Requests: HTTP for Humans
import requests
from io import open as iopen
from urlparse import urlsplit
def requests_image(file_url):
suffix_list = ['jpg', 'gif', 'png', 'tif', 'svg',]
file_name = urlsplit(file_url)[2].split('/')[-1]
file_suffix = file_name.split('.')[1]
i = requests.get(file_url)
if file_suffix in suffix_list and i.status_code == requests.codes.ok:
## This file should be present in the same directory as the EFISTUB kernel and initramfs files
## More info at http://www.rodsbooks.com/refind/linux.html , http://www.rodsbooks.com/efi-bootloaders/efistub.html
"Boot with defaults" "root=PARTUUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx rootfstype=btrfs rw quiet splash systemd.unit=graphical.target radeon.modeset=1 radeon.audio=1 radeon.dpm=1 acpi_backlight=vendor console=tty0"
"Boot with nosplash" "root=PARTUUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx rootfstype=btrfs rw quiet systemd.unit=graphical.target radeon.modeset=1 radeon.audio=1 radeon.dpm=1 acpi_backlight=vendor console=tty0"
"Boot with message" "root=PARTUUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx rootfstype=btrfs rw systemd.unit=graphical.target radeon.modeset=1 radeon.audio=1 radeon.dpm=1 acpi_backlight=vendor console=tty0"
"Boot to terminal" "root=PARTUUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx rootfstype=btrfs rw systemd.unit=multi-user.target radeon.modeset=1 radeon.audio=1 radeon.dpm=1 ac
@omurphy27
omurphy27 / slick-slider-prev-next.css
Last active July 29, 2020 19:27
Styling Previous and Next buttons in Slick Slider with Font Awesome Icons
/* Must include Font Awesome (here: https://fortawesome.github.io/Font-Awesome/get-started/) for icons to show up */
.slick-prev,
.slick-next {
font-size: 0;
position: absolute;
bottom: 20px;
color: #d5122f;
border: 0;
background: none;
@AJMaxwell
AJMaxwell / nginx-openssl_build.sh
Last active September 12, 2021 20:57
Install Nginx, OpenSSL, and ngx_pagespeed from source on Ubuntu 14.04
#!/bin/bash
##############################################################################################
## Install Nginx with OpenSSL, and ngx_pagespeed
##
## Author: Andrew Maxwell <amaxwell@ajmaxwell.com>
## Date: 2017/09/18
## Version: 0.3
##
## Disclaimer: I am not responsible for how you use this script. Do not assume this script
@nroca
nroca / gist:511ef1d287ba7121f596
Created October 9, 2014 05:39
ACF Options Page (Icon/Position)
// http://support.advancedcustomfields.com/forums/topic/change-menu-position-of-options-page/
acf_add_options_page( array(
'page_title' => 'Home Page Sliders',
'menu_title' => 'Sliders',
'menu_slug' => 'home-page-sliders',
'capability' => 'edit_posts',
'icon_url' => 'dashicons-images-alt2',
'position' => 7
@kevinwhoffman
kevinwhoffman / loop-custom.php
Last active April 8, 2022 11:22
WordPress - Custom Post Type Loop
<?php
$loop = new WP_Query( array(
'post_type' => 'Property',
'posts_per_page' => -1
)
);
?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>