Skip to content

Instantly share code, notes, and snippets.

View wedy's full-sized avatar
:octocat:
eating mie goreng

Wedy Chainy wedy

:octocat:
eating mie goreng
  • Sydney
View GitHub Profile
@wedy
wedy / config.ru
Created September 9, 2015 22:43
deploy gollum to heroku
require 'rubygems'
require 'gollum/app'
# to make a valid Git repo by using Heroku's ephemeral filesystem.
Grit::Repo.init('.').add('.').commit_all('initial commit for gollum') unless File.exists? '.git'
Precious::App.set(:gollum_path, '.')
# setting default markup
Precious::App.set(:default_markup, :markdown) # markdown or rdoc your call
@wedy
wedy / app.rb
Last active September 9, 2015 14:18 — forked from troelskn/app.rb
Gollum protected by HTTP Basic
require 'gollum/frontend/app'
require 'digest/sha1'
class App < Precious::App
User = Struct.new(:name, :email, :password_hash, :can_write)
before { authenticate! }
before /^\/(edit|create|delete|livepreview|revert)/ do authorize_write! ; end
helpers do
@wedy
wedy / gist:96aa5bfd3959cc0a0dfa
Last active August 29, 2015 14:05
git pre-commit hook using rubocop in ruby
#!/usr/bin/env ruby
require 'rubocop'
git_changed_rows = `git status --porcelain`
changed_rows_array = git_changed_rows.split(/\n/)
added_or_changed_rows_array = changed_rows_array.select { |row| row =~ /A|AM|^M/ }