Skip to content

Instantly share code, notes, and snippets.

View unders's full-sized avatar

Anders Törnqvist unders

  • Functionbox
  • Göteborg, Sweden
View GitHub Profile
@unders
unders / formtastic.rb
Created February 10, 2014 09:14 — forked from rjz/formtastic.rb
# config/initializers/formtastic.rb
module FormtasticBootstrap
class FormBuilder < Formtastic::FormBuilder
# Allow "split-field" inputs such as name (first+last) or location (city+state).
# Block contents are wrapped in a ".controls" field set next to the specified
# +label+
#
# Usage:
#
# SASS SECTION
BUILD_DIR := tmp/build
SASS_SRC_FILES := $(shell find app/sass -name "*.scss" | xargs)
SASS_FILES := $(SASS_SRC_FILES:%.scss=$(BUILD_DIR)/%.scss)
SASS_MAIN_FILE := $(BUILD_DIR)/app/sass/main.scss
SASS_TO_CSS_FILE := app/assets/stylesheets/main.css.erb
$(BUILD_DIR)/%.scss: %.scss
mkdir -p $(dir $@)
@unders
unders / gist:4200
Created August 6, 2008 09:38 — forked from defunkt/gist:4169
# by bryan helmkamp with slight modification by chris wanstrath
# from http://www.brynary.com/2008/8/3/our-git-deployment-workflow
module GitCommands
extend self
def diff_staging
`git fetch`
puts `git diff origin/production origin/staging`
end
desc "Push design to spec"
task :design do
require 'yaml'
specs = YAML::load_file './spec/design.yml'
specs.each_pair do |describe, specs_array|
spec_file = File.new("./spec/#{describe.downcase.gsub(/ /, '_')}_spec.rb", 'w')
spec_file.puts <<-END
require File.dirname(__FILE__) + '/spec_helper'
describe "#{describe}" do
resource/
   - html
      - layout.html
      - jobs/{index.html, new.html ...}
   - js/
   - css/
src/
- cmd
 - web/main.go
@unders
unders / minimal docker
Last active August 29, 2015 14:27
A mininal docker file
FROM gliderlabs/alpine:3.2 # 1. tiny container
MAINTAINER: Anders Törnqvist <...@...com>
RUN apk add --update ca-certificates bash
COPY . go/src/github.com/unders/program # 2. copy your sorce code
RUN apk add go got mercurial \ # 3. add dependencies
&& cd /go/src/github.com/unders/program \
&& export GOPATH=/go \
&& go get -t \ # 4. resovel deps
#!/bin/bash
VERSION="1.1"
REEV="http://rubyforge.org/frs/download.php/48623/ruby-enterprise-1.8.6-20081215.tar.gz"
REEF="ruby-enterprise-1.8.6-20081215.tar.gz"
REEFF=${REEF%".tar.gz"}
PASSENGER="2.0.6"
echo "#####################################"
echo "Welcome, let's get this party rollin'"
echo "#####################################"
#!/usr/bin/env ruby
require 'rubygems'
require 'thor'
require 'fileutils'
require 'yaml'
# module: tm
$SILENT = true
@unders
unders / hookz.rb
Created February 3, 2009 18:58 — forked from jnicklas/hookz.rb
class SomeClass
class << self
def hooks
@hooks ||= Hash.new([])
end
def add_hook(kind, &block)
self.hooks[kind] << block
end