Skip to content

Instantly share code, notes, and snippets.

View bibstha's full-sized avatar
💭
🇳🇵🇨🇦

Bibek Shrestha bibstha

💭
🇳🇵🇨🇦
  • Vancouver, Canada
  • 20:17 (UTC -07:00)
View GitHub Profile
module Quackable
def self.included(base)
base.extend ClassMethods
end
module ClassMethods
def has_voice(word)
@words ||= []
@words << word
end

Some intermediate tips for VIM enthusiasts

In the beginning, there was the basics:

Command Mode
i - Insert Mode
a - Insert after the character
I - Insert at the beginning of the line
A - Insert at the end of the line
@bibstha
bibstha / gist:49540af53fa0ec5ab869
Last active February 5, 2021 07:47
Deploy to dokku from codeship.com

After migrating from heroku to dokku, we had to also chance codeship so we deploy to dokku. I followed the following steps to successfully deploy to dokku.

  1. Save the public key of the codeship project. It is found in Project Settings > General Settings.
  2. Copy the public key to a file /tmp/codeship_projectname.pub.
  3. Make sure when pasting, all the contents are in a single line and not multiple lines.
  4. Add the public key to dokku using the following command in console. Reference.
cat /tmp/codeship_projectname.pub | ssh root@yourdokkuinstance "sudo sshcommand acl-add dokku [description]"
require 'ruleby'
include Ruleby
class CoffeeOperationRulebook < Rulebook
# Note the rules do not have to be in order
def rules
rule [Machine, :m, m.status == :GRINDING] do |v, e|
puts "Grinding complete, puring coffee"
v[:m].status = :POURING
e.modify v[:m]
<a href="javascript:var l = document.location; new_href = l.origin + '.eaccess.ub.tum.de' + l.pathname + l.search; window.location.href = new_href">Access with TUM</a>
@bibstha
bibstha / deploy.rb
Created September 16, 2013 09:54
Integrate whenever with capistrano. Add the following lines to automatically update crontab after cap deploy
set :whenever_command, "bundle exec whenever"
set :whenever_identifier, defer { "#{:myappname}_#{:production}" }
require "whenever/capistrano"
after "deploy:restart", "whenever:update_crontab"