Skip to content

Instantly share code, notes, and snippets.

@jewelsea
jewelsea / SimpleDocking.java
Created March 16, 2014 05:45
Simplistic docking setup for JavaFX
import javafx.application.Application;
import javafx.geometry.Orientation;
import javafx.scene.*;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.stage.*;
public class SimpleDocking extends Application {
public void start(final Stage stage) throws Exception {
final SplitPane rootPane = new SplitPane();
@nwinkler
nwinkler / pom.xml
Last active March 25, 2023 20:49
Combining the git-flow branching model and the Maven Release Plugin to play nice. Based on info found here: http://vincent.demeester.fr/2012/07/maven-release-gitflow/
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>group</groupId>
<artifactId>dummy</artifactId>
<name>Dummy Project</name>
<version>1.0.12</version>
<packaging>pom</packaging>
<scm>
<connection>scm:git:https://......</connection>
<tag>HEAD</tag>
@garyrussell
garyrussell / Main.java
Last active June 25, 2018 06:00
Quick Start
public class Main {
public static void main(String... args) throws Exception {
ApplicationContext ctx = new ClassPathXmlApplicationContext("context.xml");
// simple service
TempConverter converter = ctx.getBean("gw1", TempConverter.class);
System.out.println(converter.fahrenheitToCelcius(68.0f));
// web service
converter = ctx.getBean("gw2", TempConverter.class);
System.out.println(converter.fahrenheitToCelcius(68.0f));
@dkstar88
dkstar88 / uImageLoader.pas
Created July 23, 2013 06:43
A ImageLoader for FireMonkey TImage component. I written this when I found I need to load a few images from the Internet. Obviously delphi isn's browser, if I just call download using Indy it will just block my app's UI. ImageLoader is very simple class with a loading queue, and a timer to trigger the work on the queue. You just need to call the…
unit uImageLoader;
interface
uses SysUtils, Classes, System.Generics.Collections,
FMX.Types, FMX.Objects, FMX.Controls, AsyncTask, AsyncTask.HTTP;
type
TLoadQueueItem = record
ImageURL: String;
@scturtle
scturtle / maildog.pyw
Last active December 8, 2018 04:42
a mail checker on the system tray (pyqt)
# coding: utf-8
import logging
import os, sys, json
from PyQt4 import QtGui
from PyQt4.QtCore import QTimer
import imaplib, StringIO, rfc822
from email.Header import decode_header
_config = json.load(open('config.json')) # server, user, pasw
locals().update(_config)
@fabriciocolombo
fabriciocolombo / gist:4279304
Created December 13, 2012 20:00
Capturing console output with Delphi
//Anonymous procedure approach by Lars Fosdal
type
TArg<T> = reference to procedure(const Arg: T);
procedure TForm1.CaptureConsoleOutput(const ACommand, AParameters: String; CallBack: TArg<PAnsiChar>);
const
CReadBuffer = 2400;
var
saSecurity: TSecurityAttributes;
hRead: THandle;
@madan712
madan712 / ReadWriteExcelFile.java
Created October 18, 2012 14:35
Read / Write Excel file (.xls or .xlsx) using Apache POI
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Iterator;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
@ser1zw
ser1zw / dragdrop.ps1
Created March 22, 2012 17:48
PowerShell Drag & Drop sample
# PowerShell Drag & Drop sample
# Usage:
# powershell -sta -file dragdrop.ps1
# (-sta flag is required)
#
Function DragDropSample() {
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$form = New-Object Windows.Forms.Form
$form.text = "Drag&Drop sample"
$listBox = New-Object Windows.Forms.ListBox
@mvaz
mvaz / dump_oracle.py
Created March 18, 2012 21:27
Dump Oracle db schema to text
# http://code.activestate.com/recipes/576534-dump-oracle-db-schema-to-text/
#!/usr/bin/env python
# -*- coding: utf8 -*-
__version__ = '$Id: schema_ora.py 928 2012-01-12 19:09:34Z tt $'
# export Oracle schema to text
# usable to compare databases that should be the same
#
@pazdera
pazdera / builder.cpp
Created August 2, 2011 20:33
Example of `builder' design pattern in C++
/*
* Example of `builder' design pattern.
* Copyright (C) 2011 Radek Pazdera
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,