Skip to content

Instantly share code, notes, and snippets.

(ns
^{:doc
"Simple Theorem Prover 'Programming Language Theory and its Implementation' Michael J.C. Gordon"
:author "Kenichi Kobayashi"}
prover
(:use [clojure.test])
(:require [clojure.walk :as cw]))
(def constant #{'+ '- '< '<= '> '>= '* '= 'T 'F 'DIV 'not 'and 'or 'implies})
AppManager.module('${1:AppName}App.Views', function (Views, AppManager, Backbone, Marionette, \$, _) {
'use strict'
Views.${2:ViewName} = Marionette.ItemView.extend({
tagName: '${3:div}',
template: '#forms-${1/./\L$&/g}-${2/./\L$&/g}-template',
@avshabanov
avshabanov / compilation_and_output
Created December 22, 2013 01:13
Virtual function check (C vs C++)
isis:cpp_vs_c alex$ gcc -O3 -std=c99 virt.c -o /tmp/v
isis:cpp_vs_c alex$ gcc -O3 virt.cpp -o /tmp/vpp
isis:cpp_vs_c alex$ /tmp/v
Ret = 100001000, Time: 0 sec 188086 000 msec
isis:cpp_vs_c alex$ /tmp/vpp
(C++) Ret = 100001000, Time: 0 sec 000001 000 msec
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), uri);
@avshabanov
avshabanov / gist:10949276
Created April 17, 2014 02:41
Sequences.java
package com.truward.polymer.util;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import javax.annotation.Nonnull;
import java.util.*;
/**
@avshabanov
avshabanov / proxyserver.js
Created May 30, 2014 17:03
NodeJS Simple Proxy Server
var http = require("http"),
url = require("url");
var port = process.argv[2] || 8888;
// Sample redir link: http://docs.oracle.com/javase/7/docs/api/java/lang/String.html
http.createServer(function(request, response) {
var urlOptions = url.parse(request.url);
var pathname = urlOptions.pathname;
@avshabanov
avshabanov / staticserver.js
Created May 30, 2014 17:04
NodeJS Simple Static Server
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888;
var guessContentType = (function () {
var CONTENT_TYPE_OCTET_STREAM = "application/octet-stream";
var DEFAULT_CONTENT_TYPES = {
@avshabanov
avshabanov / perf_double.c
Created June 2, 2014 17:39
Performance benchmark: double multiplication vs integer multiplication+shift
#include <stdio.h>
#define N (100000000)
double arr[] = { 8, 0.125, 4, 0.25 };
int main() {
double d = 1.0;
for (int i = 0; i < N; ++i) {
d *= arr[i % 4];
package com.alexshabanov.kotwebdemo.service.radio
import java.util.Collections
import java.util.ArrayList
// prototype of non-AOP based approach to service exposure
//
// Public API
//
@avshabanov
avshabanov / ratio.kt
Last active August 29, 2015 14:12 — forked from abreslav/ratio.kt
class Ratio(num : Int, denom : Int) {
val numerator: Int
val denominator: Int
{
val theGcd = gcd(num, denom)
numerator = num / theGcd
denominator = denom / theGcd
}
}