r/tinycode • • Feb 11 '14

My first shot at doing tiny code... Does this look right?

Post image
0 Upvotes

r/tinycode • • Apr 21 '14

One KB of Webspace storage for 0.00000024 Bitcoin a day.

Thumbnail onekb.net
5 Upvotes

r/tinycode • • Apr 12 '21

Primality Test using Regex

Thumbnail
theabbie.github.io
1 Upvotes

r/tinycode • • Dec 24 '17

redditors DIY build system to replace GNU Make

Thumbnail
reddit.com
0 Upvotes

r/tinycode • • Jul 20 '11

Ruby: Snake in 9 Lines of Code

Thumbnail
pastebin.com
0 Upvotes

r/tinycode • • Oct 09 '16

593 byte version of "logme" tool. Simple tool that logs given parameter to ~/.logme/ folder. I'm using it to log my days.

Thumbnail
gist.github.com
4 Upvotes

r/tinycode • • Aug 08 '12

Python I just wrote to beat the Google's Doodle #2, 30 lines

0 Upvotes

import time import win32api, win32con

VK_CODE = {'spacebar':0x20}

def press(x): win32api.keybd_event(VK_CODE[x], 0,0,0)

def unpress(x): win32api.keybd_event(VK_CODE[x],0 ,win32con.KEYEVENTF_KEYUP ,0)

def play(): s = time.time() count = 0 totalTime = 24 timer = 0.5 while time.time() - s < totalTime: time.sleep(timer) press('spacebar') time.sleep(timer) unpress('spacebar') count += 1 if(count > 4): timer = .65 if(count > 10): timer = 0.8 if(count > 20): timer = 0.95

play()


r/tinycode • • Dec 21 '21

Shameless promotion of my new subreddit /r/madeinjs

6 Upvotes

Hello beloved /r/tinycode community! First of all I want to thank you all for participating and making this community what it is today. This subreddit has grown to a size and quality I would never have expected when I created it ...holy shit ... 10 years ago! I hope you get as much enjoyment out of this as I do :)

Today during my morning browse I came to a bewildering realization I had many times in the past. Since one of my favorite subreddits is /r/madeinpython and I was wondering many times why the same concept doesn't exist for JS (probably nowadays my second most used language) I decided to just create /r/madeinjs and see where it goes.

So obviously it's a brand new community and I'd be thrilled if some of you see potential value in it and would like to become part of this journey as well.

Thanks all and happy holidays! <3


r/tinycode • • May 30 '20

Game I am working on a secret community project for JS13k - PM me if you want to join up!

Post image
7 Upvotes

r/tinycode • • Apr 09 '19

tinycode request: Whats the simplest online game that runs purely as peer to peer (p2p) and has people playing it continuously?

0 Upvotes

For example, agar.io is a simple enough game it could be done in a p2p network, though I know of no live computers playing it. Of course you'd need a few servers of constant address so new computers can join the network, even if those servers are just an IRC chatroom or http://rocky-refuge-6432.herokuapp.com/ for posting a short string and your address to find eachother. Bittorrent, bitcoin, ethereum, tor, etc are p2p but arent games. I want to learn how the various p2p games work and try to build a general computing cloud that works similarly so theres no line between building games and playing games online, without the many players leaving, just forking variations continuously. But I dont know where to get started.


r/tinycode • • Aug 11 '16

Do you know any coding contest?

0 Upvotes

My buddy told me about http://js1k.com/. I am looking for coding contest like js1k. Do you know any? Help! Thanks!


r/tinycode • • Apr 02 '14

REBOL ENTRY PROGRAM

0 Upvotes

REBOL [title: "Job File"]

write/append %jobdata.txt "" database: load %jobdata.txt

