pouët.net

Random line of code thread

category: code [glöplog]
Code:10 PRINT "YAY 1000!" 20 CALL 0
added on the 2012-06-18 16:33:39 by Korguiq Korguiq
Code: move.l TaskTrapCode(a0),fuck
added on the 2012-06-20 17:01:56 by StingRay StingRay
Code:mediafile.maintainAspectRatio = StringManipulation.toBoolean(mediafileNode.@maintainAspectRatio, true);
added on the 2012-06-20 22:59:58 by mog mog
Code:; Kickstart 1.2 zeropage (used in key calculation routine)
added on the 2012-06-22 08:25:41 by StingRay StingRay
loop main
squaretunnelrectangle.setPosition((squaretunnelrectsizeo[0]-squaretunnelrectsize[0])/2-(squaretunnelrectsizeo[0]-800)/2,(squaretunnelrectsizeo[1]-squaretunnelrectsize[1])/2-(squaretunnelrectsizeo[0]-600)/2+100);
added on the 2012-06-24 19:34:25 by PotcFdk PotcFdk
Damn, forgot to use the CODE tags.
Well then, here's another one:

Code:sineFull.setPosition(sineFullProcess,150+100*sin(sineFullProcess*3.14169265358979323/180*0.8));
added on the 2012-06-24 19:36:29 by PotcFdk PotcFdk
mov byte[ds:si+293+320*160],bh
Code:#define SAB_MAGIC 0xb16b00b5 // Always look for them
Code: MakeKeyTab lea KeyBuf(pc),a0 move.l a0,a1 move.l a1,Key-KeyBuf(a0) add.w #$6c,a1 move.l a1,Key6c-KeyBuf(a0) lea $dc(a0),a1 move.l a1,KeyDc-Keybuf(a0) move.l #$57319753,(a0) moveq #1,d6 moveq #55-2,d7 .loop move.l (a0)+,d0 ; previous key move.l d0,d1 asl.l #5,d1 sub.l d0,d1 add.l d6,d1 addq.l #1,d6 move.l d1,(a0) dbf d7,.loop rts ; original c version of the code above ; link a6,#-4 ; move.l (8,a6),a0 ; move.l #$57319753,(a0) ; moveq #1,d0 ; move.l d0,(-4,a6) ;.loop move.l (-4,a6),d0 ; cmp.l #55,d0 ; bge.b .done ; asl.l #2,d0 ; move.l (8,a6),a0 ; add.l d0,a0 ; subq.l #4,d0 ; move.l (8,a6),a1 ; add.l d0,a1 ; move.l (a1),d0 ; previous key ; asl.l #5,d0 ; sub.l (a1),d0 ; add.l (-4,a6),d0 ; move.l d0,(a0) ; addq.l #1,(-4,a6) ; bra.b .loop ; ;.done move.l (8,a6),a0 ; move.l a0,(Key) ; add.w #$6C,a0 ; move.l a0,(Key6c) ; move.l (8,a6),a0 ; add.w #$DC,a0 ; move.l a0,(KeyDC) ; unlk a6 ; rts
added on the 2012-06-26 08:13:01 by StingRay StingRay
invoke BlitToScreen, hWin, hMDC, offset img_01_p, offset img_01_d, 10, 24
; bah
added on the 2012-07-04 10:06:18 by zorke zorke
jmp eax
added on the 2012-07-04 10:06:37 by zorke zorke
POP CS
added on the 2012-07-04 10:08:35 by Joghurt Joghurt
Code: mul bl
Code:str r1, [r2, r0]
added on the 2012-07-06 21:25:04 by FreeFull FreeFull
Code:void init(int index, bool satanic, bool white);
added on the 2012-07-11 01:10:40 by Preacher Preacher
[code]
* fallback, may work in 99%
[/quote]
added on the 2012-07-12 11:05:28 by StingRay StingRay
Code: * fallback, may work in 99%
added on the 2012-07-12 11:05:44 by StingRay StingRay
Date.now()/1000|0

