Random line of code thread
category: code [glöplog]
@ ptr1 * cosα + c1ms2 @-> ptr1
Code:
XMLHttpRequest.prototype.__send = XMLHttpRequest.prototype.send;
XMLHttpRequest.prototype.send = function ( _data ) {
this.__onreadystatechange = this.onreadystatechange;
this.onreadystatechange = function () {
console.log( "XMLHttpRequest.onreadystatechange" );
console.log( this );
this.__onreadystatechange();
};
this.__send( _data );
};
Code:
console.log("ba"+ +"i’ll be gone anyway"+"a")
Code:
cmp.b #"""",d0
Silly things of why C doesn't have that?
I know, make it a struct, use tuples or other.
Assembly function would return things in multiple registers. C only 1. Why not upgrade C++ 23?
Second
You want to break twice.
Use a goto and see people screeching.
Yeah, put a boolean that you set and check/escape twice. Or rewrite.
Make this loop into a lambda that escapes it self but not the whole function outside.
Finally
THE low level language and no binary? We have to use defines with hex or bit shifting. When I change flags in hardware and want to put one by one the bits. Someone said make a function that accepts a string and returns back tha value.
But it has octal. Why no binary? Even basic had binary.
Code:
uchar* int myFunction()
{
return myCharPointer, anInt;
}
I know, make it a struct, use tuples or other.
Assembly function would return things in multiple registers. C only 1. Why not upgrade C++ 23?
Second
Code:
for (int y = 0; y < 10; ++y) {
for (int x = 0; x < 10; ++x) {
if (x > 5 && y > 5) break 2;
}
}
You want to break twice.
Use a goto and see people screeching.
Yeah, put a boolean that you set and check/escape twice. Or rewrite.
Make this loop into a lambda that escapes it self but not the whole function outside.
Finally
Code:
int a = 10;
int b = 0xABCD;
int c = 01234; // octal?
int c = 0b101010101010; // doesn't exist
THE low level language and no binary? We have to use defines with hex or bit shifting. When I change flags in hardware and want to put one by one the bits. Someone said make a function that accepts a string and returns back tha value.
But it has octal. Why no binary? Even basic had binary.
They make fun of Basic, but modern scripting languages are like a basic.
python and basic do not have much in common except the interpreter ;)
Code:
ld a,$f0
ldh [rNR12],a
ldh [rNR22],a
ldh [rNR42],a
ld a,$80
ldh [rNR14],a
ldh [rNR24],a
ldh [rNR44],a
ld a,$18
ldh [rNR12],a
ldh [rNR22],a
ldh [rNR42],a
Code:
cmp.l (a7)+,a0
Code:
move.l $400+$af50,$dff080 ; "thank you" Rob Northen.... just a few hours of my time wasted
guess the instruction set, ed. 2:
Code:
mov x, #0xaa
mov c, #0
3: dec c
mov a, [hl+c]
xor a, x
call !!0xeffa1
cmp0 c
bnz $3b
Code:
compute_keys_invoice_items( compute_key_invoice_header( ) ).
Code:
if ui.button("Save").clicked() {
match self.save_sample() {
Ok(..) => self.error_string = None,
Err(err) => self.error_string = Some(format!("{}", err)),
}
}
Code:
let mut genome_item = GenomeItem::new(
suggested_instruction_id,
target_value,
ParameterType::Constant,
source_value
);
Code:
// Fixed byte of value 0x96, followed by unit code which can be freely chosen.
// We insert an instruction here that does not bother us and stomp over it.
assert(current_pc(a) == ofs_fixed_byte);
a.mov(tmp0, 0x96);
Code:
mov dx,REG_SND_CH1_PITCH
mov si,FreqTable
add si,ax
add si,ax
mov ax,[cs:si]
out dx,ax
never done X86 assembly before, still not quite used to it
@DevEd, in that specific sequence, you could do "LODSW" to save a byte.
It does do "mov ax,[si]" + "inc si" + "inc si" ... override with CS is fine =)
It does do "mov ax,[si]" + "inc si" + "inc si" ... override with CS is fine =)
Code:
; Never seen 7 nested loops, ever!
Code:
vec2 uv = (.5/g_tanfov) * (2.*texCoord - 1.) * vec2(float(g_resolution.x) / g_resolution.y, 1.); // uniform rendertarget coords
vec3 ray = normalize(vec3(uv, -1.0));
vec4 rrat = vec4(ray, 1.0);
rrat *= m_view;
ray = rrat.xyz; // am i dumb
//ray = rotateXYZ(ray, vec3(0.6*cos(g_time*0.77), 0.8*sin(g_time*0.84), 0.8*sin(g_time*0.4)));
vec3 origin = vec3(0, 0, -22);
vec3 tt = raymarch(origin, ray);
Code:
dc.l $180005b,$ac07fffe,$1800fd0,-2
Code:
CUSTOM set $dff000 ; fun: preferences.i defines paper size "CUSTOM"...
Code:
$fn=40;
HG=0.05; //HalfGap
SIZE=15;
EDGE=3;
IBH=3; //InBetweenHeight
TBH=3; //TopAndBottomHeight
module Diamond() {
union(){
translate([SIZE/2,SIZE/2,TBH-HG+IBH]) linear_extrude(height = TBH, scale = (SIZE-2*HG-2*EDGE)/(SIZE-2*HG)) { offset(EDGE) { square(SIZE-2*EDGE-2*HG, center = true); } }
translate([SIZE/2,SIZE/2,0+TBH+HG]) linear_extrude(height = IBH-2*HG, scale = 1) { offset(EDGE) { square(SIZE-2*EDGE-2*HG, center = true); } }
translate([SIZE/2,SIZE/2,0+TBH+HG]) rotate([180,0,0]) linear_extrude(height = TBH, scale = (SIZE-2*HG-2*EDGE)/(SIZE-2*HG)) { offset(EDGE) { square(SIZE-2*EDGE-2*HG, center = true); } }
}
}
translate([1*SIZE,2*SIZE,0]) Diamond();
translate([2*SIZE,2*SIZE,0]) Diamond();
translate([0*SIZE,1*SIZE,0]) Diamond();
translate([1*SIZE,1*SIZE,0]) Diamond();
translate([1*SIZE,0*SIZE,0]) Diamond();
translate([2*SIZE-1.5*HG,2*SIZE+EDGE+HG,TBH+HG]) cube([3*HG,SIZE-2*EDGE-2*HG,IBH-2*HG]);
translate([1*SIZE-1.5*HG,1*SIZE+EDGE+HG,TBH+HG]) cube([3*HG,SIZE-2*EDGE-2*HG,IBH-2*HG]);
translate([1*SIZE+EDGE+HG,2*SIZE-1.5*HG,TBH+HG]) cube([SIZE-2*EDGE-2*HG,3*HG,IBH-2*HG]);
translate([1*SIZE+EDGE+HG,1*SIZE-1.5*HG,TBH+HG]) cube([SIZE-2*EDGE-2*HG,3*HG,IBH-2*HG]);
Code:
k=c.width=160;a=S(t*3)*7;x.F=x.fillRect;with(x)for(i=8;i--;F(9-g*3,g*15,17+g*6,13+g*9))g=i&1,a=-a,F(g*30,16,5,13+a),F(18-g*6,l=38,5,20+a),v=l/(4-(t+i/2)%4),F(0,l+v,k,v/l),fillText('R-1337',l,l)
https://www.dwitter.net/d/24500
Quote:
Code:CUSTOM set $dff000 ; fun: preferences.i defines paper size "CUSTOM"...
Haha, that's a good one. :) However, why do you need to mix OS and hardware code? It usually is not really a good idea.
Synthesizing some guitar-ish sounds (original idea by GM, with a "twist"):
// now add a HPF to get rid of the DC offset, an env-modulated LPF+DCA, ..and find good params
sound example
(note: I also made a version for my "Cycle" sample precalculator that runs on an A500, w/o floats, of course)
Code:
float r1 = (lfsr_randf(&voice->lfsr_1, 2.0f/*max*/) - 1.0f) * voice->mod_seed1scl_cur;
float r2 = (lfsr_randf(&voice->lfsr_2, 2.0f/*max*/) - 1.0f) * voice->mod_seed2scl_cur;
float r3 = (lfsr_randf(&voice->lfsr_3, 2.0f/*max*/) - 1.0f) * voice->mod_seed3scl_cur;
float r1mr2 = (r1 - r2) * voice->mod_scl1_cur;
float r2mr3 = (r2 - r3) * voice->mod_scl2_cur;
out = r2mr3 - r1mr2;
// now add a HPF to get rid of the DC offset, an env-modulated LPF+DCA, ..and find good params
sound example
(note: I also made a version for my "Cycle" sample precalculator that runs on an A500, w/o floats, of course)