gui: layout [

text bold "Load an existing record:"
name-list: text-list bold font-size 15 blue 250x100 data sort (extract database 12) [
    if value = none [return]
    marker: index? find database value
    id/text: pick database marker
    nm/text: pick database (marker + 1)
    pd/text: pick database (marker + 2)
    ow/text: pick database (marker + 3)
    ls/text: pick database (marker + 4)
    yo/text: pick database (marker + 5)
    yp/text: pick database (marker + 6)
    sd/text: pick database (marker + 7)
    pt/text: pick database (marker + 8)
    ayt/text: pick database (marker + 9)
    rt/text: pick database (marker + 10)
pm/text: pick database (marker + 11)
clear-calcs
    show gui]

guide
	text bold "Job ID:"       				id: field 100 bold font-size 15
	text bold "Name:"    					nm: field 100 bold font-size 15
	text bold "Pour Start Date:"     			pd: field 100 bold font-size 15
	text bold "One Way Travel:"      			ow: field 100 bold font-size 15
	text bold "Load Size:"					ls: field 100 bold font-size 15
	text bold "YPH Ordered:"				yo: field 100 bold font-size 15
	return
	text bold "Yards in Pour:"				yp: field 100 bold font-size 15
	text bold "Slab Depth:"					sd: field 100 bold font-size 15
text bold "Pour Start Time:"				pt: field 100 bold font-size 15
text bold "Added Yard Time:"	        		ayt: field 100 bold font-size 15
	text bold "Additional Return Time:" 			rt: field 100 bold font-size 15
	text bold "Pump Move Time:"				pm: field 100 bold font-size 15
return
text bold "Maximum YPH:" 	      		     	my:  field 75 bold font-size 15 
	text bold "Unload Time:"    				ut:  field 75 bold font-size 15 
	text bold "Total Trip Time:"     			ttt: field 75 bold font-size 15
	text bold "Yds Per Truck Hour:"      	 		ypt: field 75 bold font-size 15
	text bold "Actual Trucks Required:"			atr: field 75 bold font-size 15
text bold "Optimum Trucks Required:" 			otr: field 75 bold font-size 15	
text bold "Maximum Trucks Required:"			mtr: field 75 bold font-size 15
text bold "Trucks Required using YPH Ordered:"		rto: field 75 bold font-size 15
return
text bold "First Batch Start Time:"			fbs: field 75 bold font-size 15
text bold "YPH using Optimal Trucks:"  	   		ypo: field 75 bold font-size 15
text bold "Added Gap:"					ag:  field 75 bold font-size 15
text bold "Total Trucks Loaded at One Time:"		ttl: field 75 bold font-size 15
text bold "Pour Time Max Trucks:" 	 		ptm: field 75 bold font-size 15
text bold "Pour Time Opt Trucks:"			pto: field 75 bold font-size 15
	text bold "Total Number of Trips:"			tt:  field 75 bold font-size 15
text bold "Mins Out of Concrete using Opt:"		moc: field 75 bold font-size 15
return
text bold "Minimum Yds at Pump:"			myp: field 75 bold font-size 15
text bold "Total Mins Wasted using Max:" 	 	tmw: field 75 bold font-size 15
	text bold "Adjusted Truck Count if Limited Access:"	atc: field 75 bold font-size 15
text bold "Total Lost Hours to Pump Move:"		tlp: field 75 bold font-size 15
text bold "Wasted Assets Using YPH:"			wa:  field 75 bold font-size 15 red
text bold "Substitute Slab Depth Limited Access:"	sdl: field 75 bold font-size 15
text bold "Substitute Slab Depth for Underorder:"	sdu: field 75 bold font-size 15

across
btn "Save" [
    if id/text = "" [alert "You must enter an id." return]
    if find (extract database 12) id/text [
        either true = request "Overwrite existing record?" [
           remove/part (find database id/text) 12
        ] [
           return
        ]
    ]
    save %jobdata.txt repend database [id/text nm/text pd/text ow/text
    	ls/text yo/text yp/text sd/text pt/text ayt/text
    	rt/text pm/text]
    name-list/data: sort (extract copy database 12)
    show name-list
    show gui
]
btn "Delete" [
    if true = request rejoin ["Delete " id/text "?"] [
        remove/part (find database id/text) 12
        save %jobdata.txt database
        do-face clear-button 1
        name-list/data: sort (extract copy database 12)
        show name-list
        show gui
    ]
]
clear-button: btn "New" [
    clear-entries
    clear-calcs
show gui
]
calculate-button: btn "Calc" [ 	
my/text: ( to-decimal sd/text) * (10.5)
ut/text: round/to ( 60 / (to-decimal my/text / to-decimal ls/text) ) .1
ttt/text: round ((to-decimal ow/text) * (1.85) + 17 + (to-decimal ut/text) + (to-decimal ayt/text) + (to-decimal rt/text))
ypt/text: round/to (60 / (to-decimal ttt/text) * (to-decimal ls/text)) .01
atr/text: round/to (to-decimal my/text) / (to-decimal ypt/text) .001
otr/text: round/down (to-decimal atr/text)
mtr/text: round (to-decimal atr/text)
ypo/text: round/to ((to-decimal otr/text) * (to-decimal ypt/text)) .1
rto/text: round/to ((to-decimal yo/text) / (to-decimal my/text) * (to-decimal atr/text)) .1
ptm/text: round/to ((to-decimal yp/text) / (to-decimal my/text)) .01
pto/text: round/to ((to-decimal ptm/text) * ((to-decimal atr/text) / (to-decimal otr/text))) .01
bt: probe round ((to-decimal ayt/text) + (to-decimal ow/text) + 9)
at: to-time rejoin [ "00:" (to-string bt) ":00"]
fbs/text: (to-time pt/text) - (to-time at) 
ag/text: round/to (((to-decimal atr/text) - (to-decimal otr/text)) * (to-decimal ut/text)) .1
tt/text:  round/to ((to-decimal yp/text) / (to-decimal ls/text)) .01 
tmw/text: round (((to-decimal mtr/text) - (to-decimal atr/text)) * (to-decimal ptm/text) * 60) 
moc/text: round (((to-decimal pto/text) - (to-decimal ptm/text)) * 60)
myp/text: round/to (((to-decimal my/text) / 60) * 3) .1
ttl/text: round/to (((to-decimal ow/text) + (to-decimal ayt/text) + 11 + (to-decimal ut/text)) / (to-decimal ut/text)) .1
atc/text: round/to (((to-decimal ut/text) / ((to-decimal ut/text) + 3)) * (to-decimal atr/text)) .1
tlp/text: round/to (((to-decimal pm/text) * (to-decimal atr/text)) / 60) .1
wa/text:  if ((to-decimal rto/text) > (to-decimal atr/text)) [round (((to-decimal rto/text) - (to-decimal atr/text)) * 250000)]
sdl/text: ((to-decimal sd/text) * (to-decimal ut/text)) / ((to-decimal ut/text) + 3)
sdu/text: (to-decimal yo/text) / (to-decimal my/text) * (to-decimal sd/text)
show gui  
]

] clear-entries: does [ id/text: copy "" nm/text: copy "" pd/text: copy "" ow/text: copy "" ls/text: copy "" rt/text: copy "" yo/text: copy "" yp/text: copy "" sd/text: copy "" pt/text: copy "" ayt/text: copy "" pm/text: copy "" ] clear-calcs: does [ my/text: copy "" ut/text: copy "" ttt/text: copy "" ypt/text: copy "" atr/text: copy "" otr/text: copy "" mtr/text: copy "" ypo/text: copy "" rto/text: copy "" ptm/text: copy "" pto/text: copy "" fbs/text: copy "" ag/text: copy "" tt/text: copy "" tmw/text: copy "" moc/text: copy "" myp/text: copy "" myp/text: copy "" ttl/text: copy "" atc/text: copy "" tlp/text: copy "" wa/text: copy "" sdl/text: copy "" sdu/text: copy "" sdu/text: copy "" ] view center-face gui


