Skip to content

Instantly share code, notes, and snippets.

View prettycode's full-sized avatar

Chris prettycode

  • Seattle, WA
View GitHub Profile
@richardszalay
richardszalay / Win10-16257-Console-Colors.reg
Created August 3, 2017 04:43
Applies the default console colors added in Windows 10 16256 (https://blogs.msdn.microsoft.com/commandline/2017/08/02/updating-the-windows-console-colors/) to older versions of Windows
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Console]
"ColorTable00"=dword:000c0c0c
"ColorTable01"=dword:00da3700
"ColorTable02"=dword:000ea113
"ColorTable03"=dword:00dd963a
"ColorTable04"=dword:001f0fc5
"ColorTable05"=dword:00981788
"ColorTable06"=dword:00009cc1
@prettycode
prettycode / submitForm.js
Last active December 16, 2015 07:49
Use this function to submit an HTML form without actually having a form on the page. Instead of an existing form, pass the function a *flat* JavaScript object with the form values to submit. This is a synchronous operation; the browser loads the response as its new window location. Requests with "Content-Type: application/x-www-form-urlencoded".
var submitForm = function(config) {
if (!config) {
throw new Error();
}
else {
config.method = config.method || 'post';
config.data = config.data || {};
config.url = config.url || (function() {
throw new Error('Missing required `url` argument');
@prettycode
prettycode / js2markup.htm
Last active December 16, 2015 06:49
Generate HTML from JavaScript object literals.
<!DOCTYPE html>
<html>
<head>
<title>Proof of Concept</title>
<script>
// TODO how should Arrays be handled?
// TODO strict mode (no '\n' or padding) to allow for significant whitespace (e.g. for <pre>, <textarea>)
var toHTML = function(value, name, indent) {
var pad = new Array((indent = indent || 0)).join(' ');
@futoase
futoase / gist:3922524
Created October 20, 2012 07:38
httpserver sample script
declare function require(name: string);
interface Http {
createServer(callback: (req: Request, res: Response) => any): CreateServer;
}
interface CreateServer {
listen(port?: number, host?: string);
}
interface Request {
url: string;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>My Framework</title>
</head>
<body>