Skip to content

Instantly share code, notes, and snippets.

@CrandellWS
CrandellWS / debug-CustomMultiDexApplication.java
Created Feb 27, 2020 — forked from akhgupta/debug-CustomMultiDexApplication.java
leakcanary-android-no-op - Class,Method not found solution
View debug-CustomMultiDexApplication.java
// app/src/debug/java/com/akhil/sampleapp/CustomMultiDexApplication.java
package com.akhil.sampleapp;
import android.support.multidex.MultiDexApplication;
import com.squareup.leakcanary.AndroidExcludedRefs;
import com.squareup.leakcanary.LeakCanary;
import com.squareup.leakcanary.RefWatcher;
@CrandellWS
CrandellWS / README.md
Created Jan 10, 2019 — forked from JohannesMP/LICENSE
[Unity3D] A Reliable, user-friendly way to reference SceneAssets by script.
View README.md

What is this?

A SceneReference wrapper class that uses ISerializationCallbackReceiver and a custom PropertyDrawerto provide safe, user-friendly scene references in scripts.

![alt text][1]

Why is this needed?

@CrandellWS
CrandellWS / html2canvas.js
Last active Oct 7, 2020
html2canvas cors & cache workaround
View html2canvas.js
/*!
* html2canvas 1.0.0-alpha.12-rc2 <https://html2canvas.hertzen.com>
* Copyright (c) 2018 Niklas von Hertzen <https://hertzen.com>
* Released under MIT License
* Editted By William Crandell
*/
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
View CustomInAppKeyboard.java
public class CustomInAppKeyboard extends LinearLayoutCompat {
private static final String TAG = "MyKeyboard";
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
if(BuildConfig.DEBUG){
Log.e("CustomInAppKeyboard", "w:" + widthMeasureSpec + " :: " + MeasureSpec.toString(widthMeasureSpec));
@CrandellWS
CrandellWS / CenterCropDrawable.java
Created Sep 27, 2018 — forked from rudchenkos/CenterCropDrawable.java
Maintain aspect ratio of bitmap drawables set as windowBackground on Android
View CenterCropDrawable.java
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.support.annotation.IntRange;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
@CrandellWS
CrandellWS / wp_head_hide_billing_fields_for_registered_users.php
Last active Aug 31, 2018 — forked from strangerstudios/wp_head_hide_billing_fields.php
Hide Paid Memberships Pro billing address fields and make them optional. Meant to be used with the Braintree gateway.
View wp_head_hide_billing_fields_for_registered_users.php
add_action('pmpro_checkout_before_submit_button', 'my_pmp_jquery');
function my_pmp_jquery() {
global $current_user;
get_currentuserinfo();
if ($current_user->user_login) {
//script will hide billing fields and prefill name and email from WP account
?>
<script>
jQuery( document ).ready(function($) {
@CrandellWS
CrandellWS / gist:d5e7fca862f7d035ab67c2c2cc45407e
Created Aug 27, 2018 — forked from olimortimer/gist:3032672
JS: jQuery Replace HREF Query String
View gist:d5e7fca862f7d035ab67c2c2cc45407e
// www.website.com/page?id=100
$('#pageLink').attr('href', $('#pageLink').attr('href').replace(/((\?|&)id\=)[0-9]*/, '$1' + '123'));
// www.website.com/page?id=123
View my_pmpro_how_hear_field.php
/*
Add a "How did you hear about us?" field Membership Checkout for new members only.
Display the field for admins-only in the profile and in the Members List CSV export.
*/
function my_pmpro_how_hear_fields() {
global $current_user;
if(class_exists( 'PMProRH_Field' ) && (!pmpro_hasMembershipLevel() || current_user_can( 'edit_users' ) ) ) {
pmprorh_add_checkout_box( 'additional', 'Additional Information' );
@CrandellWS
CrandellWS / DynamicLayoutGroup.cs
Created Feb 15, 2018 — forked from robertwahler/DynamicLayoutGroup.cs
Unity 3D layout group switches orientation automatically between landscape and portrait layouts so it either acts like a VerticalLayoutGroup or a HorizontalLayoutGroup.
View DynamicLayoutGroup.cs
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System.Collections;
using System.Collections.Generic;
using SDD.Extensions;
using SDD.Events;
namespace SDD.UI {
@CrandellWS
CrandellWS / DynamicLayoutGroup.cs
Created Feb 15, 2018 — forked from robertwahler/DynamicLayoutGroup.cs
Unity 3D layout group switches orientation automatically between landscape and portrait layouts so it either acts like a VerticalLayoutGroup or a HorizontalLayoutGroup.
View DynamicLayoutGroup.cs
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System.Collections;
using System.Collections.Generic;
using SDD.Extensions;
using SDD.Events;
namespace SDD.UI {