Random line of code thread

category: code [glöplog]
Code:void storeChar( SDL_KeyboardEvent *key ) { i = SDL_GetKeyName( key->keysym.sym ); }
Code:cmp.w #$c001,$0.w
added on the 2017-01-27 13:18:21 by StingRay StingRay
Code:let time = time.as_secs() as f64 + time.subsec_nanos() as f64 / 1e9;
added on the 2017-01-28 03:49:52 by FreeFull FreeFull
10 PRINT "Sahra is the best"
Code:let image = image::load(Cursor::new(&include_bytes!("logo.png")[..]), image::PNG).unwrap().to_rgba();
added on the 2017-02-12 21:49:49 by visy visy
1?"POUET ";
added on the 2017-02-15 09:06:59 by raina raina
public static FragmentXYZ newInstance(Object param) {
FragmentXYZ fragment = new FragmentXYZ();
fragment.myObject = param;
return fragment;

Not using Parcelable mechanism ? Well....
added on the 2017-02-21 14:55:04 by Romain337 Romain337
Code:move.l a7,-(a7)
added on the 2017-02-21 15:45:12 by StingRay StingRay
Code:if (getLogger().isDebugEnabled()) getLogger().debug(String.format("%s: get source document...", this));
added on the 2017-02-21 16:01:12 by uncle_H uncle_H

added on the 2017-02-22 20:41:43 by skrebbel skrebbel
Code:fields = [field for field in all_fields if field in fields]


=> fields-equals-field.mp3
added on the 2017-02-22 21:01:39 by gasman gasman
Precalculating bootblock code FTW \:D/

Code:move.w #$8e9,(a0)+ ; bset #x,xx(a1)
added on the 2017-02-22 21:46:03 by StingRay StingRay
If demo coding is getting boring, do something different. \o/

Code:; GEMDOS and XBIOS emulation code for Atari ST -> Amiga conversions
added on the 2017-02-24 16:16:13 by StingRay StingRay
Code:egrep -i '^[a-f]+$' words.txt

True hackers will understand. :)
added on the 2017-02-26 17:35:18 by Blueberry Blueberry
added on the 2017-02-28 17:13:32 by Kylearan Kylearan

Code: str[strlen(str)] = 0;

In a commercial project with millions of users.


0xF: seems like a smart hack to ensure the string always ends with a 0, which is actually useful to avoid buffer memory leaks and such C foley. not sure if there are any misuse consequences though?!


If the string hasnt a 0 it will write a 0 somewhere else in memory.
If the string already has 0 it an expensive shitload of nop.
Thats clearly retarted.

Thank you psenough and stfsux, your comments are just as entertaining as the code I posted. :)
added on the 2017-02-28 21:18:38 by 0xF 0xF
Code:hr = fw->context->Map( cbufferMaterial, 0, D3D11_MAP_WRITE_DISCARD, 0, &res); cbMaterial* material = (cbMaterial*) res.pData; material->Ambient = XMVectorSet(0.0f, 0.20f, 0.0f, 1.0f); material->Diffuse = XMVectorSet(0.0f, 0.0f, 0.750f, 1.0f); material->Specular = XMVectorSet(0.0f, 0.0f, 0.0f, 1.0f); material->SpecularPower = 1.0f; fw->context->Unmap(cbufferMaterial, 0);
added on the 2017-03-01 11:10:55 by spike spike
Code:drawrect -nr @gifJockey $hget(gj.colour, white) 1 $hget(gj.window, controlViewX) $hget(gj.window, controlViewY) $hget(gj.window, controlViewW) $hget(gj.window, controlViewH)
Code: public $stetson;
added on the 2017-03-02 10:43:27 by raina raina
BB Image
added on the 2017-03-02 15:37:22 by Tigrou Tigrou
Code:result.m[y + x * 4] += this->m[ay + ax * 4] * right.m[by + bx * 4];
added on the 2017-03-02 22:44:14 by cce cce
Code:w = (1 / max(e, d - c.w)) * pow(max(ee, dot(c.xyz, m[3].xyz)), 32);
added on the 2017-03-07 01:25:39 by merry merry