Senin, 17 Februari 2014

menempelkan source code ke blog dengan gist.github.com...

Banyak  alternative untuk menampilkan source code dalam format seperti dalam editor visual studio atau codeblock atau editor lainnya kedalam blog.

Salah satunya dengan memanfaatkan gist.github.com.
caranya:
1. buat akun di github
2. panggil  gist.github.com
3. paste source code kedalam kotak input / editor yang disediakan.
4. setelah pem-formatan dilakukan oleh gist, lihat ke bagian embed this gists, copy isinya.


 5. paste ke dalam HTML mode saat mengedit blog kita.



ini contohnya:
/***************************************************************
* Name: testMain.cpp
* Purpose: Code for Application Frame
* Author: spiro ()
* Created: 2014-02-06
* Copyright: spiro ()
* License:
**************************************************************/
#ifdef WX_PRECOMP
#include "wx_pch.h"
#endif
#ifdef __BORLANDC__
#pragma hdrstop
#endif //__BORLANDC__
#include "testMain.h"
//helper functions
enum wxbuildinfoformat {
short_f, long_f };
wxString wxbuildinfo(wxbuildinfoformat format)
{
wxString wxbuild(wxVERSION_STRING);
if (format == long_f )
{
#if defined(__WXMSW__)
wxbuild << _T("-Windows");
#elif defined(__WXMAC__)
wxbuild << _T("-Mac");
#elif defined(__UNIX__)
wxbuild << _T("-Linux");
#endif
#if wxUSE_UNICODE
wxbuild << _T("-Unicode build");
#else
wxbuild << _T("-ANSI build");
#endif // wxUSE_UNICODE
}
return wxbuild;
}
testFrame::testFrame(wxFrame *frame)
: GUIFrame(frame)
{
#if wxUSE_STATUSBAR
statusBar->SetStatusText(_("Hello Code::Blocks user!"), 0);
statusBar->SetStatusText(wxbuildinfo(short_f), 1);
#endif
}
testFrame::~testFrame()
{
}
void testFrame::OnClose(wxCloseEvent &event)
{
Destroy();
}
void testFrame::OnQuit(wxCommandEvent &event)
{
Destroy();
}
void testFrame::OnAbout(wxCommandEvent &event)
{
wxString msg = wxbuildinfo(long_f);
wxMessageBox(msg, _("Welcome to..."));
}
view raw test.cpp hosted with ❤ by GitHub