r/tinycode • • Dec 15 '11

FizzBuzz implemented in only 120 characters of Ruby

Thumbnail sprunge.us
0 Upvotes

r/tinycode • • Oct 26 '13

short implementation of a stack data structure in c

Thumbnail codepad.org
5 Upvotes

r/tinycode • • Jul 03 '17

Bad Code — A deadly nightmare

Thumbnail
medium.com
0 Upvotes

r/tinycode • • Apr 20 '18

Hackathon contest

0 Upvotes

Hello everybody... I am about to take part to a hackathon contest at my university.. the theme is "Data in action"... The main categories where we should focus are:

  1. Math algorithms

  2. Computing routine optimization

  3. Data management

  4. Continuous I/O stream

  5. UI Design

  6. Maps and location services Can you guys give some help and resources to study ?


r/tinycode • • Mar 30 '18

Python: Creating and Exporting a 1.6 Million Word Multi-Lingual Dictionary!

Thumbnail
youtu.be
2 Upvotes

r/tinycode • • Feb 18 '15

[Help][Javascript] Make votedown button visible

2 Upvotes

Some subreddits use this piece of CSS to make votedown buttons invisible:

.arrow.down  {
    display:none;
    visibility:hidden;
}

That got me thinking, how would one turn them back visible with a sort line of javascript?

