Listing GitHub projects in your blog

    Posted by Rogério Carvalho Schneider
    15 Aug 2009

    I needed to list my GitHub projects in a fancy way inside my blog, in the sidebar, all dynamically done. So, I searched a little around and found how.

    There are two major badges to do it, here I will describe them:

    Dr Nic’s github-badges

    This is my choice. drnic’s github-badges is flexible on configuration and also have some code of myself in it.

    Here is how to configure it:

    <div id="github-badge"></div>
    <script type="text/javascript" charset="utf-8">
      GITHUB_USERNAME="stockrt";
    </script>
    <script src="http://drnic.github.com/github-badges/dist/github-badge-launcher.js" type="text/javascript"></script>

    This is the complete list of options available:

    GITHUB_USERNAME = "stockrt";
    GITHUB_LIST_LENGTH = 10;
    GITHUB_HEAD = "div"; // e.g. change to "h2" for wordpress sidebars
    GITHUB_THEME = "white"; // try 'black'
    GITHUB_TITLE = "My projects";
    GITHUB_SHOW_ALL = "Show all";
    GITHUB_SHOW_FORK = 1;

    subtleGradient’s mootools-github-badge:

    This is also pretty neat, subtleGradient’s mootools-github-badge has a great visual effect when it is building the project’s list, using a delayed composal. See this running example.

    Here is how to configure it:

    <div id="github-badge"></div>
    <script src="http://ajax.googleapis.com/ajax/libs/mootools/1.2.1/mootools.js" type="text/javascript"> </script>
    <script src="http://projects.subtlegradient.com/mootools-subtle-templates/Source/Plugins/SubtleTemplate.js" type="text/javascript"> </script>
    <script src="http://subtlegradient.github.com/mootools-github-badge/mootools-github-badge.js" type="text/javascript"> </script>
    <script type="text/javascript" charset="utf-8">
      new SubtleTemplate.GitHubBadge.Basic({ username:'stockrt' });
    </script>

    Using jekyll and scribbish from stockrt’s site source

    If you are using my template to generated a scribbish styled static site with jekyll (pt-BR), all you need to do to activate the use of drnic’s github-badge is to configure this parameters in config.yml:

    github_badge:
        enable: true
        username: stockrt
        length: 8
        head: div
        #head: h2
        theme: white
        #theme: black
        title: My Projects
        showall: Show all
        showfork: 0
        #showfork: 1

    All said, I must warn you that these two badges do not really behave well on IE 6, but who still uses it today? Better upgrade to Firefox, folks!

    Favorites View Comments

    Como converter datas e timestamps no linux usando o comando date

    Posted by Rogério Carvalho Schneider
    02 Aug 2009

    Se você chegou até aqui, anote esta dica.

    Uma hora ou outra a gente sempre chega neste problema: Converter datas com timestamp, seja de timestamp para string ou o contrário.

    Pois ai vai a dica para converter datas no Linux:

    String da data atual

    $ date
    Sun Aug  2 03:13:19 2009

    Timestamp (seconds from the Epoch) da data atual

    $ date +"%s"
    1249193599

    Timestamp de uma determinada string de data

    $ date -d '2009-07-31 12:00:01' +"%s"
    1249052401

    String de data a partir de um determinado timestamp

    $ python -c "import time; print time.ctime(1249052401)"
    Fri Jul 31 12:00:01 2009
    Favorites View Comments

    Iniciando um blog no GitHub

    Posted by Rogério Carvalho Schneider
    19 Jul 2009

    Use jekyll, facilita a sua vida.

    Estou usando o GitHub para hospedar meu blog/site, mas como ele não oferece nenhuma engine dinâmica de blog, tipo wordpress ou alguma outra feita em php, python, ruby…, estou gerando o site estaticamente e depois faço o upload para o GitHub. Uso jekyll para gerar o site, criar as co-relações entre posts, fazer a formatação, paginação, lista de tags, links e blogroll.

    Jekyll é muito legal, vale a pena dar uma olhada. Com esse modelo de geração estática é possível se fazer posts com apenas alguns passos:

    cd yournickname.github.com/site
    ./new_post.sh "Nome do post"
    vi _posts/$(date +"%Y-%m-%d")-nome-do-post.markdown
    ./build.sh; cd ..
    git add .
    git commit -a -m 'New blog post'
    git push origin master

    Eu gosto dessa forma de “bloggar” pois assim evito de entrar em editores HTML ou páginas web lentas. Faço tudo daqui do meu shell mesmo, onde me sinto mais à vontade :)

    A formatação dos textos é feita usando markdown, bem mais fácil do que HTML para postar da forma como escolhi, pelo shell.

    Recomendo ler um pequeno texto que fiz informando sobre como usar o template para jekyll que eu modifiquei:

    http://github.com/stockrt/stockrt.github.com/tree/master

    Outra dica: No link Projects ao lado você poderá encontrar algo útil. Se sim, me avisa.

    Favorites View Comments
    Next Entries »