Skip to content

Instantly share code, notes, and snippets.

@b0oh
b0oh / userscript.js
Last active August 29, 2015 14:01
DuckDuckGo Explicit Userscript
// ==UserScript==
// @name DuckDuckGo Explicit
// @namespace https://gist.github.com/b0oh/01354c52e2b66ccbf7a8
// @include https://duckduckgo.com/*
// @version 1
// @grant none
// ==/UserScript==
$(document).ready(function () {
var results = $('.results');
@b0oh
b0oh / gist:3617903
Created September 4, 2012 07:13
js s-expr pareser
String.prototype.fixSpaces = function () {
return this.replace(/\s+/g, ' ').trim();
};
var Symbol = String;
function tokenize(s) {
return s.replace(/([()])/g, ' $1 ').fixSpaces().split(' ');
};
@b0oh
b0oh / gist:3931450
Created October 22, 2012 13:12
meta circular eval
(define (mceval exp env)
(cond ((self-evaluating? exp) exp)
((variable? exp) (lookup-variable-value exp env))
((quoted? exp) (text-of-quotation exp))
((assignment? exp) (eval-assignment exp env))
((definition? exp) (eval-definition exp env))
((if? exp) (eval-if exp env))
((lambda? exp)
(make-procedure (lambda-parameters exp)
(lambda-body exp)
@b0oh
b0oh / gist:4177081
Created November 30, 2012 17:11
Church Numerals on CoffeeScript
# helpers
inc = (x) -> x + 1
church = (n) ->
if n > 0
succ church n-1
else
zero
@b0oh
b0oh / Fantom.hs
Last active December 15, 2015 19:29
module Fantom where
data NoPower
data Power
data Product = Donut | Bread deriving Show
data Oven product power = Oven product
oven :: Product -> Oven Product NoPower
module dff_async_reset (
input wire reset,
input wire clock,
input wire [7:0] input_data,
output reg [7:0] output_data
);
always @(posedge clock or posedge reset)
if (reset)
output_data <= 0;
@b0oh
b0oh / index.erl
Created June 5, 2013 11:31
Simpliest Chat Ever
-module(index).
-export([main/0, title/0, body/0, event/1]).
-include_lib("nitrogen_core/include/wf.hrl").
-include("records.hrl").
main() -> #template { file="./site/templates/bare.html" }.
title() -> "Simple Chat".
body() ->
@b0oh
b0oh / typing.md
Created November 21, 2016 11:19 — forked from chrisdone/typing.md
Typing Haskell in Haskell

Typing Haskell in Haskell

MARK P. JONES

Pacific Software Research Center

Department of Computer Science and Engineering

Oregon Graduate Institute of Science and Technology

@b0oh
b0oh / fftutorial.cs
Created February 3, 2017 23:48 — forked from Lovesan/fftutorial.cs
FFmpeg & SDL2 - play audio & video
#define __STDC_CONSTANT_MACROS
#include <stdint.h>
#include <inttypes.h>
#include <windows.h>
#include <stdio.h>
extern "C"
{
#include <libavfilter/avfilter.h>