So from this starting point:

y = document.getElementsByClassName('down');
for(var i=0; i<y.length; i++) 
        y[i].style.display = y[i].style.visibility = 'inherit';

this is how far I've got:

for(i=0;;i++)x=document.getElementsByClassName('down')[i].style,x.display=x.visibility='inherit'

I'm sure there is room for improvement. I've tried to use map() on getElementsByClassName() but it doesn't work. Do you have any ideas how to reduce the line to even less characters?


r/tinycode • • Jul 12 '12

Add a collection to list in C#. Extension method.

0 Upvotes

I often want to add a collection of items to a list so I made this simple extension method. Thought I would share.

/// <summary>
/// Adds a collection of items to a list.
/// </summary>
/// <typeparam name="T">Generic List type.</typeparam>
/// <param name="sequence">List</param>
/// <param name="items">IEnumberable collection of items to be added to the list.</param>
public static void AddCollection<T>(this List<T> sequence, IEnumerable<T> items)
{
    foreach (T item in items)
    {
        sequence.Add(item);
    }
}

r/tinycode • • Nov 06 '17

A concise URL shortener in Python

Thumbnail aguo.us
7 Upvotes

r/tinycode • • Jul 21 '14

loop in less letters

7 Upvotes

in php:

while (@$a++<5){ .. }

@ suppresses warning but php initializes variable a at first ++

:)

you're welcome..


r/tinycode • • Mar 14 '13

Python Challenge: Determine what this will print without running it

0 Upvotes
print "".join((lambda b:[b[ord(a)] for a in b[:40]])('KM^ASB^sJSFGSgFcJS^ASV_AFBlfJBXSM^cJFlAOdbvDMoxkuvkSyHmvdEYqLWuXQslYJOofBmeTUhT.hfe EAaTyvePmhibKvTdbvtcVeUfuvbyUmznJGHWodx'))

r/tinycode • • Dec 25 '21

Boot sector games Boot Sector little something

1 Upvotes

So you can install Space Invaders on a boot sector in a Floppy Disk. I want to do this with a flash drive. How would I go about doing it while still using it for data storage? The drive is 4GB and my computer is a Thinkpad T430s.


r/tinycode • • Jul 03 '14

An automated wireless attack tool. [~3100 lines of Python]

Thumbnail
github.com
2 Upvotes

r/tinycode • • Feb 07 '15

OpenBlog mini 2.0 - Complete PHP blog system in < 330 lines of code (No database needed, no CSS/JS used)

Thumbnail
sourceforge.net
6 Upvotes