Skip to content

Instantly share code, notes, and snippets.

View igneus's full-sized avatar

Jakub Pavlík igneus

View GitHub Profile
@caffeineshock
caffeineshock / Rakefile
Created April 28, 2012 21:44
LaTeX Building Rakefile
# encoding: utf-8
def config
# in this Rakefile we can allow that
$config ||= Hash.new
end
# main TeX file without extension
config['main'] = 'thesis'
@gnurag
gnurag / treetop-mode.el
Created June 7, 2013 20:31
treetop-mode.el --- Major mode for editing Treetop files
;;; treetop-mode.el --- Major mode for editing Treetop files
;; Copyright (C) 1994, 1995, 1996 1997, 1998, 1999, 2000, 2001,
;; 2002,2003, 2004, 2005, 2006, 2007, 2008
;; Free Software Foundation, Inc.
;; Author: Anurag Patel
;; Adapted from original work by: Yukihiro Matsumoto, Nobuyoshi Nakada
;; URL: http://www.emacswiki.org/cgi-bin/wiki/TreetopMode
;; Created: Fri Jun 8 02:01:00 IST 2013
module A
def do_something
puts 'A->do_something'
super
end
end
module B
def do_something
puts 'B->do_something'
@liverbool
liverbool / bootstrap_4_horizontal_layout.html.twig
Created March 22, 2016 09:32
bootstrap_4_horizontal_layout.html.twig
{% use "web:Form:bootstrap_4_layout.html.twig" %}
{# Labels #}
{% block form_label -%}
{% if label is same as(false) %}
<div class="{{ block('form_label_class') }}"></div>
{% else %}
{% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ block('form_label_class'))|trim}) %}
{{- parent() -}}
@liverbool
liverbool / bootstrap_4_layout.html.twig
Created March 22, 2016 09:32
bootstrap_4_layout.html.twig
{% use "form_div_layout.html.twig" %}
{# Widgets #}
{% block form_widget_simple -%}
{% if type is not defined or 'file' != type %}
{%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-control')|trim}) -%}
{% endif %}
{{- parent() -}}
{%- endblock form_widget_simple %}
@jeetsukumaran
jeetsukumaran / test1.tex
Created September 2, 2016 14:31
BibLaTeX customizations (emphasize author name when rendering bibliography, etc.)
%% emphasize author name when rendering bibliography
% Note: requires: \usepackagage{biblatex}
\newcommand{\emphasizeAuthorName}[1]{%
\DeclareNameFormat{author}{%
\edef\tempname{{#1}}%
\ifnumequal{\value{listcount}}{1}
{\ifnumequal{\value{liststop}}{1}
{\expandafter\ifstrequal\tempname{##1}{\textbf{##1\addcomma\addspace ##4\isdot}}{##1\addcomma\addspace ##4\addcomma\isdot}}
{\expandafter\ifstrequal\tempname{##1}{\textbf{##1\addcomma\addspace ##4\isdot}}{##1\addcomma\addspace ##4}}}
@jodosha
jodosha / Gemfile
Last active December 9, 2020 15:09
Full stack Lotus application example
source 'https://rubygems.org'
gem 'rake'
gem 'lotus-router'
gem 'lotus-controller'
gem 'lotus-view'
group :test do
gem 'rspec'
gem 'capybara'
@profh
profh / decode_session_cookie.rb
Last active June 23, 2021 13:25
A simple script to decode Rails 4 session cookies
@ordinaryzelig
ordinaryzelig / minitest_spec_expectations.md
Last active December 10, 2022 13:34
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
@jeroenvandijk
jeroenvandijk / Gemfile
Created October 17, 2011 09:29
Middleman and Rack-Offline for app manifests
gem 'rack-offline'