Skip to content

Instantly share code, notes, and snippets.

View euoia's full-sized avatar

James Pickard euoia

  • https://www.greendragonbungay.co.uk
  • Bungay, Suffolk, England
View GitHub Profile
function! Test()
endfunction
unmap <S-J>
nnoremap <S-J> :silent call Test()<cr>
let s:plugin_root_dir = expand("<sfile>:h")
function JsBeautifySimple () range
let s:plugin_lib_dir = s:plugin_root_dir . "/lib/"
if exists("g:JsBeautifySimple_engine")
let s:engine = g:JsBeautifySimple_engine
else
let s:engine = "node"
endif
~|⇒ node
> var net = require ('net');
undefined
> var socket = net.createConnection(8888, 'localhost', function () { socket.write ('hello', 'ascii') });
undefined
> socket.setEncoding('utf8');
undefined
> socket.setEncoding('utf-8');
undefined
> socket.setEncoding('utf-asdqa8');
@euoia
euoia / gist:5190711
Last active December 15, 2015 02:59
var http = require('http');
var httpProxy = require('http-proxy');
var proxyOptions = {
pathnameOnly: true,
router: {
'/app': 'localhost:3000',
'/accounts': 'localhost:8001'
}
}
http-proxy|⇒ curl -I http://localhost:3001/app
HTTP/1.1 500 Internal Server Error
Content-Type: text/plain
Date: Mon, 18 Mar 2013 21:51:13 GMT
Connection: keep-alive
http-proxy|⇒ curl -I http://localhost:3001/not-a-route
HTTP/1.1 404 Not Found
Date: Mon, 18 Mar 2013 21:51:16 GMT
Connection: keep-alive
/tmp/redstone.js|29 warning| missing semicolon
/tmp/redstone.js|33 warning| comparisons against null, 0, true, false, or an empty string allowing implicit type conversion (use === or !==)
/tmp/redstone.js|60 warning| missing semicolon
/tmp/redstone.js|61 warning| comparisons against null, 0, true, false, or an empty string allowing implicit type conversion (use === or !==)
/tmp/redstone.js|62 warning| comparisons against null, 0, true, false, or an empty string allowing implicit type conversion (use === or !==)
/tmp/redstone.js|63 warning| comparisons against null, 0, true, false, or an empty string allowing implicit type conversion (use === or !==)
/tmp/redstone.js|69 warning| redeclaration of var more
/tmp/redstone.js|69 warning| comparisons against null, 0, true, false, or an empty string allowing implicit type conversion (use === or !==)
/tmp/redstone.js|80 warning| missing semicolon
/tmp/redstone.js|114 warning| missing semicolon
@euoia
euoia / comments-formatting
Created November 4, 2013 11:50
Formatting options in Vim for TODOs in comments
In my comments I have this:
// TODO: I found it hard to find tutorials or guides for how to use superagent
// session cookies with socket.io. This is required because session data is
// retrieved even on socket.io requests (due to session.socket.io). If I get
// this working, I ought to write it up publicly.
I would like to be able to select the text, format paragraph using gq, and get this:
// TODO: I found it hard to find tutorials or guides for how to use superagent
// session cookies with socket.io. This is required because session data is
// retrieved even on socket.io requests (due to session.socket.io). If I get
<VirtualHost *>
ServerName www.multiplayergorillas.com
ServerAlias multiplayergorillas.com
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /socket.io/1/websocket ws://localhost:3000/socket.io/1/websocket
@euoia
euoia / socket.io-server
Last active August 29, 2015 13:56
Simple socket.io server example
var Socketio = require('socket.io'),
http = require('http');
var port = 3000;
// Create the HTTP server.
var server = http.createServer().listen(port, function() {
console.log("HTTP server listening on port %d.", port);
});
@euoia
euoia / gist:9399242
Created March 6, 2014 20:42
Make long pieces of text wrap
a, p {
white-space: pre; /* CSS 2.0 */
white-space: pre-wrap; /* CSS 2.1 */
white-space: pre-line; /* CSS 3.0 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
white-space: -moz-pre-wrap; /* Mozilla */
white-space: -hp-pre-wrap; /* HP Printers */
word-wrap: break-word; /* IE 5+ */
}