Skip to content

Instantly share code, notes, and snippets.

View brand-it's full-sized avatar

Brandt Lareau brand-it

View GitHub Profile
@brand-it
brand-it / mouse_robot.java
Created July 17, 2011 05:54
I cool mouse robot system that works great. May work for you as well.
public class MouseRobot {
private void mouseRebotReplace(MouseEvent e) {
int x = e.getX() - pCenterX;
int y = e.getY() - pCenterY;
if (!isPaused) {
if (mouseX < 0) {
mouseX = 0;
} else if (mouseX > pWidth) {
@brand-it
brand-it / Start.java
Created August 27, 2011 06:29
This is a basic distance calculation for game. Was testing out how accurate the data that is returned from numbers. Seams to be very good.
public class Start {
public static void main(String args[]) {
System.out.println("x, y: " + (7 - 6) + ", " + (3 - 4));
System.out.println((Math.pow((7 - 6), 2) + Math.pow((3 - 4), 2)));
System.out.println("x, y: " + (7 - 6) + ", " + (3 - 2));
@brand-it
brand-it / Gemfile
Created October 27, 2011 04:27
This is what a rails 3.1.0 app looks like when you create it.
source 'http://rubygems.org'
gem 'rails', '3.1.0'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
@brand-it
brand-it / Gemfile
Created October 27, 2011 04:31
This is what My rails 3.0.9 R3dux.net site Gemfile looks like
source 'http://rubygems.org'
gem 'rails', '3.0.9'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3-ruby', :require => 'sqlite3'
gem "authlogic", :git => 'git://github.com/odorcicd/authlogic.git', :branch => "rails3"
gem "carrierwave", :git => "git://github.com/jnicklas/carrierwave.git", :branch => "0.5-stable"
@brand-it
brand-it / application.rb
Created October 27, 2011 21:27
Rails 3.1.0 Application file upgraded What it looks like after upgrading my r3dux.net site.
require File.expand_path('../boot', __FILE__)
require 'rails/all'
require 'lib/error_form_builder'
# If you have a Gemfile, require the gems listed there, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env) if defined?(Bundler)
@brand-it
brand-it / application_controller.rb
Created March 26, 2012 21:57
A nice way to send session data to the active recored.
class ApplicationController < ActionController::Base
# Your existing stuff
around_filter :you_dont_have_bloody_clue
protected
def you_dont_have_bloody_clue
klasses = [ActiveRecord::Base, ActiveRecord::Base.class]
methods = ["session", "cookies", "params", "request"]
@brand-it
brand-it / game.cpp
Created May 17, 2012 18:53
Lets play a game a fun game of guessing numbers
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
int number;
static int lowRange = 1;
static int highRange = 100;
int numberOfTries = 10;
bool incorrect = true;
@brand-it
brand-it / drivers.cpp
Created May 17, 2012 18:38
Average system for loop and stuff
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
int total_judges = 0;
double total_number = 0;
double judges[5];
string name, city;
int drivers = 0;
@brand-it
brand-it / phone.cpp
Created May 24, 2012 17:58
Phone number validations made in C++ not very good but it works
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
char d1, d2, d3, d4, d5, d6, d7, d8;
char digitConvertion(char d){
char value = d;
switch (toupper(d)){
@brand-it
brand-it / sort_array.cpp
Created May 29, 2012 17:34
Sort array calculation
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
const int array_size = 9;
int array_of_numbers[array_size];
void exchangeSort(){