Skip to content

Instantly share code, notes, and snippets.

View Twanneman's full-sized avatar

Twanneman Twanneman

View GitHub Profile
(function(window, document, undefined) {
"use strict";
var _Scrolleo = function(opts) {
// Defaults
this.acceleration = 0.08; //1 is fastest, 0 is slowest, 0.08 is default
this.secondsPerScreen = null; //Set this to the length of the video. "1" is 1 second.
this.additionalOffset = 0; //Add or subtract pixels to when the video will start. "10" means that the video will start 10px earlier.
this.wrapperEl = null;
@akella
akella / setup.md
Last active April 13, 2025 08:06
My Setup
@mattdesl
mattdesl / about.md
Last active September 29, 2023 20:08
interactive audio sketch
@mikowl
mikowl / oneliners.js
Last active February 19, 2025 05:20
👑 Awesome one-liners you might find useful while coding.
// Inspired by https://twitter.com/coderitual/status/1112297299307384833 and https://tapajyoti-bose.medium.com/7-killer-one-liners-in-javascript-33db6798f5bf
// Remove any duplicates from an array of primitives.
const unique = [...new Set(arr)]
// Sleep in async functions. Use: await sleep(2000).
const sleep = (ms) => (new Promise(resolve => setTimeout(resolve, ms)));
// or
const sleep = util.promisify(setTimeout);
<?php
/**
* Gravity Perks // Nested Forms // Delay Child Notifications for Parent Payment
* http://gravitywiz.com/documentation/gravity-forms-nested-forms/
*/
add_filter( 'gpnf_should_send_notification', function( $should_send_notification, $notification, $context, $parent_form, $nested_form_field, $entry, $child_form ) {
if( $context == 'parent' ) {
$parent_entry = GFAPI::get_entry( rgar( $entry, 'gpnf_entry_parent' ) );
$should_send_notification = in_array( rgar( $parent_entry, 'payment_status' ), array( 'Paid', 'Active' ) );
<?php
/**
* Renders the admin page.
*/
function admin_page() {
$screen = get_current_screen();
$parent = get_admin_page_parent();
$user_meta = get_usermeta( get_current_user_id(), 'wordpress_screen_options_demo_options' );
?>
<div class="wrap <?php echo esc_attr( $parent ); ?>">
// Gravity Forms Dynamic Redirect
add_filter( 'gform_confirmation', 'dlm_gf_dynamic_redirect', 10, 4 );
function dlm_gf_dynamic_redirect( $confirmation, $form, $entry, $ajax ) {
// DLM GF Handler
$dlm_gf_handler = new DLM_GF_Gravity_Forms_Handler();
// fetch download ID dynamically from form
$lead_id = $dlm_gf_handler->get_lead_index_of_dlm_field( $form );
@deckerweb
deckerweb / btc-tweak-integration-args.php
Last active September 25, 2018 09:47
Plugin: Builder Template Categories - Code Snippet for tweaking arguments of one or more integrations: #deckerweb #wordpress #plugin #customization
<?php
/** Do NOT include the opening php tag */
add_filter( 'btc/filter/integrations/all', 'btc_tweak_integration_args', 20, 1 );
/**
* Plugin: Builder Template Categories - Tweak arguments of integrations, for
* example labels.
*
* Note: The priority of the filter needs to be higher than 10, otherwise it
@KreigD
KreigD / flickity-carousel.php
Created June 14, 2018 22:28
Flickity WordPress Carousel
@andrasguseo
andrasguseo / add-woo-data-to-attendee-export.php
Last active November 7, 2022 18:46
Event Tickets Plus: add WooCommerce order data to the attendee list export
<?
/**
* Tribe, adding user meta to the attendees csv export
* Source: https://theeventscalendar.com/support/forums/topic/adding-woocommerce-order-notes-to-attendees-export/
*
* Last updates: August 9, 2018
**/
function tribe_export_custom_set_up( $event_id ) {
//Add Handler for Community Tickets to Prevent Notices in Exports