Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@repomaa
repomaa / fetchnews4kindle.sh
Created April 29, 2012 13:53
Fetches news from calibre recipes and sends them to your kindle. Cronjobbable.
#!/bin/sh
# ----------------------------------------------------------------------------
# Written by Joakim Reinert <http://digital-adventures.de>
# (c) 2012 Joakim Reinert under GNU GPL v3.0+
# Last updated on: Apr/29/2012 by Joakim Reinert
# ----------------------------------------------------------------------------
# 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.
package logic;
import java.lang.reflect.InvocationTargetException;
import java.util.HashSet;
public class TileFactory<T extends AbstractTile> {
private TilesSet<T> tiles;
private Class<T> clazz;
public TileFactory(Class<T> clazz) {
@repomaa
repomaa / graph.dot
Created July 2, 2012 19:24
A graph
digraph G {
D [shape="circle"];
A [shape="circle"];
S [shape="circle"];
C [shape="circle"];
B [shape="circle"];
E [shape="circle"];
root=S;
S -> A [weight="1",label="1"];
S -> B [weight="2",label="2"];
@repomaa
repomaa / newgraph.dot
Created July 2, 2012 20:30
New graph
digraph G {
B [shape="circle"];
A [shape="circle"];
D [shape="circle"];
C [shape="circle"];
E [shape="circle"];
S [shape="circle"];
root=S;
S -> A [label="1"];
S -> B [label="2"];
@repomaa
repomaa / Gui.java
Created July 9, 2012 00:33
Gui for adding and searching ingredients
package gui;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.Vector;
@repomaa
repomaa / food.php
Created July 9, 2012 12:58
Simple api code for food database access
<?php
if (isset($_POST['api_key']))
$api_key = $_POST['api_key'];
else
send_error_response('You need to provide your api key');
if (isset($_POST['api_sig']))
$api_sig = $_POST['api_sig'];
else
send_error_response('You need sign your calls');
if (isset($_POST['session']))
SQL: [223] INSERT INTO food (name, carbs, fat, protein, alcohol, serving, serving_type, category, api_key, hash, brand)
VALUES(:name, :carbs, :fat, :protein, :alcohol, :serving, :serving_type, :category, :api_key, :hash, :brand)
Params: 11
Key: Name: [9] :category
paramno=-1
name=[9] ":category"
is_param=1
param_type=1
Key: Name: [13] :serving_type
paramno=-1
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------+-------------------------------------------------
<?php
$host = 'localhost';
$user = 'bla';
$pass = 'bla';
$db = 'opendiet';
if (isset($_POST['api_key']))
$api_key = $_POST['api_key'];
else
send_error_response('You need to provide your api key');
2012-07-16 20:20:50 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /home/jokke/workspace/OpenDiet/AndroidManifest.xml: Markup im Dokument nach dem Root-Element muss ordnungsgemäß formatiert sein.
[2012-07-16 20:20:50 - OpenDiet] Error in an XML file: aborting build.