Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris Cacciatore cacciatc

View GitHub Profile
@cacciatc
cacciatc / fcuex_deb.rb
Created May 2, 2016
FCEUX Deb Format Codified in BinData
View fcuex_deb.rb
class Bookmark < BinData::Record
endian :little
uint32 :address
uint32 :name_length
string :name, :read_length => :name_length
end
class Breakpoint < BinData::Record
endian :little
uint32 :start_address, :inital_value => 0
@cacciatc
cacciatc / generate_debug_lua.rb
Last active Sep 24, 2015
Scans source for comment annotations and create a Lua script to be used with FCEUX
View generate_debug_lua.rb
debug_prints = []
# scan all source files for ;! annotations
(Dir.glob("src/**/*.h") + Dir.glob("src/**/*.s")).each do |file|
File.open(file, "r") do |file|
capture_next_line = false
file.readlines.each do |line|
if capture_next_line
debug_prints[-1][:name] = line.strip.split(":").first
capture_next_line = false
@cacciatc
cacciatc / texture-fun.js
Last active Dec 15, 2015
Texture generation.
View texture-fun.js
/*
* usage: /js generate_texture(width, height)
*
* notes: comment out one of the blocks in the generate_texture method to get started
* or play with the make_discrete function to get different colors.
*/
load(__folder + "core/scriptcraft.js");
function make_discrete(noise){
var val = parseInt(noise)+1;
@cacciatc
cacciatc / partial-templating.html
Created Mar 19, 2013
Partial template example.
View partial-templating.html
<tr>
<td>
{{players[0].points}}
</td>
<td>
{{players[0].name}}
</td>
<td>
{{players[0].post}}
</td>
@cacciatc
cacciatc / players.js
Last active Dec 15, 2015
Example players JSON stored in a scope.
View players.js
$scope.players = {[
{ name:"Cabrera, Miguel", pos:"3B", team:"DET", slg:0.606, obp:0.393 },
{ name:"Braun, Ryan", pos:"OF", team:"MIL", slg:0.595, obp:0.391 }]};
@cacciatc
cacciatc / table.html
Created Mar 19, 2013
Plain old HTML rows.
View table.html
<tr>
<td>
1,048.50
</td>
<td>
Cabrera, Miguel
</td>
<td>
3B
</td>
View ng-repeat-example.html
<tr ng-repeat="player in players">
<td>
{{player.score | number:2}}
</td>
<td>
{{player.name}}
</td>
<td>
{{player.pos}}
</td>
@cacciatc
cacciatc / using-bukkit-scheduler.js
Last active Dec 14, 2015
Example of using the Bukkit Scheduler from ScriptCraft.
View using-bukkit-scheduler.js
load(__folder + "../drone/drone.js");
load(__folder + "../core/scriptcraft.js");
Drone.extend("big",function(){
server.scheduler.scheduleAsyncDelayedTask(global.plugin,function(){
(new Drone()).box(1,500,100,500);
print("done");
});
});
View skeleton-quest.js
load(__folder + "../core/scriptcraft");
var quest = quest || plugin("quest",{
initialize_quest:function(player_name){
quest.store.players[player_name] = {
current:-1,
accepted:false,
skeleton_counter:0,
steps:[{
step:1,
@cacciatc
cacciatc / accept-and-skeleton.js
Created Feb 11, 2013
Accept and skeleton listener.
View accept-and-skeleton.js
skeleton_kill_counter:function(event,data){
var target = data.getEntity();
var killer = target.getKiller();
// check if it is the player who did the killing and if a skeleton was the target
if(killer != null && killer.getUniqueId() == getPlayerObject().getUniqueId() && target.getType() == org.bukkit.entity.EntityType.SKELETON && quest.store.players[killer.name] != null){
quest.store.players[killer.name].skeleton_counter = (quest.store.players[killer.name].skeleton_counter + 1);
if(quest.store.players[killer.name].skeleton_counter < 10){
killer.sendMessage("" + quest.store.players[killer.name].skeleton_counter + "/10 skeletons killed.");
}
else{