This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Ported to Python from http://www.vim.org/scripts/script.php?script_id=1349 | |
print "Color indexes should be drawn in bold text of the same color." | |
colored = [0] + [0x5f + 40 * n for n in range(0, 5)] | |
colored_palette = [ | |
"%02x/%02x/%02x" % (r, g, b) | |
for r in colored |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
let gamepad = null; | |
let loopInterval = null; | |
window.addEventListener("gamepadconnected", connectHandler); | |
window.addEventListener("gamepaddisconnected", disconnectHandler); | |
function connectHandler(e) { | |
if (!gamepad) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
let gamepad = null; | |
let loopInterval = null; | |
window.addEventListener("gamepadconnected", connectHandler); | |
window.addEventListener("gamepaddisconnected", disconnectHandler); | |
function connectHandler(e) { | |
if (!gamepad) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { h, Component } from 'preact'; | |
/** Creates a new store, which is a tiny evented state container. | |
* @example | |
* let store = createStore(); | |
* store.subscribe( state => console.log(state) ); | |
* store.setState({ a: 'b' }); // logs { a: 'b' } | |
* store.setState({ c: 'd' }); // logs { c: 'd' } | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.gist { | |
border-left: 3ex solid #eee; | |
position: relative; | |
} | |
.gist pre { | |
counter-reset: linenumbers; | |
} | |
.gist pre div:before { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var app = require('http').createServer(handler) | |
, io = require('socket.io').listen(app) | |
, fs = require('fs') | |
var mongo = require('mongodb'); | |
var d = new Date(); | |
var Server = mongo.Server, | |
Db = mongo.Db, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Simple Node JS and Socket IO Chat</title> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> | |
<script src="/socket.io/socket.io.js"></script> | |
<script> | |
var socket = io.connect('http://localhost:5432'); | |
// add a new chat message | |
socket.on('add_message', function (name, data) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a href="http://en.wikipedia.org/wiki/Lsof">lsof</a> | |
---- | |
show open files | |
lsof -nPp <pid> | |
<a href="http://linux.die.net/man/1/strace">strace</a> | |
------ |