Skip to content

Instantly share code, notes, and snippets.

View brenttaylor's full-sized avatar

Ryan Brent Taylor brenttaylor

  • San Lorenzo, California
View GitHub Profile
@brenttaylor
brenttaylor / gist:1832279
Created February 15, 2012 01:18
Rails url redirects.
<%= form_for([@commentable, Comment.new], :url => company_comments_path) do |f| %>
<div class="field">
<%= f.label :content %><br />
<%= f.text_area :content %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
@brenttaylor
brenttaylor / .gitignore
Created February 15, 2012 08:17
Paul's gitignore
*.user
*bin/*
*.swp
@brenttaylor
brenttaylor / .gitignore
Created February 15, 2012 08:42
XNA 4.0 git ignore file
# Common files to ignore
*.swp
*.zip
*.suo
*.user
GWPlanetGame/GWPlanetGame/bin
GWPlanetGame/GWPlanetGameContent/bin
GWPlanetGame/GWPlanetGame/obj
GWPlanetGame/GWPlanetGameContent/obj
*.cachefile
@brenttaylor
brenttaylor / printStars.cpp
Created February 28, 2012 01:32
Student Assignment
#include <iostream>
#include <limits>
#include <cmath> //Has our Absolute value function: abs()
namespace BTH { //Brent Taylor Helper namespace. ;)
template<typename T>
bool InputFromStream(std::istream &InputStream, T &Result) {
InputStream >> Result;
if (!InputStream.good()) {
@brenttaylor
brenttaylor / AVLTree.java
Created March 7, 2012 08:01
Chad's AVL Tree in Java
package mycollections;
public class AVLTree<T extends Comparable<T>> extends BinarySearchTree<T> {
public AVLTree() {super();}
public void add(T data) {
System.out.println("Insertion of :" + data.toString());
AVLTreeNode parent = (AVLTreeNode) root;
Stack<Boolean> leftMoves;
Stack<AVLTreeNode> parents;
boolean placeNotFound = true;
if(root == null) {
@brenttaylor
brenttaylor / gist:2715742
Created May 17, 2012 02:23
DarkGDK DBObject ID generator
typedef unsigned int DBObjectID;
class DBObject {
private:
static DBObjectID IDCounter;
static std::list<DBObjectID> RecycledIDs;
protected:
const DBObjectID ID;
public:
DBObject() : ID(GetNewID()) {
}
@brenttaylor
brenttaylor / gist:3520108
Created August 29, 2012 23:09
Byte Array to Integer Type
enum ByteOrder {
BIG_ENDIAN,
LITTLE_ENDIAN
};
enum BTIException {
INTEGER_WIDTH_OUT_OF_BOUNDS
};
template <typename IntType>
function FizzBuzz() {
this.TestCases = new Array();
this.AddCase = function(Name, DivisibleBy) {
this.TestCases.push(
function (x) {
return x % DivisibleBy === 0 ? Name : '';
}
);
};
this.Run = function(x) {
#include <Windows.h>
HWND Wunderlist;
BOOL CALLBACK MyEnumProc(HWND hWnd, LPARAM lParam) {
char title[14];
ZeroMemory(title, sizeof(title));
GetWindowTextA(hWnd, title, sizeof(title));
if (strncmp(title, "Wunderlist - ", 13) == 0) {
void SendKey(int vk, BOOL bExtended, bool KeyUp) {
KEYBDINPUT Keyboard;
INPUT Input;
ZeroMemory(&Keyboard, sizeof(KEYBDINPUT));
ZeroMemory(&Input, sizeof(INPUT));
if (bExtended) {
Keyboard.dwFlags |= KEYEVENTF_EXTENDEDKEY;
}
if (KeyUp){