Skip to content

Instantly share code, notes, and snippets.

@wbzyl
wbzyl / percolate-bug.rb
Created January 12, 2012 14:12
Tire: percolate bug
# -*- coding: utf-8 -*-
require 'tire'
# Let's define a class to hold our data in *ElasticSearch*.
class Status
include Tire::Model::Persistence
property :text
@wbzyl
wbzyl / mongod.sh
Created January 23, 2012 11:32
MongoDB
#! /bin/bash
function usageexit() {
echo "Usage: $(basename $0) [PORT] [other mongodb options]" >&2
exit 1
}
dbpath=$HOME/.data/var/lib/mongodb
config_file=$HOME/.data/etc/mongodb.conf
@wbzyl
wbzyl / elasticsearch.sh
Last active September 29, 2015 23:48
ElasticSearch
#! /bin/bash
progname=$(basename $0 .sh)
configfile=$HOME/.data/etc/elasticsearch.yml
echo ""
echo "---- $configfile"
cat $configfile
echo "---------------------------------------------------------------------------"
echo ""
@wbzyl
wbzyl / html5.html
Created February 5, 2012 11:44
HTML5 template
<!doctype html public "♥♥♥">
<html lang=pl>
<head>
<meta charset=utf-8>
<title>Szablon strony HTML5</title>
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script src="http://code.jquery.com/jquery.min.js"></script>
<style>
@wbzyl
wbzyl / html5-mathjax.html
Created February 15, 2012 19:10
HTML5 + MatJaX-2.0 template
<!doctype html public "♥♥♥">
<html lang=pl>
<head>
<meta charset=utf-8>
<title>Szablon strony HTML5 + MathJax 2.0</title>
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
@wbzyl
wbzyl / hello-latex.tex
Created February 21, 2012 16:48
Szablon LateX-a dla ShareLaTeX
\documentclass[12pt,a4paper,polish]{article}
\usepackage{polski}
\usepackage[utf8]{inputenc}
\begin{document}
\section{Tytuł}
Uwaga na znaki specjalne!
@wbzyl
wbzyl / tabe.c
Created February 29, 2012 14:19
#include <stdio.h>
#include <string.h>
#include <math.h>
int main()
{
double a, b, c, i;
double wynik;
char *formatka = "| %.6f | %.6f |";
@wbzyl
wbzyl / nginx.conf
Created February 29, 2012 23:33
CouchDB behind Nginx
user wbzyl;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
@wbzyl
wbzyl / mongod.sh
Last active October 1, 2015 09:48
MongoDB
#! /bin/bash
function usageexit() {
echo "Usage: $(basename $0) [other mongodb options]" >&2
echo ""
echo "---- MongoDB CONFIG FILE:"
cat $config
echo "---- MongoDB PATHS:"
echo dbpath: $dbpath
echo logpath: $logpath
@wbzyl
wbzyl / minitest_spec_expectations.md
Created March 15, 2012 21:42 — forked from ordinaryzelig/minitest_spec_expectations.md
How to write MiniTest::Spec expectations

I'm a fan of MiniTest::Spec. It strikes a nice balance between the simplicity of TestUnit and the readable syntax of RSpec. When I first switched from RSpec to MiniTest::Spec, one thing I was worried I would miss was the ability to add matchers. (A note in terminology: "matchers" in MiniTest::Spec refer to something completely different than "matchers" in RSpec. I won't get into it, but from now on, let's use the proper term: "expectations").

Understanding MiniTest::Expectations

Let's take a look in the code (I'm specifically referring to the gem, not the standard library that's built into Ruby 1.9):

# minitest/spec.rb

module MiniTest::Expectations