This file contains hidden or 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
alias gs='git status' | |
alias ga='git add' | |
alias gc='git commit -m' | |
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "⚡" | |
} | |
function parse_git_branch { |
This file contains hidden or 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
BinaryNode* BinaryNode::remove(char *n) { | |
int test = strcmp(n,name); | |
BinaryNode *temp; | |
if(test > 0) { //Name we're deleting is bigger | |
if(right != NULL){ | |
right = right->remove(n); | |
return this; | |
} | |
} |
This file contains hidden or 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) 2009 David Lyon | |
Permission is hereby granted, free of charge, to any person | |
obtaining a copy of this software and associated documentation | |
files (the "Software"), to deal in the Software without | |
restriction, including without limitation the rights to use, | |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
This file contains hidden or 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
require 'test/unit' | |
class Piece | |
def self.beats(type) | |
self.instance_eval do | |
define_method "beats_#{type}?".intern do | |
true | |
end | |
end | |
end |
This file contains hidden or 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
#banal.rb | |
def banal(ary) | |
b = c = ary | |
unless ary.size <= 2 | |
b = banal(ary[0..(ary.size/2)-1]) | |
c = banal(ary[(ary.size/2)..-1]) | |
else | |
if b[0] == c[0] |
This file contains hidden or 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
# recursively compare the keys of these hashes, making sure that two has the same keys as one | |
one = {:id => 1, :items => [{:name => 'one'}, {:name => 'one:one'}]} | |
two = {:id => 2, :items => [{:name => 'two'}, {:name => 'two:two'}]} | |
def check_keys(hash1, hash2) | |
hash1.each_key do |key| | |
if hash1[key].is_a? Array | |
return hash1[key].each_index {|sub| check_keys(hash1[key][sub], hash2[key][sub])} if hash1[key].is_a? Hash | |
elsif hash1[key].is_a? Hash | |
return check_keys(hash1[key], hash2[key]) |
This file contains hidden or 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
# Base class for an Item | |
class LibraryItem | |
# Type is a depricated method, undefining it will be safe | |
undef_method :type | |
# Dynamically generates Getters/Setters for class | |
# get_set :name, ConstClass | |
def self.get_set(name, klass) | |
define_method(name) { | |
instance_variable_get("@#{name}").value |
This file contains hidden or 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
public void changeTargetIfNeeded() { | |
if ( targetEnemy == null || targetEnemy.isDead() ) | |
targetEnemy = getBestEnemyToAttack(); | |
} | |
public BattleCharacter getBestEnemyToAttack() { | |
BattleCharacter temp = null; | |
for(int i=0; i<enemyTeam.length; i++) { | |
if( temp == null || getValue(enemyTeam[i].getCharacterType().toString()) < getValue(temp.getCharacterType().toString())) | |
if(!enemyTeam[i].isDead()) |
This file contains hidden or 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
package client; | |
import java.awt.Point; | |
import java.util.Enumeration; | |
import java.util.Vector; | |
import client.BattleCharacter.CHARACTER_TYPE; | |
public class GoTeamVenture_AI extends AI{ |
This file contains hidden or 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
# | |
# Describing An Event: | |
# | |
# Define the image and movie classes: | |
class EventNameMovieAIA094_AIA131 < Movie | |
# Add up to 3 layers | |
# | |
# Parameters: | |
# id - the source id from Helioviewer of the image layer you'd like to add. See http://helioviewer.org/api/index.php?action=getDataSources for listing |
OlderNewer