This file contains 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
class ERP | |
def self.flat_bom(part_number) | |
Rails.cache.fetch("erp_flat_bom_#{part_number}") do | |
parts = {} | |
bom = ERP.get_bom(part_number) | |
bom.items.each do |item| | |
[... recursively go down to get every part in this indented BOM...] | |
end | |
parts |
This file contains 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
s = Struct.new(:a,:b,:c) | |
a = [1,2,3] | |
b = s.new(*a) | |
puts b.a | |
puts b.b | |
puts b.c |
This file contains 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
module IncludableOne | |
def initialize | |
super | |
puts "IncludableOne::initialize" | |
register_on_save :includable_one_saved | |
end | |
def includable_one_saved | |
puts "Saved One" | |
end | |
end |
This file contains 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
<changeSet author="liquibase-docs" id="createTable-example"> | |
<createTable catalogName="cat" | |
remarks="A String" | |
schemaName="public" | |
tableName="person" | |
tablespace="A String"> | |
<column name="address" type="varchar(255)"/> | |
</createTable> | |
</changeSet> |
This file contains 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
// Instruction - a struct which encapsulates a function pointer and also some information | |
// about the CPU instruction | |
type Instruction struct { | |
name string | |
dataSize int | |
function func(cpu *CPU) | |
cycles int | |
} | |
var instructions = []Instruction{ |
This file contains 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
ADDR : instruction B C D E H L A SZ-X-P-C PW SP | |
0100 : 3E 01 MVI 00 00 00 00 00 00 00 00000010 0000 | |
0102 : FE 02 CPI 00 00 00 00 00 00 01 00000010 0000 | |
0104 : CA 00 00 JZ 00 00 00 00 00 00 01 10000111 0000 | |
0107 : FE 01 CPI 00 00 00 00 00 00 01 10000111 0000 | |
0109 : C2 00 00 JNZ 00 00 00 00 00 00 01 01010110 0000 | |
010C : C3 11 01 JMP 00 00 00 00 00 00 01 01010110 0000 | |
0111 : CD 17 01 CALL 00 00 00 00 00 00 01 01010110 0000 | |
0117 : E1 POP HL 00 00 00 00 00 00 01 01010110 FFFE | |
0118 : 7C MOV AH 00 00 00 00 01 14 01 01010110 0000 |
This file contains 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
PS E:\Dropbox\8080\test> ruby .\server.rb | |
New connection | |
Current client count: 1 | |
Client identified: 8080-golang .\test_roms\8080PRE.COM | |
New connection | |
Current client count: 2 | |
Client identified: 8080-golang .\test_roms\8080EX1.COM | |
8080-golang .\test_roms\8080PRE.COM | 8080-golang .\test_roms\8080EX1.COM | |
ADDR OP B C D E H L A SZ-X-P-C SP | ADDR OP B C D E H L A SZ-X-P-C SP | |
0100 3E 00 00 00 00 00 00 00 00000010 0000 | 0100 C3 00 00 00 00 00 00 00 00000010 0000 |
This file contains 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
class GameState: | |
def __init__(self): | |
self.handlers = {} | |
def default_handler(self,sw_number): | |
print( "Switch %s pushed!"%sw_number) | |
def on_switch(self,sw_number): | |
if sw_number in self.handlers: | |
self.handlers[sw_number]() |
This file contains 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
import pygame | |
import random | |
bg_color = (255,255,255) | |
clock = pygame.time.Clock() | |
card = pygame.image.load("card.jpg") | |
card_size = card.get_rect() | |
running = True |
This file contains 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
Add Index: (((A & 0x88) >> 1) | ((VAL & 0x88) >> 2) | ((A+B) & 0x88) >> 3)) & 0x7 | |
A VAL RES ADD Meaning | |
0 0 0 0 Both A&Val are <0x7, | |
0 0 1 0 Both A&Val are <0x7, carry from 2 to 3 (but no half-carry) | |
0 1 0 1 There was a carry from 2 to 3 which caused a carry out of 3 (ie: 0111 + 1111 = 1 000) | |
0 1 1 0 There was no carry from 2 to 3, so no carry out of 3 | |
1 0 0 1 There was a carry from 2 to 3 which caused a carry out of 3 (ie: 1111 + 0111 = 1 0000) | |
1 0 1 0 There was no carry from 2 to 3, so n ocarry out of 3 | |
1 1 0 1 There was a carry out of 3 (1000 + 1000 = 1 0000) |
NewerOlder