Skip to content

Instantly share code, notes, and snippets.

View GraemeFulton's full-sized avatar
😶‍🌫️

Graeme Fulton GraemeFulton

😶‍🌫️
View GitHub Profile
@GraemeFulton
GraemeFulton / custom_profile.php
Last active August 29, 2015 14:21
Use custom taxonomies as profile fields in BuddyPress
add_action('bp_init', array($this,'create_profile_field_group'));
/** src for create_profile_field_group : http://www.amkd.com.au/wordpress/buddypress-adding-custom-profile-field-programatically/118 **/
public function create_profile_field_group(){
global $wpdb;
$group_args = array(
'name' => 'Search Preferences'
);
$sqlStr = "SELECT `id` FROM `wp_bp_xprofile_groups` WHERE `name` = 'Search Preferences'";
$groups = $wpdb->get_results($sqlStr);
@GraemeFulton
GraemeFulton / tag_search.php
Created May 22, 2015 19:15
Adding tags to wordpress default search
<?php
/**Search all tags and taxonomies**/
/**modified: http://www.rfmeier.net/include-category-and-post-tag-names-in-the-wordpress-search/**/
/**useful: http://wordpress.stackexchange.com/questions/2623/include-custom-taxonomy-term-in-search **/
Class Tag_Search(){
private function __construct(){
add_filter( 'posts_join', array($this,'custom_posts_join'), 10, 2 );
add_filter( 'posts_where', array($this,'custom_posts_where'), 10, 2 );
@GraemeFulton
GraemeFulton / twoTerrain.js
Last active August 29, 2015 14:25
Two pieces of terrain
/**
* createTerrainMatrix
* @TODO: create the matrix of terrains - need to add 9 bits of terrain
*/
createTerrainMatrix:function(scene, perlinNoise){
//every 100px on the z axis, add a bit of ground
//to put the camera in the middle of three bits of terrain, z= 5
for ( var z= -5; z > -200; z-=100 ) {
@GraemeFulton
GraemeFulton / ThreeTerrains.js
Created July 25, 2015 20:00
Three bits of terrain, camera starts in centre
/**
* createTerrainMatrix
* @TODO: create the matrix of terrains - need to add 9 bits of terrain
*/
createTerrainMatrix:function(scene, perlinNoise){
//every 100px on the z axis, add a bit of ground
for ( var z= 100; z > -200; z-=100 ) {
@GraemeFulton
GraemeFulton / movingTerrainV1.js
Created July 25, 2015 20:11
Moving forwards - when camera moves past a tile, move it right to the front
/**
* createTerrainMatrix
* @TODO: create the matrix of terrains - need to add 9 bits of terrain
*/
createTerrainMatrix:function(scene, perlinNoise){
//every 100px on the z axis, add a bit of ground
for ( var z= 100; z > -200; z-=100 ) {
@GraemeFulton
GraemeFulton / matrixForwardBack.js
Created July 25, 2015 21:50
Matrix using bufferGeometry allowing movement forward and backwards
/**
* Terrain array
*/
function TerrainMatrix(){
this.floor = [];
this.tileHeight=100;
this.tileWidth=100;
this.tileRowNumber = 3;
@GraemeFulton
GraemeFulton / xpositions.js
Created July 25, 2015 21:58
Update x positions, the same way z is
//x positions
else if((this.floor[i].position.x - this.tileWidth)>camera.position.x){
this.floor[i].position.x-=(this.tileWidth*2);
}
//if the camera has moved past the entire square in the opposite direction, move the square the opposite way
else if((this.floor[i].position.x + this.tileWidth)<camera.position.x){
this.floor[i].position.x+=(this.tileWidth*2);
}
/**
* AudioAnalyser
* param- soundPath: path to your sound
*/
function AudioAnalyser(soundPath){
this.sound =soundPath;
this.audioCtx = new (window.AudioContext || window.webkitAudioContext)();
this.source;