Skip to content

Instantly share code, notes, and snippets.

Todd Mahoney t0dd

Block or report user

Report or block t0dd

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
@t0dd
t0dd / Snake.as
Created Dec 22, 2017
Kinematics used to develop a snake sprite
View Snake.as
package {
import Segment;
import flash.display.Sprite;
import flash.display.MovieClip;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import playerfiles.Player;
import playerfiles.Particle;
import flash.geom.Point;
@t0dd
t0dd / gosu_textinput
Created May 15, 2017
Gosu TextInput Example
View gosu_textinput
# This example demonstrates the use of the TextInput functionality.
# One can tab through, or click into the text fields and change it's contents.
# At its most basic form, you only need to create a new TextInput instance and
# set the text_input attribute of your window to it. Until you set this
# attribute to nil again, the TextInput object will build a text that can be
# accessed via TextInput#text.
# The TextInput object also maintains the position of the caret as the index
# of the character that it's left to via the caret_pos attribute. Furthermore,
View word counter
public class overFlow {
public static void main(String[] args) throws FileNotFoundException, IOException {
Map m1 = new HashMap();
try (BufferedReader br = new BufferedReader(new FileReader("file.txt"))) {
StringBuilder sb = new StringBuilder();
String line = br.readLine();
@t0dd
t0dd / gist:f9c28ac6b9aa034611a7
Created Dec 2, 2015
Renaming a branch locally and on Github
View gist:f9c28ac6b9aa034611a7
git branch -m old_branch new_branch # Rename branch locally
git push origin --delete :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@t0dd
t0dd / gist:fb731a4bb08ddf756b8a
Created Dec 2, 2015 — forked from lttlrck/gist:9628955
rename git branch locally and remotely
View gist:fb731a4bb08ddf756b8a
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@t0dd
t0dd / objects.js
Created Oct 16, 2013
Exploring JS topics - Objects and Inheritance
View objects.js
/* =========== JavaScript Objects =================== */
//Prototypes & Inheritance
//Creates a custom prototype object using inherit()
var book = {
title: "",
author: "",
ISBN: null
};
var book1 = inherit(book); //book is prototype for book1
@t0dd
t0dd / quick_union.rb
Last active Dec 21, 2015
Ruby implementation of the quick-union algorithm
View quick_union.rb
class QuickUnion
def initialize(n)
@id = Array.new(n) {|i| i}
end
def root(i)
while i != @id[i] do
i = @id[i]
end
@t0dd
t0dd / quick_find_union.rb
Last active Dec 21, 2015
My Ruby implementation of the Quick-Find/ Union algorithm
View quick_find_union.rb
class QuickFindUnion
def initialize(n)
@id = Array.new(n) {|i| i}
end
def connected?(p, q)
puts @id[p] == @id[q]
end
@t0dd
t0dd / a_select
Created May 29, 2013
Using jQuery to select external & internal links using just attribute and css selectors
View a_select
//Selecting all the external links of a page
$('a[href^="http://"]')
//Selecting all the internal links of a page
$('a:not(a[href^="http://"])')
@t0dd
t0dd / defineproperties
Last active Dec 17, 2015
JS - Using the defineProperty() option available in EcmaScript 5
View defineproperties
//Example 1
var createPerson = function(firstName, lastName){
var person = {};
//Descriptor object - define single property
//2 types - Data & Accessor descriptors
Object.defineProperty(person, "firstName", {
You can’t perform that action at this time.