time() in javascript :D
added on the 2012-07-12 14:52:06 by GottZ GottZ
Code: move.l #$DEADFACE,d5
added on the 2012-07-17 13:15:28 by StingRay StingRay
Code: for(c=0;c<NbVariables;c++) { //Search the equation with a pivot for variable c d=c; Pivot=-1; do{ if(Equation[d][c][0]!=0) { Pivot=d; } d++; } while((Pivot==-1) && (d<NbEquations)); if(Pivot==-1) { printf("**** Error: no pivot can be found at this point ****\n"); PrintSystem(); exit(-1); } //Exchange equations SwapTwoEquations(c,Pivot); //For every equation below the pivot, eliminate the coef for this variable d=c+1; while(d<NbEquations) { LinearCombination(c,d,Equation[d][c][0]*Equation[c][c][1],Equation[d][c][1]*Equation[c][c][0]); d++; } printf("\n"); PrintSystem(); }
added on the 2012-07-18 21:32:26 by baah baah
Hi All,

Long time Aussie lurker, yet to make a demo about it. Anyway, I work as a support programmer at a university, fixing all their junk. Every so often I come across some amazing pieces of code that I just don't think are getting the recognition they deserve and wanted to share, but have never bothered with. This one I couldn't resist.

Code: $main::config{'minuteValStr'} = ['','00','05','10','15','20','25','30','35','40','45','50','55']; sub closestNum { my $x=0; my $answer; my @minuteArray = @{$main::config{'minuteValStr'}}; while ($x < 14) { if ($main::config{'minute'} >= 0 && $main::config{'minute'} < 5) { $answer = $minuteArray[1]; } elsif ($main::config{'minute'} >= 5 && $main::config{'minute'} < 10) { $answer = $minuteArray[2]; } elsif ($main::config{'minute'} eq $minuteArray[$x]) { $answer = $minuteArray[$x]; } elsif ($main::config{'minute'} eq ($minuteArray[$x]+1)) { $answer = $minuteArray[$x]; } elsif ($main::config{'minute'} eq ($minuteArray[$x]+2)) { $answer = $minuteArray[$x]; } elsif ($main::config{'minute'} eq ($minuteArray[$x]+3)) { $answer = $minuteArray[$x]; } elsif ($main::config{'minute'} eq ($minuteArray[$x]+4)) { $answer = $minuteArray[$x]; } elsif ($main::config{'minute'} > 55) { $answer = $minuteArray[$x-1]; } $x++; } return $answer; }
added on the 2012-07-19 03:49:50 by gibsonfs gibsonfs
4 colors... ;D
Code:int SizeAndNeighbourgs[NbSquares][1+MaxNeighbourgs+1]={ {50, 1,10, 9, 8,-1,-1,-1,-1} //a,50,b,k,j,i ... void RecursiveColoring(int SquareIndex) { int CurrentColor,c,Neighbourg,SameColor,d; for(CurrentColor=0;CurrentColor<4;CurrentColor++) { Colors[SquareIndex]=CurrentColor; //check if a neighbourg has the same color c=1; SameColor=FALSE; Neighbourg=SizeAndNeighbourgs[SquareIndex][c]; while((Neighbourg!=-1) && (SameColor==FALSE)) { if(Colors[Neighbourg]==CurrentColor) { SameColor=TRUE; } c++; Neighbourg=SizeAndNeighbourgs[SquareIndex][c]; } //if no neighbourg has same color, go on if(SameColor==FALSE) { //if it's not the last Square, recursively color next square if(SquareIndex!=NbSquares-1) { RecursiveColoring(SquareIndex+1); } else { //otherwise compute sizes and print if lowest MaxSurface-MinSurface for(c=0;c<4;c++) { Surface[c]=0; } for(c=0;c<NbSquares;c++) { Surface[Colors[c]]+=SizeAndNeighbourgs[c][0]*SizeAndNeighbourgs[c][0]; } if( (Surface[0]<=Surface[1]) && (Surface[1]<=Surface[2]) && (Surface[2]<=Surface[3]) && ((Surface[3]-Surface[0])<=LowestDifference)) { LowestDifference=Surface[3]-Surface[0]; printf("Min=%d cm^2, Max=%d cm^2\n",Surface[0],Surface[3]); for(c=0;c<4;c++) { printf("Color %d:",c); for(d=0;d<NbSquares;d++) { if(Colors[d]==c) { printf(" %c,",'a'+d); } } printf(" %d cm^2\n",Surface[c]); } } } } } Colors[SquareIndex]=-1; }

added on the 2012-07-19 19:05:42 by baah baah
Code:AddMenu TAR, TAR-GZIP Pack, StdIO "CON:0/16/640/464/Packing TAR-GZIP file...";Archive "tar -cf T:tarfile.tar" "-v";Extern GZIP -V;Extern GZIP -v9 T:tarfile.tar;Move T:tarfile.tar.gz %d;Wait;StdIO CLOSE

Enables DiskMaster 2.6 to put files in a combined TAR-GZIP archive from stdin to stdout in one step.

Code:AddMenu TAR, TAR-GZIP Extract, Window Dest;StdIO "CON:0/16/640/464/Extracting TAR-GZIP archive...";Extern GZIP -V;MakeDir T:temptar;Extern GZIP -dvc %s >T:temptar/tarfile.tar;Extern tar -xvf T:temptar/tarfile.tar;Extern Delete T:temptar ALL QUIET;Wait;Window Dest;StdIO CLOSE

This one lets DiskMaster 2.6 unpack a TAR-GZIP archive from stdin to stdout.

The DM2 configuration supports a very simple (and quite buggy) script syntax to manage such operations. Tricky: all has to be done in a single line without branching'n'stuff!
added on the 2012-07-22 21:14:04 by pintcat pintcat
move.l #cop,$dff080
added on the 2012-07-22 22:41:30 by Fell Fell

login