Skip to content

Instantly share code, notes, and snippets.

@juniorz
juniorz / import.rb
Created January 5, 2012 10:15 — forked from ngauthier/import.rb
Import a blogger archive to jekyll (octopress version)
require 'rubygems'
require 'nokogiri'
require 'fileutils'
require 'date'
require 'uri'
# usage: ruby import.rb my-blog.xml
# my-blog.xml is a file from Settings -> Basic -> Export in blogger.
data = File.read ARGV[0]
@juniorz
juniorz / OpenXtextProjectWizard.java
Created July 18, 2011 00:04
Open Xtext Project Wizard Action
package org.eclipse.amalgam.tutorials.cheatsheets.xtext.actions;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.cheatsheets.ICheatSheetAction;
import org.eclipse.ui.cheatsheets.ICheatSheetManager;
@juniorz
juniorz / install_postgis_osx.sh
Created July 14, 2011 03:49
Installing PostGIS on Mac OS X and Ubuntu
# Some good references are:
# http://russbrooks.com/2010/11/25/install-postgresql-9-on-os-x
# http://www.paolocorti.net/2008/01/30/installing-postgis-on-ubuntu/
# http://postgis.refractions.net/documentation/manual-1.5/ch02.html#id2630392
#1. Install PostgreSQL postgis and postgres
brew install postgis
initdb /usr/local/var/postgres
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
@juniorz
juniorz / deploy.rb
Created July 11, 2011 22:35
Configuração de exemplo para o Capistrano
#Vendoriza as gems automatizamente usando o Bundler
require "bundler/capistrano"
default_run_options[:pty] = true
ssh_options[:forward_agent] = true # Permite que o deploy use minhas chaves ssh
#Aplicação
set :application, "mytestapp" #nome da aplicação
#Os endereços dos diferentes servidores envolvidos no deployment
role :web, "mytestapp.reinaldojunior.net"
@juniorz
juniorz / SimpleWIzard.droid
Created June 28, 2011 22:09
Simple Wizard example
application "SimpleWizard" => org.android.example.wizard {
screen First {
# textView: "This is the first screen" {}
# button: "Next >" to Second {}
}
screen Second {
# textView: "And this is the second screen" {}
# button: "< Back" to First {}
# button: "Next >" to Third {}
@juniorz
juniorz / RelativeLayout.droid
Created May 30, 2011 01:52
Hello Views (Relative Layout) using Droid DSL
/*
* Relative Layout Example
* Based on: http://developer.android.com/resources/tutorials/views/hello-relativelayout.html
*/
application "Hello, Android!" com.example.android.hellodroid {
activity HelloDroid {
=> show main
}
@juniorz
juniorz / LinearLayout.droid
Created May 30, 2011 01:51
Hello Views (Linear Layout) using Droid DSL
/*
* HelloViews (Linear Layout)
* Based on: http://developer.android.com/resources/tutorials/views/hello-linearlayout.html
*/
application "Hello, Android!" => com.example.android.hellodroid {
screen HelloDroid {
# linear layout {
orientation: vertical;
@juniorz
juniorz / HelloWorld.droid
Created May 30, 2011 00:41
Hello World using the Droid DSL
/*
* HelloWorld Example
* Based on: http://developer.android.com/resources/tutorials/hello-world.html
*/
application "Hello, Android!" => com.example.android.hellodroid {
string hello = "Hello, Android! I am a string resource!"
screen HelloDroid {
# textView: @string hello
@juniorz
juniorz / D.h
Created April 21, 2011 12:37
Como evitar multiplas inclusões de um cabeçalho (C/C++)
/*
Ao usar o ifndef (if not defined) o pre-processador só vai inserir o texto dentro do ifndef
se a constante __D_HEADER__ (deve ser uma constante unica, por isso os __ antes e depois) não estiver definida =D
*/
#ifndef __D_HEADER__
#define __D_HEADER__
/* Assinatura das funções de D.h */
#endif
@juniorz
juniorz / documentation.patch
Created April 5, 2011 02:15
my first GSoC task
diff --git a/html/toc.html b/html/toc.html
index 326f0a9..663970f 100644
--- a/html/toc.html
+++ b/html/toc.html
@@ -8,6 +8,7 @@
<body>
<h1>Table of Contents</h1>
-Please enter your text here.
+Please enter your text here,