Skip to content

Instantly share code, notes, and snippets.

Chris McIntosh cmcintosh

Block or report user

Report or block cmcintosh

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Drupal Site Audit Steps.md

Create a good backup

Put the site in version control

Create a Github copy of the code if it doesn't already exist. Start your first commit with everything exactly the way it is before you start. If the project already has git, do perserve the git history.

Backup the files and database

Name and Date the backup. Do this before you change anything. Just in case.

View gist:289943b5776321af2178838c73cad11f
void Update() {
if ( UMAAnimator == null ) {
foreach (Transform t in transform)
{
if (t.name == "UMACharacter") {
UMAAnimator = t.gameObject.GetComponent<Animator> ();
m_Animator = UMAAnimator;
m_Animator.applyRootMotion = false;
}
}
@cmcintosh
cmcintosh / Achievement Interface
Created Apr 28, 2017
Achievement System for Unity
View Achievement Interface
interface Achievement {
int id; // Public id of this perticular achievement. used to load text.
string label; // This will be loaded and populated from the json file.
bool displayed; // Has been displayed to the user.
bool unlocked; // Has been unlocked by the user.
List<AchievementCondition> conditions[]; // A list of conditions that are required to unlock the Achievement.
void checkAcievementState();
}
@cmcintosh
cmcintosh / CustomFieldsetDemo.php
Created Jul 6, 2016
Customize Fieldsets in Drupal 8
View CustomFieldsetDemo.php
<?php
/**
* {@inheritdoc}
*/
public function buildForm ($form, $formState) {
// First define our fieldset, and add a #theme tag to our element.
// See http://www.drupalcontrib.org/api/drupal/drupal!core!includes!form.inc/function/theme_fieldset/8
// for the default implementation.
View gist:93b156eccd73f68364f063bcd2d5165c
(function($, Drupal) {
/**
* Add new command for reading a event.
*/
Drupal.AjaxCommands.prototype.getEvents = function(ajax, response, status){
// Place content in current-msg div.
$('#event-msg h2').html(response.subject);
$('#event-msg p').html(response.content);
// Remove from unread list.
$('#event-' + response.mid).remove();
View validateEmailAjax
$form['username'] = array(
'#type' => 'textfield',
'#title' => t('Username'),
'#ajax' => [
'callback' => '::validateEmailAjax',
'event' => 'change',
],
'#suffix' => '<span class="username-available"></span>'
);
View EntityAutocompleteController
public function handleAutocomplete(Request $request, $target_type, $selection_handler, $selection_settings_key) {
$matches = array();
// Get the typed string from the URL, if it exists.
if ($input = $request->query->get('q')) {
$typed_string = Tags::explode($input);
$typed_string = Unicode::strtolower(array_pop($typed_string));
// Selection settings are passed in as a hashed key of a serialized array
// stored in the key/value store.
$selection_settings = $this->keyValue->get($selection_settings_key, FALSE);
View Ajax Empowered Link
View gist:321d6ed932736df7cec4165e54a487fa
#
# This Replaces the old Drupal 7's module .info
#
name: Todo: Make Drupal 8 Fun
type: module # Either module or theme
description: Creates our custom TODO module
core: 8.x
package: TODO
configure: entity.todo.settings # This replaces the old admin path from Drupal 7
tags: # Tags can be used as a categorization method for your modules.
View gist:e695370870dba552e21b
/**
* Implement hook_gateway_info
*/
function sms_fowiz_gateway_info() {
return array(
'sms_fowiz' => array(
'name' => 'FOWiz Gateway',
'send' => 'sms_fowiz_send',
'recieve' => TRUE,
'configure form' => 'sms_fowiz_settings',
You can’t perform that action at this time.