Skip to content

Instantly share code, notes, and snippets.


Christian Aust datenimperator

View GitHub Profile
hmans /
Last active Sep 25, 2017
RESTful Rails Controller, 2017 Edition

This is a RESTful Rails controller, implementing all 7 RESTful actions. In my Rails apps, 9 out of 10 controllers will end up looking like this.

class PostsController < ApplicationController

  def create and redirect_to(@post) or render(:new)
drozzy /
Last active Jan 8, 2021
FMC ( compositional and dynamic elements libraries


This is just some stencils I created for myself to draw FMC ( diagrams with

Here is how they look:



sevaine /
Created Sep 19, 2015
Changing the default VM Path in VMWare Fusion on OSX Yosemite

Changing the default VM Path in VMWare Fusion on OSX Yosemite:

I had a little trouble figuring this out - so making a note of it. The VMWare Fusion default location for VMs is ~/Documents/Virtual Machines.localized, which doesnt work well for me as I typically have Documents symbolically linked to my Dropbox directory and prefer to move the default VM location rather than manage exclusions on every Dropbox install I have.

It's relatively straightforward on VMWare Workstation, and Oracle VirtualBox - but for some reason

mrnugget / forking_rspec.rb
Last active Aug 29, 2015
Run RSpec tests on multiple processes at the same time
View forking_rspec.rb
#!/usr/bin/env ruby
ENV['RAILS_ENV'] = 'test'
require 'benchmark'
rails_loading_time = Benchmark.measure { require './config/environment' }
puts "Rails env loaded in #{rails_loading_time}"
test_groups = `find ./spec -type f -iname "*foobar*"`.split("\n").in_groups(NUM_FORKS).to_a
View config.rb
# disable layout
page ".htaccess.apache", :layout => false
# rename file after build
after_build do
File.rename 'build/.htaccess.apache', 'build/.htaccess'
hagenburger /
Last active Mar 24, 2016
Optimized Rails I18n format

Traditional way

my_key_link: 'World'
my_key: 'Hello %{link}!'                      link: link_to(t('my_key_link'), 'xy')
'Hello <a href="xy">World</a>!'
  • Need to check if raw is required everytime
  • Translators can loose the context
emad-elsaid / post2fb.rb
Created Mar 3, 2014
posting to facebook groups all at once with ruby posting to facebook groups all at once with ruby
View post2fb.rb
#!/usr/bin/env ruby
require 'koala' # gem install koala --no-ri --no-rdoc
# create a facebook app and get access token from here
# select "groups", "photos" when authenticating
oauth_access_token = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
group_filtering_words = ['ruby']
image_path = 'image.png' #change to your image path
message = 'My Cool image.' # your message
0bp / HTML.lua
Last active Apr 14, 2020
MoneyMoney HTML Export mit Kategorie und Kommentar
View HTML.lua
-- The MIT License (MIT)
-- Copyright (c) 2014 Boris Penck
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
erikng / swupd.conf
Last active Dec 26, 2015
Mountain Lion Server - Maverick Client Support
View swupd.conf
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} Darwin/9
RewriteRule ^/index\.sucatalog$ http://%{HTTP_HOST}/cgi-bin/SoftwareUpdateServerGetCatalog?/index-leopard.merged-1.sucatalog
RewriteCond %{HTTP_USER_AGENT} Darwin/10
RewriteRule ^/index\.sucatalog$ http://%{HTTP_HOST}/cgi-bin/SoftwareUpdateServerGetCatalog?/index-leopard-snowleopard.merged-1.sucatalog
RewriteCond %{HTTP_USER_AGENT} Darwin/11
RewriteRule ^/index\.sucatalog$ http://%{HTTP_HOST}/cgi-bin/SoftwareUpdateServerGetCatalog?/index-lion-snowleopard-leopard.merged-1.sucatalog
RewriteCond %{HTTP_USER_AGENT} Darwin/12
RewriteRule ^/index\.sucatalog$ http://%{HTTP_HOST}/cgi-bin/SoftwareUpdateServerGetCatalog?/index-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog
reidransom / gist:6042016
Created Jul 19, 2013
Auto-starting VirtualBox VMs on OS X
View gist:6042016

Auto-starting VirtualBox VMs on OS X

After finding a lot of other posts on the topic that didn't work out for me this one did the trick so I'm reposting for my own sense of self preservation.

Link to original article.

Copy the Virtualbox autostart plist template file to your system's LaunchDaemons folder.

sudo cp \
    /Applications/ \
You can’t perform that action at this time.