Skip to content

Instantly share code, notes, and snippets.

To use Webster's 1913 dictionary on Android, install Colordict 3, an app that accepts this StarDict format. https://play.google.com/store/apps/details?id=com.socialnmobile.colordict

Next download James's S3 archive. https://s3.amazonaws.com/jsomers/dictionary.zip

You will need to extract the .dict file from inside three containers - .dz, .tar, .bz2 from innermost to outermost. 7zip handles all of these formats.

Place the .dict, .idx and .ifo files in the dictdata directory on your sdcard or local storage root. This is where colordict looks for dictionaries.

When the files are in the right place, you can run Colordict and tap the folder icon in the top right to see the dictionaries installed and set the dictionary priority. I put the 1913 dictionary above the defaults "Wordnet" and "Wikipedia." When you look up a word, ColorDict shows the definition, if available, from these multiple sources.

@therealplato
therealplato / stack-auth-bounce.js
Created December 17, 2013 00:38
Bouncing a user back to their last place after authentication with Express 3
// Bouncing a user back to their last place after authentication with Express 3
// To accompany http://stackoverflow.com/a/12443844/1380669
// by therealplato
var express = require('express');
var app = express();
require('http').createServer(app).listen(3000
, function(err){
console.log(err || "Listening on 3000");
});
// custom error handler
app.use(function (err, req, res, next) {
if (err.message
&& (~err.message.indexOf('not found')
|| (~err.message.indexOf('Cast to ObjectId failed')))) {
return next()
}
console.error(err.stack)
res.status(500).render('500')
@therealplato
therealplato / gist:6346624
Created August 26, 2013 21:03
express error handling middleware
// example based on @AriPorad Expressjs - All Routes Are 404
// http://stackoverflow.com/questions/18406591/expressjs-all-routes-are-404/18407658#18407658
// custom error handler
// put this at the end of your middleware chain and handle errors however you want
app.use(function (err, req, res, next) {
if (err.message
&& (~err.message.indexOf('not found')
|| (~err.message.indexOf('Cast to ObjectId failed')))) {
res.status(404).render('404', { url: req.originalUrl })
@therealplato
therealplato / gist:5954112
Created July 9, 2013 02:06
google places result - `details.opening_hours`
// Output for this code:
// http://stackoverflow.com/a/17538819/1380669
// Output for a restaurant with 7 periods
{
"open_now": true,
"periods": [
{
"close": {
"day": 2,
"time": "0000"

@Gavin Andresen says:

There is a non-voluntary, hard-to-change, 1,000,000-bytes-of-transactions-per-block limit that needs to be raised.

And there is… uhh, “vigorous”… debate over when and how to change it.

I wasn't aware this was up for change. I was surprised that Gavin says we need to change the block size cap. As Gavin is the lead dev, what Gavin says arguably goes and I hope he is making his decisions with the fullest possible

var url = 'https://dominion.isotropic.org/gamelog/201302/24/game-20130224-103117-6c8c2cb8.html';
var regex = /^https?:\/\/dominion\.isotropic\.org\/gamelog\/\d*\/\d\d\/game\-(\d*)\-([^.]*)\.html$/;
var result = url.match(regex);
//console.log(result);
if(result){
console.log('date: '+result[1]);
console.log('id: '+result[2]);
};
/* Annotated
/*
To size fonts we have to take into account the screen width and pixel density.
Assorted screen sizes and pixels per inch:
x_px y_px PPI
-----------------
G1 320 480 180
Nexus S 480 800 233
Iphone 4S 640 960 326
Iphone 5 640 1136 326
Ipad 2 768 1024 132
/*
To size fonts we have to take into account the screen width and pixel density.
Assorted screen sizes and pixels per inch:
x_px y_px PPI
-----------------
G1 320 480 180
Nexus S 480 800 233
Iphone 4S 640 960 326
Iphone 5 640 1136 326
Ipad 2 768 1024 132
@therealplato
therealplato / plato-mediaquery.css
Created February 6, 2013 17:52
pixel density media query problem
/*
To size fonts we have to take into account the screen width and pixel density.
Assorted screen sizes and pixels per inch:
x_px y_px PPI
-----------------
G1 320 480 180
Nexus S 480 800 233
Iphone 4S 640 960 326
Iphone 5 640 1136 326
Ipad 2 768 1024 132