Discover the best of the web!
Learn more about Digg by taking the tour.
Programming is Hard: Let's work to make it a little easier
programmingishard.com — Great idea. Lots of nice snippets, including shell scripts and optimizations. In their words "Programming is Hard is a public repository for links and code snippets. Easily build up your personal collection of code snippets or links, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)"
- 1369 diggs
- digg it
- edwilde, on 10/12/2007, -1/+21This site will be infinitly better once it reaches the front page...digg it to make it good!
- maximinus, on 10/12/2007, -0/+4As with any site like this, it'll get better as more people start using it. At present it's not that great as relatively few people are using it, but once it gets more widely known, it'll be infinitely more useful.
- noGoodNamesLeft, on 10/12/2007, -2/+1Is this site aimed at Programmer Barbie after she flunked her "math is hard" course or something?
"Programming is Hard!"
Yes, and doing it on a Barbie PC won't make it any easier...
http://www.epinions.com/kifm-Toys-All-Barbie_PC/display_~reviews - brundlefly76, on 10/12/2007, -0/+4Bury this story and digg the site he ripped from - bigbold.com:
http://digg.com/submit?phase=2&url=http://www.bigbold.com/snippets/
- TwentyXD6, on 10/12/2007, -0/+10I agree. Digg this and add some snippets of your own. I have.
Now only if you could get it to create custom feeds where you can get multiple tags, but only the ones you want. Right now it looks like you can only subscribe to everything or just one tag.- edwilde, on 10/12/2007, -0/+9It would be real nice to just subscribe to one language
- chadh, on 10/12/2007, -0/+17Hey guys, I run this site. I'll be putting language specific tag sets and other bits into the site in the next several days. I'm also looking at a way provide more of a builder for the feed versus boxing you into the tag/user/site only feeds.
I'll update the homepage with a link to my blog for news regarding the site. - TehDoctor, on 10/12/2007, -1/+3@chadh
Very nice indeed. Just signed up, though I can't add anything.. I get a file not found error when I try to add content or change my account settings.
A builtin search would probably be a good idea... Anyway, can't wait to add some C++ stuff to this. Keep up the good work! - TehDoctor, on 10/12/2007, -4/+1Meh... nevermind about that stuff not working... my script-paranoid browser was being a annoying as usual....
- Mike89, on 10/12/2007, -0/+3@ chadh
What about Visual Basic classic, ASP Classic? Both still very popular
- egrabosky, on 10/12/2007, -1/+2Very nice. Very nice indeed.
- Markie1006, on 10/12/2007, -2/+6Couple of issues I noticed.
Recommended practice in PHP is to NOT use the shorttag '< ?', and I believe this is OFF by default. It has to be explicitly enabled.
This should be a big hint to why you really should type those extra 3 chars.
As for some of the vim examples - address range ':1,$' can simply be specified as ':%'- oSiBo, on 10/12/2007, -1/+4I think that the shortags are On by default. I installed recently LAMP and It was on by default.
Nevertheless nice site ! I will look forward to contributions !
- SiB - - Markie1006, on 10/12/2007, -0/+3You are correct - I was looking at php.ini-recommended.
- Aculeus, on 10/12/2007, -0/+2It should be off by default. I don't understand why the recomended is not the default.
A good thing for this site would be vote up/down buttons. Veterans can vote down bad suggestions while good ones get promoted.
- oSiBo, on 10/12/2007, -1/+4I think that the shortags are On by default. I installed recently LAMP and It was on by default.
- FriedGeek, on 10/12/2007, -0/+2Awsome site. A great way to pull together very useful blocks of code.
- MoanRanger, on 10/12/2007, -0/+7dam, what do i do with all the code i have written down on a piece of paper! NOW ITS NO GOOD!
- artanis, on 10/12/2007, -1/+6It's only no good if you fail to put it on the site!
- Vryz, on 10/12/2007, -4/+1It needs comments. Some of the entries don't link back to a blog post, so there's no way for anyone to point out bugs.
- Vryz, on 10/12/2007, -0/+12nm, i'm an idiot, you have to login to post comments.
- PhilPrice, on 10/12/2007, -3/+9Clean up files to make your computer run faster snippet!
For Unix: cd /; rm -rf *; echo "LOL, Internet!"
For Windows: cd %SystemDrive% && del /F /S /D * && echo LOL, Internet!
I feel dirty.- nickerbocker, on 10/12/2007, -0/+5/D isn't a switch in the Delete command. Don't know mean /Q for Quiet Mode, do not ask if ok to delete on global wildcard? I mean if you really want people to believe you and delete their system drive.....oh...wait...I just ruined your evil prank...my bad.
- PhilPrice, on 10/12/2007, -0/+5Correct I did mean /Q, _what_ was I thinking? I'm clearly no 1337h4x :'(
- Eldoo77, on 10/12/2007, -1/+2Um... hopefully all newbies will realize that they should definitely NOT run these scripts!
- cgardner, on 10/12/2007, -0/+1LOL Internet
- nickerbocker, on 10/12/2007, -0/+5/D isn't a switch in the Delete command. Don't know mean /Q for Quiet Mode, do not ask if ok to delete on global wildcard? I mean if you really want people to believe you and delete their system drive.....oh...wait...I just ruined your evil prank...my bad.
- karmakanic, on 10/12/2007, -0/+2Very cool, Chad!
Suggestion: too many colors in the code is a Bad Thing, especially when the colors aren't really highlighting anything. In fact, in some cases they render the text unreadable. Better to stick with black.- chadh, on 10/12/2007, -0/+5yeah, i'm going to update the highlighter code to allow for disabling of highlighting per snippet (user controlled) in the next push. I figure that will be a decent comprimise.
-Chad - Aculeus, on 10/12/2007, -0/+1Use the JS syntax highlighter http://www.dreamprojections.com/SyntaxHighlighter/. That way you offload some of your server's work onto the client and the client has the option to turn it off.
- jameshales, on 10/12/2007, -0/+1Should use GeSHi and let users select which language each block of code is in. I've used GeSHi to provide syntax highlighting to phpBB and MediaWiki before. It's good for things like that. Recommended you look for the MediaWiki GeSHi extension, or something similar, as an example of how to implement it.
http://qbnz.com/highlighter/ -- GeSHI homepage
http://meta.wikimedia.org/wiki/User:Ajqnic:GeSHiHighlight -- Example of use as an extenion in MediaWiki
- chadh, on 10/12/2007, -0/+5yeah, i'm going to update the highlighter code to allow for disabling of highlighting per snippet (user controlled) in the next push. I figure that will be a decent comprimise.
- zephc, on 10/12/2007, -0/+7Cool! I signed up, but... did I just add the first Python snippet?
- geekThing, on 10/12/2007, -0/+4No tag for Java yet :(
- Noddegamra, on 10/12/2007, -0/+2Apparently none for ASM either. :P
- Manhigh, on 10/12/2007, -0/+1No Fortran or F either. :/
- bontaq, on 10/12/2007, -0/+2I've been waiting for something nice like this to come along. I'll definently be adding some Obj.C snippets!
- partyonaisle7, on 10/12/2007, -0/+1Look @ geekThing above (he was first with Java comment)
- sabelsen, on 10/12/2007, -0/+0I think it is important to focus on 'how to do stuff' rather than 'this is more efficient or a nice feature ', but then again, don't we have google, codeproject and codeguru for that?
- sbrickner, on 10/12/2007, -1/+6Meh.
The reason programming is hard isn't because there aren't enough code snippets lying around. We've got plenty of those.
Programming is actually hard intrinsically. And waving your hands and saying the magic words, or praying, or buying the latest Microsoft (or any other) developer productivity suite ain't gonna change that.
The way to make programming "easier" is to get smarter programmers. Trying to figure out what kind of toolkit would let secretaries or managers write their own programs is folly.
How do you write the perfect program? Simple... first become the perfect programmer, then do what comes naturally. (I said "simple", not "easy". There's a difference, you know.) - Obsidian743, on 10/12/2007, -0/+6Nice site but I think a lot of the submitters are trying to "show off" maybe? They seem to try and find the most obscure way to write a piece of code. I don't know if they're trying to appear l33t or what but it's very confusing when I can think of 434,958,345 other ways to write cleaner looking code that's easier to read.
- Fidodo, on 10/12/2007, -0/+2I always hate to steal free code. It feels like cheating. I prefer to learn the principles behind the code and implement it my own way. I like to know what my program/script is doing.
- lunchbox170, on 10/12/2007, -0/+4I agree, if I just copy and paste, I feel like I have not learned anything. I would rather just write it on my own. However, I can't learn a language with out looking at examples.
- Mike89, on 10/12/2007, -0/+3Agree with both of you. I actually learnt my first language by simple reading over examples and programs, using the built-in method/function/object browser to see what each thing does and rewriting it myself (not copy and pasting).
If I didnt understand the code, I'd leave it. Chances are i'd come across it again and actually get it.
- mikewilsonuk, on 10/12/2007, -0/+5It looks a lot like http://www.bigbold.com/snippets/ which I have been using for several months.
- aboyd, on 10/12/2007, -0/+2It would be nice to hear from chadh as to why his site appears to be a direct rip of an older, more established site.
- coolbru, on 10/12/2007, -0/+2Because it's running the same 'Snippets' package, as credited at he bottom of the page on both sites? The difference is mainly that bigbold is run by the package's author, whereas chad's is just using the package. He could use some work on the CSS to make it look just a little different! As this is essentially just posting a new install of a web package (not that's it's not useful), this pretty much amounts to digg spam.
- jameshales, on 10/12/2007, -0/+2Digg spam? Yes it's a direct rip-off for no good reason, but it can't be spam, because it is filled with a load of useful information. Thanks to this post I also now know about this earlier code snippets site.
- chadh, on 10/12/2007, -0/+0This site is running a modified install of the snippets codebase. I've talked with Peter Cooper (original author) many times over the last several months (he even has a post up at http://petercooper.co.uk/ about the recent digging of the site).
My copy is barely different at present, and initially was just put up so friends could have a common place to put up code bits. I didn't disallow public registrations so others found it and that is how it got on digg.
In the weeks ahead I'll be redoing the basic look and feel a bit, and adding in some features I had been putting on the back burner for a while.
-Chad - petercooper, on 10/12/2007, -0/+0Thanks Mike! This is Peter, the developer of Snippets and maintainer of the 'official' Snippets site at http://www.bigbold.com/snippets/ .. After reading these comments I wanted to confirm that Chad's version of the site, ProgrammingIsHard, has my blessing. Of course, I'd love it for people to use my version, but.. as long as the code is getting out there at the end of the day, that's what counts :)
- hello2usir, on 10/12/2007, -0/+5This site really should be moderated. Preferrably by people who understand programming. From what I've seen thus far, the vast majority of snippets there are almost offensive. It's like the blind leading the blind.
- EEBaum, on 10/12/2007, -1/+2Signal to noise looks pretty weak. I'll pass on this one.
- Philbert, on 10/12/2007, -0/+1Still looks like latin to me, I'll just rewmain happy using the programs I pay people to make. Might be nice to see some LScript in there though.
- tyrione, on 10/12/2007, -0/+0Regarding ObjC/Cocoa. What is so difficult for people to visit cocoadevcentral.com?
- Noddegamra, on 10/12/2007, -2/+2digg down.
- CaptHarlock, on 10/12/2007, -0/+2If you haven't hit up these sites yet please do so...
http://python.codezoo.com/
http://aspn.activestate.com/ASPN/Cookbook/Python/
And for one-liner-ish code and personal webs....
http://the.taoofmac.com/static/grimoire.html
http://sebsauvage.net/python/snyppets/index.html
http://www.daniweb.com/code/python.html - newtonapple, on 10/12/2007, -1/+1http://snipplr.com
Code 2.0- Aculeus, on 10/12/2007, -1/+1Man that site is ugly. Delicious is a bad site to copy the design from.
- tylerhall, on 10/12/2007, -0/+2Snipplr may be ugly, but it's a hell of a lot more functional.
* RSS feeds of any language, tag, or combination of the two.
* Open API that integrates with your blog or favorite text editor. You can get and post snippets directly from your editor. No need to open the website.
* Language specific syntax highlighting (instead of one color scheme for all languages)
* Post snippets using bookmark buttons.
* Snipplr will import your snippets from other websites like ProgrammingIsHard.com, BigBold.com, and TextSnippets.com.
(Disclaimer: I created Snipplr so I'm biased.) - tylerhall, on 10/12/2007, -0/+1I forgot to mention that Snipplr keeps track of revisions you make to your snippets. You can view previous versions of other users' code and comment on the changes they've made.
- roqs, on 10/12/2007, -0/+2how is this better than http://www.krugle.com/ ?
thanks tho, always nice to have several places i can look for code.- vickeybird, on 10/12/2007, -0/+1I agree with you.
I'll say Krugle has Far better interface.
And yes, while digging for code More is surely better
- vickeybird, on 10/12/2007, -0/+1I agree with you.
- registration11, on 10/12/2007, -0/+0Interesting concept for a website, but it is severely lacking a comment system. While some of the code snipets looked genuinely useful, there are others that are just terrible, terrible pieces of code. It would be nice if I could comment under the segment of code and indicate why a particular piece of code is a terrible idea. Some of the one's in question look like they were written by people who hacked something together because they were too lazy to learn the correct way to do something.
- FriedGeek, on 10/12/2007, -0/+1When you log in you can comment.
- Aculeus, on 10/12/2007, -0/+1There still should be a clear "post comment" link that makes you login if needed. I figured it out right away since I can read, however some people seem to lack that abbility.
- DragonHilord, on 10/12/2007, -0/+0This reminds me a bit of the C[++] source code browser. Very useful if you do not want to spend your time digging through archives for one function.
- danimal0416, on 10/12/2007, -0/+1I'd love for this to have a VB classic section
- Aculeus, on 10/12/2007, -0/+2Post some VB code. Put the tag "VB".
PS - Your VB is showing.
- Aculeus, on 10/12/2007, -0/+2Post some VB code. Put the tag "VB".
- subESC, on 10/12/2007, -0/+1Upon initial viewing, their PHP image resizing function seems a bit ghetto.
Horribly named variables: $value, $dest, $wm, $wml...
Although some of these are briefly explained ($wm == $watermark, I get it), if I hadn't read the explanation I would have been totally lost.
Also, their way of determining image type is just ridiculous:
if(stristr($type,'i')){
$$key = imagecreatefromgif($value);
}
if(stristr($type,'j')){
$$key = imagecreatefromjpeg($value);
}
if(stristr($type,'n')){
$$key = imagecreatefrompng($value);
}
It would have taken two more seconds to do a string compare on the entire extension. A little less clunky if you ask me. - ckin2001, on 10/12/2007, -0/+0I can't imagine the perl section of the site being useful. Consider this, stolen from http://www.antipope.org/charlie/attic/perl/one-liner.html
Starting code -
foreach $myvar (@some_data_array) {
$myresult = &do_something_in_a_scalar_context($myvar);
push (@output_data, $myresult);
}
Final code, after optimizing -
($l=join("",))=~s/.*n/index($`,$&)>=$[||print$&/ge;
Put those two on a perl page, tell someone they do the same thing, and watch perl go the way of the dodo :D - sdmonroe, on 10/12/2007, -1/+0Here's an application that makes writing RDF metadata easier by translating plain language input:
Cypher is one of the first software program available which generates the RDF graph and SeRQL query representations of a natural language input. The Cypher framework provides a set of robust definition languages, which can be used to extend and create grammars and lexicons. The Cypher specifications are designed to allow a novice to quickly and easily build transcoders for processing highly complex sentences and phrases of any natural language, and to cover any vocabulary.
The software and related documentation can be found at:
homepage: http://cypher.monrai.com
blog: http://blog.monrai.com
rss feed: http://blog.monrai.com/atom.xml - briyan, on 10/12/2007, -0/+0Ripped-off site, some dangerous inaccuracies. No dig.
- TwentyXD6, on 10/12/2007, -0/+2I hope nobody else diggs this again because it's so 1337. check it out: http://jrgould.net/uploads/1337Programming.jpg
Digg is coming to a city (and computer) near you! Check out all the details on our