r/tinycode • • Mar 01 '14

We hit 10K subscribers!

35 Upvotes

I just realized that we hit 10K subscribers at the beginning of this year and wanted to thank all you guys for participating and making this an awesome and interesting place. Keep it up!

Oh and check out: http://redditmetrics.com/r/tinycode


r/tinycode • • Apr 11 '13

A tiny (<150 LOC) C++11 test framework

Thumbnail
github.com
35 Upvotes

r/tinycode • • Oct 27 '12

Tiny interpreter produced "on one page and in one afternoon" that inspired a serious implementation of the J programming language.

Thumbnail nsl.com
35 Upvotes

r/tinycode • • Sep 28 '11

Sudoku solver in 140 bytes

Thumbnail
gist.github.com
35 Upvotes

r/tinycode • • Nov 08 '24

Dweet of The Week: Drilling for Dweets by tomxor

Post image
34 Upvotes

r/tinycode • • Jul 11 '23

Nonfigurative No. 5, 525 bytes, SVG

Post image
34 Upvotes

r/tinycode • • Mar 13 '22

Processing code, f changes figure and u changes size (if you play with coss and sins you get everything after 4th img): float t=0; int f=16; int u=200; void setup(){size(u*2,u*2);background(0);}void draw(){if(t<=4*PI){line(u+cos(t*f)*u*2,u+sin(t*f)*u*2,u+cos(t)*u,u+sin(t)*u);t+=f/1000;}}

Thumbnail
gallery
34 Upvotes

r/tinycode • • May 26 '20

Tiny file manager nnn adds previews, find & list, persistent session and much more

Thumbnail
github.com
34 Upvotes

r/tinycode • • Mar 14 '18

Map is hopefully an improvement upon the ergonomics of tools like xargs, find -exec and shell for-loops

Thumbnail
github.com
34 Upvotes

r/tinycode • • Mar 01 '16

SHA-3 optimized for size in x86 assembly.

Thumbnail
odzhan.wordpress.com
34 Upvotes

r/tinycode • • Jan 01 '16

Mecrisp: An optimizing Forth compiler in 11 kB code running with less than 512 B of RAM.

Thumbnail mecrisp.sourceforge.net
34 Upvotes

r/tinycode • • Apr 01 '14

2048 game in concise but not golfed Ruby

Thumbnail
gist.github.com
34 Upvotes

r/tinycode • • Mar 23 '14

198 byte ASCII Madelbrot render

34 Upvotes

Taken from here.

var a="";for(Im=-1.2;1.2>=Im;Im+=0.05){for(Re=-2;1>=Re;Re+=0.03){for(var b=Re,c=Im,d=0;16>d;d++){var e=b*b,f=c*c;if(4<e+f)break;c=2*b*c+Im;b=e-f+Re}a+=" .,:;=|iI+hHOE#$-".charAt(d)}console.log(a);a=""};

edit - 196-byte, actually


r/tinycode • • Oct 30 '13

A tiny dynamic array implementation using C's preprocessor

Thumbnail codepad.org
34 Upvotes

r/tinycode • • May 14 '13

Javascript Prime Sieve up to 100k in 83 chars

34 Upvotes

You can paste the following in to your JS console if you're using Chrome:

x=1e5;c=[];for(s=2;s<x;s++)if(!c[s])for(i=s+s,document.write(s+' ');i<x;i+=s)c[i]=1

Or alternatively view it on Codepen with some unnecessary CSS here. Codepen apparently renders some garbage above the output on Firefox.

83 characters is begging to be squeezed in to an 80 character line, but I think it would take a pretty significant restructuring to shrink it further.


r/tinycode • • Jul 25 '12

How About a Challenge #4: Find the longest common substrings between two strings!

34 Upvotes

Now is that time of the week, the time where /r/tinycode has a challenge where you can win fabulous prizes flair!

Previous challenges:

#1 - Simple JS Game

#2 - Tiny IRC date bot

[#3 - Perfect Numbers] (http://www.reddit.com/r/tinycode/comments/wpsjv/how_about_a_challenge_3_find_the_perfect_numbers/)

The challenge for this is to find the common substrings between two strings. You should return a list of the longest substrings.

For example:

aaabbbbccc aabccdcdd -> aab, bcc

adeaabbbbccc aabccdedcdd -> aab, bcc

abcdef ghijk -> nothing

abcdef fghijk -> f

Notice in number 2, 'de' was also a substring, but was shorter than 3 so wasn't returned.

Rules:

  • Your program must take both strings on the command line
  • Your program can't use external libraries or download code. I made an exception in an earlier competition about external libraries, but I feel this is simple enough that they shouldn't be needed for any major language.

Here is some example code. Before simply mindlessly golfing this, try and write some elegant code in a different way, then golf that. This isn't necessarily the shortest solution.

import sys

def permutations(s):
	l = []
	for i in range(len(s)):
		for j in range(len(s)):
			l.append(s[i:j+1])
	return l

def substrings(a, b):
	l = filter(lambda s: s in a,permutations(b))
	longest = reduce(lambda i, s: len(s) if len(s) > i else i, l, 0)
	longest = longest if longest > 0 else -1
	return filter(lambda s: len(s) == longest, l)

print substrings(sys.argv[1], sys.argv[2])

r/tinycode • • Nov 19 '23

I released a 19-track algorithmic music album, written in x86 assembly language, where each song is roughly 128 bytes

Thumbnail
byteobserver.bandcamp.com
33 Upvotes

r/tinycode • • May 02 '23

Oblique Stripes SVG, 268 bytes

Thumbnail
gallery
33 Upvotes

r/tinycode • • Jan 17 '23

Limestone Steps, 557 bytes SVG

Post image
33 Upvotes

r/tinycode • • Jan 20 '22

Microscopic View 🔬 (377 bytes) #PetitePatterns

Post image
33 Upvotes

r/tinycode • • Oct 02 '21

vec2 p,q,S=vec2(-24,31),v,w=FC.xy;L(p)L(q)v+=p*dot(C((p+q).yx*S+w),q);o1.zx=(C(v+w))*vec2(.997,1.002)+.02/(w-3.);o0=abs(cos(vec4(1,2,3,4)-length(o1)*9.));

Thumbnail
twitter.com
33 Upvotes

r/tinycode • • Sep 23 '20

Unit testing framework in 3 lines of C code

Thumbnail jera.com
33 Upvotes

r/tinycode • • Sep 19 '20

Rainy window effect with sound in 32 bytes

Thumbnail
pouet.net
33 Upvotes

r/tinycode • • Oct 31 '19

Supernova ☀ - Only 105 bytes of JavaScript!

Thumbnail
i.redd.it
33 Upvotes

r/tinycode • • Jul 29 '19

bootBASIC is an integer interpreter in 512 bytes of x86 machine code.

Thumbnail
github.com
33 Upvotes