Skip to content

Instantly share code, notes, and snippets.

@eric2323223
eric2323223 / gist:3615714
Created September 4, 2012 02:03
Sample persistence: hibernate
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
<persistence-unit name="ApplicationEntityManager" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>org.appfuse.model.Car</class>
<class>org.appfuse.model.Role</class>
<!--
Adding more <class>f.q.c.Name</class> elements here is not required.
@eric2323223
eric2323223 / applicationContext.xml
Created September 4, 2012 02:11
Sample spring embedded database configuration
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
">
import javax.sql.DataSource;
import org.apache.commons.dbcp.BasicDataSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class ContextConfiguration {
@Bean
public DataSource dataSource() {
@eric2323223
eric2323223 / persistenceJpaConfig.xml
Created September 4, 2012 02:18 — forked from eugenp/persistenceJpaConfig.xml
Transaction configuration with Spring 3.1 - the transaction Configuration in XML
<bean id="txManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="myEmf" />
</bean>
<tx:annotation-driven transaction-manager="txManager" />
@eric2323223
eric2323223 / applicationContext-with-sharedentitymanagerbean.xml
Created September 4, 2012 02:34 — forked from rponte/applicationContext-with-sharedentitymanagerbean.xml
configuring SharedEntityManagerBean in applicationContext.xml
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
...
</bean>
<bean id="entityManager"
class="org.springframework.orm.jpa.support.SharedEntityManagerBean">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
@eric2323223
eric2323223 / Description
Created September 4, 2012 03:29 — forked from twasink/Description
Spring, JPA, HSQLDB and automatically creating tables
Same as the earlier gist, but with JPA wrapping hibernate. Note that the choice of wether to create the tables or not is in the spring-config file, NOT the persistence.xml file like a lot of other examples out there.
@eric2323223
eric2323223 / README.md
Last active August 29, 2015 14:16 — forked from marcbc/README.md

Playing with D3.js to get a drill down behavior for a hierarchical data collection represented in pie charts. See live example

@eric2323223
eric2323223 / remind.py
Created December 7, 2015 11:12 — forked from renfredxh/remind.py
Set reminders via OSX terminal
#!/usr/local/bin/python3
# Make a new reminder via terminal script
# args: remind <title> <date> <time>
# example: remind clean 12/10/2012 10:00:00PM
import subprocess
import sys
from datetime import datetime, timedelta
# A apple script that creates a new reminder given a name date and time
OSASCRIPT = ('<<END\n'
@eric2323223
eric2323223 / New reminder from Launchbar
Created December 7, 2015 11:50 — forked from mlgill/New reminder from Launchbar
A script for quickly adding reminders to the Reminders app in Mountain Lion from Launchbar and Alfred. Save this as a .scpt and drop it in ~/Library/Application\ Support/LaunchBar/Actions
--Script for setting Reminders for LaunchBar and Alfred
--For Alfred, Applescript must NOT be set to run in Background otherwise date parsing does not work
--For LaunchBar, place the script in ~/Library/Scripts/LaunchBar
--by Michelle L. Gill, 10/07/2012
--Inspired by https://gist.github.com/3187630
--A related Alfred version 2 workflow can be found here: https://github.com/mlgill/alfred-workflow-create-reminder
--Changes
--02/01/2013 * Fixed an issue with setting the time when the hour is 12 and AM/PM (12-hour clock) is used
-- * Removed the ability to set seconds for the time since Reminders doesn't recognize them
@eric2323223
eric2323223 / 0_reuse_code.js
Created February 23, 2016 12:46
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console