Skip to content

Instantly share code, notes, and snippets.

View ericbets's full-sized avatar

ericbets

View GitHub Profile
CREATE or REPLACE function insert_user(email TEXT, OUT success BOOLEAN)
AS $$
BEGIN
EXECUTE 'INSERT into users (email) VALUES ($1)' USING email;
success:=true;
EXCEPTION WHEN OTHERS THEN
success:=false;
return;
END;
$$ LANGUAGE plpgsql volatile;
$ node peer.js
I[11-18|00:31:45.641] Executed block module=state height=1 validTxs=0 invalidTxs=0
I[11-18|00:31:45.645] Committed state module=state height=1 txs=0 hash=618DE7D9F46F3F697D827A1B6D84974760D5DEDA62E4E592ADAA3C646602A94C
I[11-18|00:31:45.652] Executed block module=state height=2 validTxs=0 invalidTxs=0
I[11-18|00:31:45.655] Committed state module=state height=2 txs=0 hash=618DE7D9F46F3F697D827A1B6D84974760D5DEDA62E4E592ADAA3C646602A94C
I[11-18|00:31:45.661] Executed block module=state height=3 validTxs=0 invalidTxs=0
I[11-18|00:31:45.663] Committed state module=state height=3 txs=0 hash=618DE7D9F46F3F697D827A1B6D84974760D5DEDA62E4E592ADAA3C646602A94C
I[11-18|00:31:45.670] Executed block module=state height=4 validTxs=0 invalidTxs=0
I[11-18|00:31:45.713] Committed state
$ node app.js
I[11-18|00:31:17.453] Executed block module=state height=1 validTxs=0 invalidTxs=0
I[11-18|00:31:17.456] Committed state module=state height=1 txs=0 hash=618DE7D9F46F3F697D827A1B6D84974760D5DEDA62E4E592ADAA3C646602A94C
I[11-18|00:31:18.458] Executed block module=state height=2 validTxs=0 invalidTxs=0
I[11-18|00:31:18.460] Committed state module=state height=2 txs=0 hash=618DE7D9F46F3F697D827A1B6D84974760D5DEDA62E4E592ADAA3C646602A94C
I[11-18|00:31:19.464] Executed block module=state height=3 validTxs=0 invalidTxs=0
I[11-18|00:31:19.467] Committed state module=state height=3 txs=0 hash=618DE7D9F46F3F697D827A1B6D84974760D5DEDA62E4E592ADAA3C646602A94C
I[11-18|00:31:20.470] Executed block module=state height=4 validTxs=0 invalidTxs=0
I[11-18|00:31:20.472] Committed state
/**
* React Static Boilerplate
* https://github.com/kriasoft/react-static-boilerplate
*
* Copyright © 2015-present Kriasoft, LLC. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
@ericbets
ericbets / urlcache-spec.txt
Created January 27, 2017 00:12
A better way to do caching
UrlCache spec: (for people that hate Appcache) (See here: http://alistapart.com/article/application-cache-is-a-douchebag for a cautionary tale about complexity around caching.)
By Eric (eric@gregarious.com.au)
Let's say you have a file.png that you want the browser to know with perfect knowledge if a file has changed on the server or not, and you want it to be backwards compatible with the existing web, without using a complex http header based scheme:
It's url should be: http://example.org/urlcache/hashalg/hash.mimeext
eg. http://example.org/urlcache/sha512/9b78b27b73668784e38c8a58a8535deaaecb777093cbbaeba706631d5fcd39bb0aa101c1a6adb54743139ed100e2ca97611469f7d895fe01ecbbce8869bb2f36.png
The benefits of this approach are as follows.
-It's more accessible for users than using http headers. Therefore it will be more widely used.
[webapp 2013/02/06 09:44:31] - Exception while dispatching incoming RPC call
com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract servlets.project.shared.CustomerBundle servlets.project.client.CustomerService.getCustomerBundle()' threw an unexpected exception: java.lang.IllegalAccessError: tried to access method com.google.common.collect.MapMaker.expireAfterWrite(JLjava/util/concurrent/TimeUnit;)Lcom/google/common/collect/MapMaker; from class com.netflix.astyanax.thrift.ThriftKeyspaceImpl
at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:385)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:588)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
at javax.servlet.http.HttpServlet.se
$ mvn -e -X clean install -Dbuildtype=dev -Dopenaccess-security -DskipTests=true -Dmaven.test.skip=true
Apache Maven 3.0.4 (rNON-CANONICAL_2012-11-09_15-39_mockbuild; 2012-11-10 01:39:59+1000)
Maven home: /usr/share/maven
Java version: 1.7.0_09-icedtea, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.7.2-204.fc18.x86_64", arch: "amd64", family: "unix"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from /usr/share/maven/conf/settings.xml
[DEBUG] Reading user settings from /home/awhite/.m2/settings.xml
$ mvn -e clean install -Dbuildtype=dev -Dopenaccess-security -DskipTests=true -Dmaven.test.skip=true
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Eureka Streams Parent
[INFO] Eureka Streams Server
[INFO] Eureka Streams Shared Resources
[INFO] Eureka Streams Task Queue Processor
<name>University of California, San Diego</name>
<lat>32.87606</lat>
<lon>-117.2354</lon>
<link>http://ucsd.edu</link>
<logo>http://upload.wikimedia.org/wikipedia/en/4/42/UCSD_Seal.svg</logo>
<wikipedialink>http://en.wikipedia.org/wiki/University_of_California,_San_Diego</wikipedialink>
<description>The University of California, San Diego (also referred to as UC San Diego or UCSD) is a public research university located in La Jolla, California, United States.</description>
<categories><category>Association of American Universities</category></categories>
<name>University of California, San Diego</name>
<coords>32.87606, -117.2354</coords>
<link>http://ucsd.edu</link>
<logo>http://upload.wikimedia.org/wikipedia/en/4/42/UCSD_Seal.svg</logo>
<categories>...</categories>