This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
in vec2 v_texcoord; // texture coords | |
in vec3 v_normal; // normal | |
in vec3 v_binormal; // binormal (for TBN basis calc) | |
in vec3 v_pos; // pixel view space position | |
out vec4 color; | |
layout(std140) uniform Transforms | |
{ | |
mat4x4 world_matrix; // object's world position |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef __QUATERNION__ | |
#define __QUATERNION__ | |
#define HALF_DEG2RAD 8.72664625e-3 | |
float4 quaternion(float3 normalizedAxis, float degree) { | |
float rad = degree * HALF_DEG2RAD; | |
return float4(normalizedAxis * sin(rad), cos(rad)); | |
} | |
float4 qmul(float4 a, float4 b) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
namespace Gist | |
{ | |
public sealed class ReverseComparer<T> : IComparer<T> | |
{ | |
public static readonly ReverseComparer<T> Default = new ReverseComparer<T>(Comparer<T>.Default); | |
public static ReverseComparer<T> Reverse(IComparer<T> comparer) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Awake () | |
{ | |
hover = (body.mass * Physics.gravity.y) / -4; | |
} | |
void FixedUpdate () | |
{ | |
// compensate the spring in the controller to simulate the thortle without the spring in a real quadcopter controller | |
float thrust = hover + (Input.GetAxis ("Throttle") * throttle); | |
// FR front right |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// dataTables.js is great! But it requires you to have "good" tables in | |
// the first place. If your table has an uneven number of columns per | |
// row, and you're getting the dreaded "Cannot read property | |
// 'mData' of undefined" this'll fix it. If you're missing a thead or | |
// tbody you'll get that error too - this won't fix that! | |
$(document).ready(function() { | |
// We need to make sure every row in our table has the same number of columns. | |
// Otherwise dataTable doesn't work. | |
$('table').each(function(i, elm) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# Fill our vars and run on cli | |
# $ php -f db-connect-test.php | |
$dbname = 'name'; | |
$dbuser = 'user'; | |
$dbpass = 'pass'; | |
$dbhost = 'host'; | |
$connect = mysql_connect($dbhost, $dbuser, $dbpass) or die("Unable to Connect to '$dbhost'"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MIT License - Copyright (c) 2016 Can Güney Aksakalli | |
// https://aksakalli.github.io/2014/02/24/simple-http-server-with-csparp.html | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Net.Sockets; | |
using System.Net; | |
using System.IO; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Auto-generate carousel indicator html | |
var bootCarousel = $(".carousel"); | |
bootCarousel.append("<ol class='carousel-indicators'></ol>"); | |
var indicators = $(".carousel-indicators"); | |
bootCarousel.find(".carousel-inner").children(".item").each(function(index) { | |
(index === 0) ? | |
indicators.append("<li data-target='#MyCarousel' data-slide-to='" + index + "' class='active'></li>") : | |
indicators.append("<li data-target='#MyCarousel' data-slide-to='" + index + "'></li>"); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>SyntaXe</title> | |
<style> | |
* { | |
margin: 0; | |
padding: 0; | |
} | |
</style> | |
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public static class ConfigurableJointExtensions { | |
/// <summary> | |
/// Sets a joint's targetRotation to match a given local rotation. | |
/// The joint transform's local rotation must be cached on Start and passed into this method. | |
/// </summary> | |
public static void SetTargetRotationLocal (this ConfigurableJoint joint, Quaternion targetLocalRotation, Quaternion startLocalRotation) | |
{ | |
if (joint.configuredInWorldSpace) { |