Skip to content

Instantly share code, notes, and snippets.

@CrandellWS
CrandellWS / underwater.js
Created December 7, 2017 02:54 — forked from RichardSlater/underwater.js
Unity3d Underwater Effect
//This script enables underwater effects. Attach to main camera.
//Define variables
var underwaterLevel = 7;
//The scene's default fog settings
private var defaultFog;
private var defaultFogColor;
private var defaultFogDensity;
private var defaultSkybox;
@CrandellWS
CrandellWS / Subfolder to git repo.md
Created December 11, 2017 08:30 — forked from korya/Subfolder to git repo.md
Convert subfolder into Git submodule
@CrandellWS
CrandellWS / Android Privacy Policy Template
Created February 9, 2018 17:16 — forked from alphamu/Android Privacy Policy Template
A template for creating your own privacy policy for Android apps. Look for "[" and "<!--" to see where you need to edit this app in order to create your own privacy olicy.
<html>
<body>
<h2>Privacy Policy</h2>
<p>[Individual or Company Name] built the [App Name] app as a [open source | free | freemium | ad-supported | commercial] app. This SERVICE is provided by [Individual or company name] [at no cost] and is intended
for use as is.</p>
<p>This page is used to inform website visitors regarding [my|our] policies with the collection, use, and
disclosure of Personal Information if anyone decided to use [my|our] Service.</p>
<p>If you choose to use [my|our] Service, then you agree to the collection and use of information in
relation with this policy. The Personal Information that [I|we] collect are used for providing and
improving the Service. [I|We] will not use or share your information with anyone except as described
@CrandellWS
CrandellWS / DynamicLayoutGroup.cs
Created February 15, 2018 01:13 — 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.
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 February 15, 2018 01:13 — 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.
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System.Collections;
using System.Collections.Generic;
using SDD.Extensions;
using SDD.Events;
namespace SDD.UI {
/*
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 / gist:d5e7fca862f7d035ab67c2c2cc45407e
Created August 27, 2018 02:32 — forked from olimortimer/gist:3032672
JS: jQuery Replace HREF Query String
// www.website.com/page?id=100
$('#pageLink').attr('href', $('#pageLink').attr('href').replace(/((\?|&)id\=)[0-9]*/, '$1' + '123'));
// www.website.com/page?id=123
@CrandellWS
CrandellWS / wp_head_hide_billing_fields_for_registered_users.php
Last active November 22, 2023 00:10 — 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.
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 / CenterCropDrawable.java
Created September 27, 2018 13:11 — forked from rudchenkos/CenterCropDrawable.java
Maintain aspect ratio of bitmap drawables set as windowBackground on Android
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;
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));