Skip to content

Instantly share code, notes, and snippets.

I have an index.html loading kinetic-v3.8.3.js, hexlib.js and perspective.js in that order
I am trying to segregate the mathematics of a hex grid in my hexlib.js file, while keeping the code to draw hexes in perspective.js
I am trying to access a function that is defined in hexlib.js from perspective.js but I have screwed it up. Here is the trace yielded by Firebug:
error in perspective.js (line 33)
Sexy is not defined
[Break On This Error]
JReviews user form creation problem
I'm debugging a Joomla site that uses JReviews to store user reviews. The JReviews code has apparently been modified into a broken state.\
User forms are not being saved to the database when the user clicks Submit at the bottom of the form. I'm not sure if the server is receiving the data.
I'm using JReviews 2.3.12.203 and PHP 1.5. Unfortunately I'm running on godaddy hosting so I don't have access to php console error logs.
Details:
@therealplato
therealplato / nano_.js
Created June 4, 2012 16:57
leading underscore in documents fails nano's validation
nano = require('nano')('http://localhost:5984');
nano.db.create('underscore', function(err){
data = {foo:'bar', _ISNEW:true};
couchdb = nano.use('underscore');
couchdb.insert(data, function(err,body) {
console.log('err:\n'+err+'\nbody:\n'+body);
console.log('JSON.stringify(err):\n'+JSON.stringify(err,null,2));
});
});
// Example code by plato demonstrating fs and async
// Before running this: Create a file foo.txt in the same directory as this
// Additionally, run npm install async
var async = require('async');
var fs = require('fs');
handleimg = function(callback){
var raft={}; // to float down the waterfall
raft.meta = {size:50, name:"foo.txt"};
async.waterfall(
@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
/*
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
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

@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

@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"