Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Gabes Mak pixelbreaker

🏠
Working from home
Block or report user

Report or block pixelbreaker

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pixelbreaker
pixelbreaker / cors.js
Created Feb 9, 2016
Node Express cors proxy route
View cors.js
var request = require('request');
app.all(/^\/cors\/(.*)$/, function (req, res, next) {
// Set CORS headers: allow all origins, methods, and headers: you may want to lock this down in a production environment
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Methods", "GET, PUT, PATCH, POST, DELETE");
res.header("Access-Control-Allow-Headers", req.header('access-control-request-headers'));
if (req.method === 'OPTIONS') {
// CORS Preflight
@pixelbreaker
pixelbreaker / example.js
Last active Mar 2, 2017
PouchDB image cache
View example.js
import ImageCache from './image-cache.js'
var imageCache = new ImageCache();
var img = $(el).find('img');
imageCache.loadImage(img[0], img.attr('src'));
@pixelbreaker
pixelbreaker / leaflet-bing-ordnance-survey.js
Last active Nov 3, 2015 — forked from alexnorton/leaflet-bing-ordnance-survey.js
Use Bing Maps Ordnance Survey tiles as a Leaflet TileLayer
View leaflet-bing-ordnance-survey.js
var BingLayer = L.TileLayer.extend({
getTileUrl: function (tilePoint) {
this._adjustTilePoint(tilePoint);
return L.Util.template(this._url, {
s: this._getSubdomain(tilePoint),
q: this._quadKey(tilePoint.x, tilePoint.y, this._getZoomForUrl())
});
},
_quadKey: function (x, y, z) {
var quadKey = [];
View gist:3810631
1 Oct 10:52:00 - Starting server on port: 8001
[2012-10-01 10:52:00.323] [INFO] main - PushSocket listening on httpServer with 2 transports
[2012-10-01 10:52:00.335] [INFO] main - ResourceStreamClient connecting to: http://localhost:5001/api/v1
File "compiledjs/modules/modal_dialogs.js" created.
[2012-10-01 10:52:00.352] [INFO] main - ResourceStreamClient connection failed to: http://localhost:5001/api/v1
[2012-10-01 10:52:00.354] [INFO] main - Reconnecting stream for http://localhost:5001/api/v1 in 1ms
[2012-10-01 10:52:00.355] [INFO] main - Reconnecting stream for http://localhost:5001/api/v1 now
[2012-10-01 10:52:00.366] [INFO] main - ResourceStreamClient connection failed to: http://localhost:5001/api/v1
[2012-10-01 10:52:00.366] [INFO] main - Reconnecting stream for http://localhost:5001/api/v1 in 2ms
[2012-10-01 10:52:00.377] [INFO] main - Reconnecting stream for http://localhost:5001/api/v1 now
@pixelbreaker
pixelbreaker / gist:3742614
Created Sep 18, 2012
Error on asset conversion
View gist:3742614
Error handling request: HTTPError: 500 Internal Server Error
Error uploading file to the Asset Server (unknown_error)
at Class.<anonymous> (/Users/gabriel/Work/dharmafly/DRUM/drum/collaboration-api/lib/upload_server.coffee:91:27)
at Class.emit (events.js:67:17)
at respond (/Users/gabriel/Work/dharmafly/DRUM/drum/collaboration-api/node_modules/drum-asset-converter/lib/model/baseConverterClass.js:66:13)
at Object._onTimeout (/Users/gabriel/Work/dharmafly/DRUM/drum/collaboration-api/node_modules/drum-asset-converter/lib/model/baseConverterClass.js:92:31)
at Timer.ontimeout (timers.js:94:19)
View gist:3634949
$ ./script/start --watch --debug --deploy
Error: Cannot find module './daemon.v0.6.16'
at Function._resolveFilename (module.js:332:11)
at Function._load (module.js:279:25)
at Module.require (module.js:354:17)
at require (module.js:370:17)
at Object.<anonymous> (/Users/gabriel/Work/dharmafly/DRUM/drum/node_modules/forever/node_modules/daemon/lib/daemon.js:12:11)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
at Module.load (module.js:348:31)
You can’t perform that action at this time.