Skip to content

Instantly share code, notes, and snippets.

View riethmayer's full-sized avatar

Jan Riethmayer riethmayer

View GitHub Profile
@riethmayer
riethmayer / 0_reuse_code.js
Created March 11, 2017 16:55
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@riethmayer
riethmayer / .emacs
Last active March 21, 2022 13:36 — forked from even4void/.emacs
A basic previewer for R Markdown files edited with Emacs
(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.Rmd\\'" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.rmd\\'" . markdown-mode))
(add-hook 'markdown-mode-hook 'turn-on-outline-minor-mode)
(defun rmarkdown-new-chunk (name)
"Insert a new R chunk."
(interactive "sChunk name: ")
(insert "\n```{r " name "}\n")
(save-excursion
@riethmayer
riethmayer / README.md
Created June 16, 2012 22:58 — forked from croaky/README.md
Typical README for a thoughtbot Rails app that is deployed to Heroku

Rails app

is a Rails 3.1 app running on Ruby 1.9.2 and deployed to Heroku's Cedar stack. It has an RSpec and Cucumber test suite which should be run before commiting to the master branch.

Running tests

Create aliases:

RSpec::Matchers.define(:be_same_file_as) do |exected_file_path|
match do |actual_file_path|
md5_hash(actual_file_path).should == md5_hash(exected_file_path)
end
def md5_hash(file_path)
Digest::MD5.hexdigest(File.read(file_path))
end
end
DatabaseCleaner.strategy = :truncation, { :except => %w[ translations ] }
# WARNING: Unrefactored Proof of Concept
#
# Allows:
# [1,1,1].should all_be eq(1)
# [2,4,6].should all_be_even
# [2,3,5].should all_be { |n| prime?(n) } # for appropriate definition of prime?#
#
# Not Yet Implemented:
# [1,1,1].should all_be == 1
# [3,6,9].should all_be_divisible_by(3)
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" href="http://openlayers.org/dev/theme/default/style.css" type="text/css" />
<script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAUXDSXET8IRGdgHP9FpGw5BT-fVzUWGS_eJ2ZLPBO_6yPqTi0vhQKAzahOrduDq0xQk09GR-UP3Jgcg'></script>
<script src="http://openlayers.org/api/OpenLayers.js"></script>
<script src="http://www.google.com/jsapi?key=ABQIAAAAUXDSXET8IRGdgHP9FpGw5BT-fVzUWGS_eJ2ZLPBO_6yPqTi0vhQKAzahOrduDq0xQk09GR-UP3Jgcg"></script>
<script type="text/javascript">
google.load("jquery", '1.4');
google.load("maps", "2.x");
</script>
#!/usr/bin/env zsh
if [[ -s "${TM_PROJECT_DIRECTORY}/.rvmrc" ]]
then
source "${TM_PROJECT_DIRECTORY}/.rvmrc"
fi
`which ruby` $*
(defun haml-mumamo-chunk (pos min max)
(mumamo-find-possible-chunk pos min max
'haml-mumamo-bw-exc-start-fun
'haml-mumamo-bw-exc-end-fun
'haml-mumamo-fw-exc-start-fun
'haml-mumamo-fw-exc-end-fun))
(defun* haml-mumamo-exc-start-fun (pos lim max dir)
(if (or (null lim) (null max) (null pos)) (return))
(flet ((check-lim () (when (> (point) max) (return))))