Skip to content

Instantly share code, notes, and snippets.

@grayrest
grayrest / gist:c2e5f4ef498feb87d9ca91684ba2004a
Created January 27, 2018 22:00
Space key as right opt in Terminal
{
"title": "Change spacebar",
"rules": [
{
"description": "Change spacebar to right_option if pressed with other keys (Post spacebar when pressed alone)",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "spacebar",
@grayrest
grayrest / deku_uptime_boxes.html
Created April 12, 2016 18:20
Deku Uptime Boxes
<!doctype html>
<html>
<head>
<title>Uptime Boxes</title>
<style type="text/css">
html, body {
margin: 0;
padding: 0;
font-family: sans-serif;
}
@grayrest
grayrest / index.jsx
Created April 12, 2016 18:12
Mobx Uptime Boxes
import React, {Component} from 'react';
import ReactDOM from 'react-dom';
import {observable, computed} from 'mobx';
import {observer} from 'mobx-react';
// import DevTools from 'mobx-react-devtools';
class Server {
@observable days = [];
@observable name = "";
@computed get upDays() {
@grayrest
grayrest / dumb_graph.js
Created October 11, 2012 19:17
Simple JS implementation of Prismatic's blog post about Graph
function sum (fn, xs) {
var toRet = 0;
for (var i = 0, ii = xs.length; i < ii; i++) {
toRet += fn(xs[i], i, xs);
}
return toRet;
}
function update(t, o) {
for (var k in o) {
http = require 'http'
flow = require('../lib/conductor').conductor()
#nodes
flow.build
port: () -> 8000
listener: (port, request, response) ->
server= http.createServer (req, res) ->
request(req) if request
response(res) if response
http = require 'http'
flow = require('../lib/conductor').conductor()
#nodes
port= flow.node('port', () -> 8000)
.node('listener', (port, request, response) ->
server= http.createServer (req, res) ->
request(req) if request
response(res) if response
server.listen port)
@grayrest
grayrest / blah.coffee
Created October 21, 2010 16:02
basic http hello world
http = require 'http'
flow = require('../lib/conductor').conductor()
#nodes
port= flow.node 'port', () -> 8000
listener= flow.node 'listener', (port, request, response) ->
server= http.createServer (req, res) ->
request(req) if request
response(res) if response
require 'formula'
class SdlGfx <Formula
url 'http://www.ferzkopp.net/Software/SDL_gfx-2.0/SDL_gfx-2.0.20.tar.gz'
homepage 'http://www.ferzkopp.net/joomla/software-mainmenu-14/4-ferzkopps-linux-software/19-sdlgfx'
md5 '8a787e538a8e4d80d4927535be5af083'
depends_on 'sdl'
def install
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>jQuery calculator demo</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div id="calculator">
@grayrest
grayrest / x
Created November 2, 2008 20:26
Ubiquity JSON Pretty Printer
/*
json2.js
2008-03-14
Public Domain
No warranty expressed or implied. Use at your own risk.
See http://www.JSON.org/js.html