Skip to content

Instantly share code, notes, and snippets.

@stereosteve
stereosteve / http_get.go
Last active December 14, 2015 09:29 — forked from ijt/http_get.go
package main
import (
"fmt"
"io/ioutil"
"net/http"
"os"
)
func main() {
@stereosteve
stereosteve / backgroundVideo.js
Created December 12, 2013 12:55
Shows a video fullscreen in the background of a page. Scales and centers video when you resize the window. Similar to bigvideo.js but much simpler.
$.fn.backgroundVideo = function() {
var win = $(window)
var wrap = this
var vid = wrap.find('video')
if (vid.length == 0) {
throw new Error("You must call backgroundVideo on a wrapper div that contains a video element. No video element found.")
}
wrap.css({
@stereosteve
stereosteve / StevePerkinsResume.md
Last active January 2, 2016 10:39
Steve Perkins' Resume

Steve Perkins

  • Full stack developer working in JavaScript, Go, Ruby, lua and more.
  • Front End: angular.js, vue.js, d3, paper.js, less / stylus, bower, grunt / gulp
  • Back End: Node.js, Go, SQL, Mongo, Redis, websockets, etc.
  • Comfortable with linux, basic ops and AWS services.

Education

.long-shadow {
text-shadow:
1px 1px #333,
2px 2px #333,
3px 3px #333,
4px 4px #333,
5px 5px #333;
}
@stereosteve
stereosteve / react_debug.jsx
Created September 17, 2014 17:37
React debug component
var Debug = React.createClass({
render: function() {
var obj = this.props.obj
var json = JSON.stringify(obj, undefined, 2)
return <pre>{json}</pre>
}
})
const std = @import("std");
const Mark = enum(u2) {
Empty,
X,
O,
};
const Game = struct {
board: [3][3]Mark,
use std::io::{self, BufRead};
fn to_mark(i: u8) -> String {
match i {
1 => "X".to_string(),
2 => "O".to_string(),
_ => "-".to_string(),
}
}
import {
serve,
ServerRequest,
} from "https://deno.land/[email protected]/http/server.ts";
const GIT_PROJECT_ROOT = "repoz";
const encoder = new TextEncoder();
async function gitCgi(request: ServerRequest) {
let [path, query] = request.url.split("?");
@stereosteve
stereosteve / Chatroom.tsx
Last active April 21, 2025 23:08
React hooks for using nats.ws
// A very basic chatroom example:
import { JSONCodec, Msg } from 'nats.ws'
import { FormEvent, useState } from 'react'
import './App.css'
import { useNats, useNatsSubscription } from './useNats'
const natsSubject = 'chat'
const sc = JSONCodec()
-- currently running queries (youngest to oldest)
SELECT pid, state, age(clock_timestamp(), query_start), substring(trim(regexp_replace(query, '\s+', ' ', 'g')) from 1 for 200)
FROM pg_stat_activity
WHERE state != 'idle' AND query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- x blocking y