Skip to content

Instantly share code, notes, and snippets.

View mrnugget's full-sized avatar

Thorsten Ball mrnugget

View GitHub Profile
@mrnugget
mrnugget / .zprofile
Created April 30, 2012 08:03
Get ctags and rbenv working with MacVim and ZSH
export PATH="$HOME/.rbenv/bin:/usr/local/bin:$PATH"
eval "$(rbenv init -)"
@mrnugget
mrnugget / gist:2762858
Created May 21, 2012 15:14
Ruby: Changing the method of another class
module MyModule
class Client
def showmetheurl
puts secret_url
end
private
def secret_url
'http://www.changethis.de'
@mrnugget
mrnugget / postinstall.sh
Created May 23, 2012 15:59
Vagrant Post-Install
# **postinstall.sh** is a script executed after Debian/Ubuntu has been
# installed and restarted. There is no user interaction so all commands must
# be able to run in a non-interactive mode.
#
# If any package install time questions need to be set, you can use
# `preeseed.cfg` to populate the settings.
### Setup Variables
# The version of Ruby to be installed supporting the Chef and Puppet gems
@mrnugget
mrnugget / chefnode.json
Created May 25, 2012 16:20
Chef can't find solo.rb
{
"app": {
"root_path": "/vagrant"
},
"mysql": {
"server_root_password": "password"
},
"run_list": ["recipe[main]"]
}
@mrnugget
mrnugget / default.rb
Created May 31, 2012 09:56
Output of running chef-solo
include_recipe 'ruby_build'
# chef-rbenv https://github.com/fnichol/chef-rbenv
include_recipe 'rbenv::user'
# rbenv_rehash "Rehashing tflowers' rbenv" do
# user "two-dns"
# end
rbenv_gem 'bundler' do
rbenv_version '1.9.3-p194'
root_path '/home/two-dns/.rbenv'
user 'two-dns'
require 'digest'
module AnyGood
class MovieMatcher
def add_movie(movie_hash)
prefixes = prefixes_for(movie_hash[:name])
hashed_name = data_hash_key_for(movie_hash)
prefixes.each do |prefix|
@mrnugget
mrnugget / changed_attributes.rb
Created June 12, 2012 14:46
Changed attributes
#
# FIRST VERSION
#
# Using string interpolation
#
class Endpoint
attr_reader :changed_attributes
def self.has_attribute(attr_name)
attr_reader attr_name
@mrnugget
mrnugget / sasscustom_colors.scss
Created July 9, 2012 14:14
sidebar link colors
$sidebar-bg: image-url('noise.png');
$sidebar-bg-color: #FCFCF2;
$sidebar-color: $text-color;
$sidebar-link-color: $link-color !default;
$sidebar-link-color-hover: $link-color-hover !default;
$sidebar-link-color-active: $link-color-active !default;
$sidebar-border: desaturate(darken($sidebar-bg-color, 7), 10) !default;
$sidebar-border-hover: darken($sidebar-bg-color, 7) !default;
$sidebar-link-color-subdued: lighten($sidebar-color, 20) !default;
$sidebar-link-color-subdued-hover: $sidebar-link-color-hover !default;
@mrnugget
mrnugget / json_api.markdown
Created July 16, 2012 10:42
JSON API - What's preferable?

What do you prefer as output of a JSON API?

Hash

{
  "foo": "bar",
  "the_list": {
    "list_item_one": {
 "foo": "bar",
@mrnugget
mrnugget / app.js
Created July 24, 2012 07:55
node.js, express.js and socket.io — server and client example
var io = require('socket.io');
var express = require('express');
var app = express.createServer();
var server = app.listen(8080);
var ioServer = io.listen(server);
app.get('/', function (req, res) {
res.sendfile(__dirname + '/index.html');
});