Skip to content

Instantly share code, notes, and snippets.

View code-later's full-sized avatar

Dirk Breuer code-later

View GitHub Profile
@code-later
code-later / gist:719848
Created November 29, 2010 11:25
Load a project specific .irbrc in your Rails 3 project
# Add this method the MyApp::Application class (in config/application.rb)
def load_console(sandbox=false)
super
project_specific_irbrc = File.join(Rails.root, ".irbrc")
puts "Loading project specific .irbrc ..."
load(project_specific_irbrc) if File.exists?(project_specific_irbrc)
end

Keybase proof

I hereby claim:

  • I am code-later on github.
  • I am codelater (https://keybase.io/codelater) on keybase.
  • I have a public key whose fingerprint is 558C 4BCB 769B 6C58 D0C8 99F2 D845 39FC 9C9B 31F1

To claim this, I am signing this object:

@code-later
code-later / playbook.yml
Created March 19, 2018 08:54
Install Python 2.7 with Ansible in pre_tasks
---
- hosts: all
become: True
gather_facts: False
pre_tasks:
- name: Install python for Ansible
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
changed_when: False
- setup: # aka gather_facts
@code-later
code-later / README.markdown
Created November 15, 2013 22:52
Export your Octopress files to Ghost

This is a very rough script to export your octopress files to Ghost. You will still need to check your data but it will give you a head start. Feel free to fork and optimize the script for your purpose.

The following should be considered:

  1. You need to execute the script in the source/_posts directory
  2. You need to manually copy all the images to /var/www/ghost/content/images
  3. Images with external URLs are not handled
  4. Blockquotes have their issues
  5. Lists are not exported correctly
@code-later
code-later / mt_to_markdown.rb
Created April 10, 2012 12:28
Convert a MovableType export to single Markdown posts to use with Octopress
#!/usr/bin/env ruby
require 'date'
require 'mustache'
require 'stringex'
require 'cgi'
export = File.open(ARGV[0])
target_dir = ARGV[1]
@code-later
code-later / podcast.rb
Created October 19, 2013 15:09
Sample Guacamole Model
class Podcast
include Guacamole::Model
attribute :title, String
attribute :body, String
# Timestamp attributes are automatically added (created_at, updated_at)
end
@code-later
code-later / pinkiepie.yml
Created October 9, 2013 14:06
Pinkie Pie color schema to be used with base16 builder (https://github.com/chriskempson/base16-builder)
scheme: "PinkiePie"
author: "Dirk Breuer (http://tfcl.de)"
base00: "151515"
base01: "202020"
base02: "303030"
base03: "505050"
base04: "b0b0b0"
base05: "d0d0d0"
base06: "e0e0e0"
base07: "f5f5f5"
@code-later
code-later / pony.rb
Created July 2, 2013 18:43
Shoes Pony Example for SIGINT
Shoes.app width: 600, height: 600 do
@knopf = button("Start", left: 300, top: 300) do
@pinky = image "/Users/dbreuer/Desktop/pinkie.png", width: 120, left: 0
@dash = image "/Users/dbreuer/Desktop/dash.png", width: 120, left: 400
@knopf.hide
end
#@mein_kreis = oval(0, 100, 25, fill: red, stroke: pink)
#animate 60 do
@code-later
code-later / README.markdown
Created June 10, 2013 09:28
base16 color scheme

This is my color scheme definition to be used with @chriskempson base16 builder. It is based on the original base16 color set with some pink modifications. I use the resulting 256 colors variant.

class Gateway
attr_reader :connection
def initialize(connection = Application.config.default_connection)
@connection = connection
end
def get(params)
request(:get, params)
end