Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View teaforthecat's full-sized avatar

Chris Thompson teaforthecat

View GitHub Profile
require 'digest/md5'
def gfm(text)
# Extract pre blocks
extractions = {}
text.gsub!(%r{<pre>.*?</pre>}m) do |match|
md5 = Digest::MD5.hexdigest(match)
extractions[md5] = match
"{gfm-extraction-#{md5}}"
end
@salex
salex / jekyll_uv_highlight.rb
Created July 18, 2010 12:53
Jekyll Plugin for Ultraviolet
module Jekyll
class UltravioletTag < Liquid::Block
require "Uv"
# This defines an uvhighlight tag for code highlighting using Ultraviolet (must [sudo] gem install ultraviolet and dependancies)
# Syntax for tag is {% uvhighlight code [theme] ["linenumb|linenos"]%} which is similar to the pygments call
# code is required, theme and linenumb optional and in any order
def initialize(tag_name, arg, tokens)
super
copy_files? # copy css files if not in css directory
@bitonic
bitonic / francesco.el
Created June 22, 2012 12:58
My emacs config
;;; ===========================================================================
;;; Francesco's emacs config, <f@mazzo.li>
;;; Packages needed: paredit-el, wl-beta, auto-complete-el, haskell-mode,
;;; erlang-mode, w3m-el, bbdb, slime, elib, cscope-el
;;; Non-debian packages: distel, undo-tree, highlight-parentheses, agda2,
;;; sicstus, ghc-mod
;;; Additional dirs
(add-to-list 'load-path "~/.emacs.d/site-lisp/distel")
(add-to-list 'load-path "~/.emacs.d/site-lisp/sicstus")
@equivalent
equivalent / app-assets-javascript-datepicker.js.coffee
Created July 5, 2012 12:24
Simple Form custom input for "Datepicker for Twitter Bootstrap" running under Ruby on Rails with Ransack search
# install and make run basic bootstrap date-picker functionality described here http://www.eyecon.ro/bootstrap-datepicker/
# app/assets/javascript/datepicker.js.coffee
$(document).on 'pageChanged', ->
# datepicker for simple_form & Ransack
$(".custom_datepicker_selector").datepicker().on 'changeDate', (en) ->
correct_format = en.date.getFullYear() + '-' + ('0' + (en.date.getMonth() + 1)).slice(-2) + '-' + ('0' + en.date.getDate()).slice(-2) # date format yyyy-mm-dd
$(this).parent().find("input[type=hidden]").val(correct_format)
# development.pp
stage { 'req-install': before => Stage['rvm-install'] }
class misc {
package {
[
'vim',
]:
ensure => installed,
}
@nathanlippi
nathanlippi / gist:5923326
Last active December 5, 2022 23:14
Emacs + Tmux integrated window movement
;; Many thanks to the author of and contributors to the following posts:
;; https://gist.github.com/mislav/5189704
;; http://robots.thoughtbot.com/post/53022241323/seamlessly-navigate-vim-and-tmux-splits
;;
;; TODO: Make a script that generates tmux and emacs code without duplication
;;
;; NOTE: My keybindings are not the default emacs ones, using windmove
;; Try to move direction, which is supplied as arg
;; If cannot move that direction, send a tmux command to do appropriate move
@mbbx6spp
mbbx6spp / README.md
Last active September 29, 2019 18:37
Example usage of the dancer shell (dsh). Used as partial material for the DevOps Tech Talk Topic meetup on 8/8/2013.

Distributed or Dancer Shell

Similar to ansible command but allows you to use any command that will work in your shell. Not tied to specific configuration management tooling, just SSH and your default shell on remote systems. Just works. I <3 it :)

What does it do?

Runs commands across potentially many machines. Allows you to organize your servers/VMs/instances into groups very easily.

Getting Started

@Deraen
Deraen / 00_notes.md
Last active October 1, 2019 08:40
Compojure-api and Buddy
  • (:identity req) is auth backend independent way to access user data
  • login and logout implementation depends on auth backend
  • :current-user doesn't imply that authentication is required, route should also have :auth-rules if authentication is required
@levand
levand / data-modeling.md
Last active May 19, 2023 16:38
Advice about data modeling in Clojure

Since it has come up a few times, I thought I’d write up some of the basic ideas around domain modeling in Clojure, and how they relate to keyword names and Specs. Firmly grasping these concepts will help us all write code that is simpler, cleaner, and easier to understand.

Clojure is a data-oriented language: we’re all familiar with maps, vectors, sets, keywords, etc. However, while data is good, not all data is equally good. It’s still possible to write “bad” data in Clojure.

“Good” data is well defined and easy to read; there is never any ambiguity about what a given data structure represents. Messy data has inconsistent structure, and overloaded keys that can mean different things in different contexts. Good data represents domain entities and a logical model; bad data represents whatever was convenient for the programmer at a given moment. Good data stands on its own, and can be reasoned about without any other knowledge of the codebase; bad data is deeply and tightly coupled to specific generating and