best HTML code sharing app - code-sharing

I've been searching google for a while to determine the most coder-friendly example boxes.
I'm wanting to share varying forms of ECMA script (JS for example) etc that provides the user with color coding and a simple way of copying the code. I know there are several out there, but I wanted to get some opinions from SOF since you guys probably have good experience with code.
so- What's the code-sharing tool you [would] use?
the solution
I ended up using Gist for complete snippets and am using Syntax Highlighter for *incomplete * code samples. There's a Drupal plugin for the Syntax Highlighter, but I dare say it's more of a pain to figure out the plugin than it is to just do things the old fashioned way (old fashioned being like 5 years ago..)

I use http://jsfiddle.net/
Color coding — check
HTML, CSS, JS — check
Live demo — check

gist has syntax highlighting and users can download the files separately, as a zip archive or using git. You can embed the files easily on other sites.
Additionally, the site tracks changes and other users can add comments or fork a gist to change it themselves.

Related

Ace Editor Custom Syntax

This is my last attempt before I completely give up. I am trying to use the Ace Editor; so far it has worked really well for existing languages but I do not find the documentation good enough to guide me on how to create a custom syntax highlighter.
I know this is a very broad question, but can anybody point me in the right direction of a decent tutorial or some pointers on how the hell to get this custom highlighter working!?
The Ace Editor tutorial just mentions two files, doesn't really explain the content very well, where to put the files (as the lib/ace/mode folder doesn't exist in the pre-packaged version), or how to change the formatting etc.
Appreciate any help.
If you want to write your mode in packed mode, then you need to copy one of existing mode files, rename it to mode-mymode.js and use define("ace/mode/mymode", define("ace/mode/mymode_highlight_rules" instead of using several files

Generate a business letter for 100+ leads using wkhtmltopdf

We need to print Business Letter for a given list with mail merge facilities.
My client is not willing to spend $$ on a paid ASP.NET control to make PDF. So I opted in for WKHTMLtoPDF and it works fine for us until one day the client tried to get a PDF of 100+ leads, resulting in complete failure of PDF generation. It works just fine with a 10-20 page PDF, but not for 100.
Are there any tips & tricks to improve performance? We are using Cloud-hosted IIS 7 with ASP.NET 4 if that matters.
PDFSharp library is really a nice one!
I have used it for quite a while now, and I find it flexible enough to fulfill your needs.
However there are some aspects of using it as a "standalone library" - e.g creating tables is a headache and there aren't much text formatting options. It is much better to mix it together with MigraDoc (an extension library for PDFSharp).
If you're looking for a really free (as in "free of worries") library, choose iTextPDF versions prior to version 4.1.7, as they state in the ByteScout blog.
From the ByteScout blog:
iTextSharp 4.1.6 DLL only: itextsharp-4.1.6-dll.zip
iTextSharp 4.1.6 Source Code (C#): itextsharp-4.1.6.zip
I'm not sure I understand your problem but couldn't you generate docx documents and get the same results?
For all, I use http://wkhtmltopdf.org/ to create HTML to PDF, my ASP.NET code generate the HtML file then I create HTML to PDF and it is done, much easier than using itextpdf's Table and td structure to get things in better space. I found it easy and fast once you get your stuff aligned properly.
library has improved since original question asked and it performs better now.
here is good tutorial http://www.codeproject.com/Articles/20640/Creating-PDF-Documents-in-ASP-NET

Saving PDF files with Chickenfoot

I'm writing a web-crawler using Chickenfoot and need to save PDF files. I can either click the link on the page or grab the PDF's URL and use
go("http://www.whatever.com/file.pdf")
and I get the firefox "Opening file.pdf" dialog box, but can't click the "OK" button to actually save the file.
I've tried using other means to download the files (wget, python's urllib2, twill), but the PDF files are gated so none of those will work.
Any help is appreciated.
This example of how to save a target in the Mozilla developer documents looks like it should do exactly what you want. I've tested a Chickenfoot example that is very similar that gets the temp environment variable, and that worked well for me in Chickenfoot.
https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsIWebBrowserPersist#Example
You might have to play with the application associations in Tools, Options, Applications to make sure the action is set to Save File, but those settings might not apply to these functions.
End Answer, begin related grumblings...
I sure wish someone would fix the many bugs in Chickenfoot, and write a nice Cookbook programming guide. I've been using it for years, and there are still many basic things I've not been able to figure out how to do. I finally broke down and subscribed to the mailing list, as the archives have some decent script examples. It takes a lot of searching through the pdf references, blogs, etc. as the web API reference is very sparse.
I love how simple Chickenfoot can make automating some tasks, but it takes me days of searching javascript, DOM, and Firefox documents to find ways to do some of the things it can't, since I'm not really a web programmer. The goal of Chickenfoot seems to be that I shouldn't have to be, but unfortunately few are refining the proof of concept, as MIT has dropped the project.
I tried to do this several ways using only Chickenfoot commands and confirmed they don't work with the latest Firefox 3 and Chickenfoot 1.0.7.
I hope this helps! Good luck. Sorry I only ran across your question yesterday, but found it too interesting to leave alone.
You won't be able to click on Firefox dialogs for the sake of security.
The best way to download the content of a URL is to read then write the content of the URL.
// Chickenfoot 1.0.7 Javascript Code to download the content of a url.
include( "fileio.js" ); // enables the write function.
var url = "http://google.com",
saveFileTo = "c://chickenfoot-google.com";
write( saveFileTo, read( url ) );
You might find it helpful to use jquery with chickenfoot.
http://groups.csail.mit.edu/uid/chickenfoot/scripts/index.php?title=Using_jQuery,_jQuery_UI_and_similar_libraries
This has worked for me to save Excel files from NCES portal.
http://muaz-khan.blogspot.com/2012/10/save-files-on-disk-using-javascript-or.html
I was using Firefox 3.0 and the "old syntax" version of the code. I also stripped code intended for IE and "(window.URL || window.webkitURL).revokeObjectURL(save.href);" which generated an error.

BlogEngine.Net Code Formatting Extension that works?

For months now I've been trying to find a code syntax formatting extension that works for BlogEngine.Net. I'm not fond of the behavior of the default formatting extension, and have tried a couple of others (manoli is among them), but they always seem to interact badly with the TinyMCE editor. Does anyone know of an extension that works, or a different approach that will allow me to make code samples pretty on my blog without hacking the crap out of the HTML myself?
Thanks.
I would try using Windows Live Writer along w/ the Paste From Visual Studio plugin. One you go WLW, you'll never go back to that damn TinyMCE interface.
WLW here:
http://get.live.com/writer/overview
Plugin here:
http://gallery.live.com/liveItemDetail.aspx?li=d8835a5e-28da-4242-82eb-e1a006b083b9&l=8
Thanks, Rafe. Thanks to this post that Hanselman put up the day after I asked the question, I downloaded WLW and am now using it. As far as getting prettily formatted code, I'm using cut-and-paste from a little tool developed and available on manoli.net.
Check out SyntaxHighlighter.. Works excellent. For easy integration into BlogEngine have a look at my blog post.

Code syntax formatter for posting code on webpages

Is there a utility that will generate html or css for blocks of code (.net c#) when you post it on a website?
I have seen several websites with very nicely formatted code and I dont believe they do this manually.
Google prettify -
http://code.google.com/p/google-code-prettify/
I prefer Syntax Highlighter implementations (I'm using Wordpress plugin implementation for my blog).
Advantages
It is based on JavaScript and does
not care about what you have on the
server.
Posts with this formatting display
properly on different RSS feeds and
can be copied to clipboard.
It is trivial to extend syntax
rules. I'm using that to highlight
custom operators in Boo-based DSL (see sample post)
Multiple languages are supported
out-of-the-box
(source: googlecode.com)
You can get JavaScript syntax-highlighting scripts, such as this one by Dean Edwards.
This is also a jQuery version apparently based on it which looks good.
CopySourceAsHtml is an add-in for Microsoft Visual Studio 2005 that allows you to copy source code, syntax highlighting, and line numbers as HTML.
http://copysourceashtml.codeplex.com
It's highly configurable, and works much better than the download page would make you expect! Don't know if there is something similar for VS 2008
If you don't have the ability to add the google prettifier CSS reference, this would be a better way to go, as what you get is a complete HTML with the required style. I use it all the time on our developers wiki, and loving it.
An even better solution, if you don't want to bother installing anything, is to just use the little web app I wrote called BlogTrog CodeWindow:
http://www.blogtrog.com
It's easy to use. Just paste your code and embed the results.

Resources