Skip to content

Instantly share code, notes, and snippets.

View mihneadb's full-sized avatar

Mihnea Dobrescu-Balaur mihneadb

  • Bolt
  • Bucharest, Romania
View GitHub Profile
@mihneadb
mihneadb / hello.rs
Created January 20, 2017 00:44
Hello world server in Rust using Iron and Params
extern crate iron;
extern crate params;
use iron::prelude::*;
use iron::status;
use params::{Params, Value};
fn handler(req: &mut Request) -> IronResult<Response> {
let params_map = req.get_ref::<Params>().unwrap();
let name = match params_map.find(&["name"]) {
@mihneadb
mihneadb / hello.go
Created January 20, 2017 00:44
Hello world server in Go using net/http
package main
import (
"fmt"
"net/http"
)
func handler(w http.ResponseWriter, r *http.Request) {
var name string
{
"inputs": [
{
"name": "Option",
"generic": "true",
"ty_params": [
{
"name": "T",
"generic": "true",
"ty_params": []
@mihneadb
mihneadb / gist:48d0751f62674928269d
Created October 11, 2014 19:17
mapping transducer
(sequence (map inc) [1 2 3]) ; (2 3 4)
; ^^^^^^^^^
; "mapping transducer"
(defn sequence
; [...]
([xform coll]
(clojure.lang.LazyTransformer/create xform coll))
; [...]
)
alert("yo");
@mihneadb
mihneadb / index.html
Created May 20, 2014 12:29
github api demo
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<h3>GH Issues</h3>
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" general
Bundle 'gmarik/vundle'
Bundle 'kien/ctrlp.vim'
Bundle 'bitc/vim-bad-whitespace'
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" Bundles go here
Bundle 'gmarik/vundle'
@mihneadb
mihneadb / gist:8021666
Created December 18, 2013 12:40
gh api events
This file has been truncated, but you can view the full file.
{"payload": {"action": "created", "comment": {"body": "You're welcome. And btw i was using the lettuce installed from sources so if you are using an older version you may want to double check.", "url": "https://api.github.com/repos/gabrielfalcao/lettuce/issues/comments/30761696", "created_at": "2013-12-17T15:45:43Z", "html_url": "https://github.com/gabrielfalcao/lettuce/issues/282#issuecomment-30761696", "updated_at": "2013-12-17T15:45:43Z", "user": {"following_url": "https://api.github.com/users/adaschevici/following{/other_user}", "events_url": "https://api.github.com/users/adaschevici/events{/privacy}", "organizations_url": "https://api.github.com/users/adaschevici/orgs", "url": "https://api.github.com/users/adaschevici", "gists_url": "https://api.github.com/users/adaschevici/gists{/gist_id}", "html_url": "https://github.com/adaschevici", "subscriptions_url": "https://api.github.com/users/adaschevici/subscriptions", "avatar_url": "https://gravatar.com/avatar/43dd2adc150d7499f8734a424a633708?d=https%3A%2F%2
@mihneadb
mihneadb / hamming.clj
Created December 17, 2012 13:24
Hamming distance in Clojure
user=> (def x "AAAABCDBC")
#'user/x
user=> (def y "AABBBCCBC")
#'user/y
user=> (count (filter true? (map (partial reduce not=) (map vector x y))))
3