Jeg skal nå dele verdens enkleste måte å lage en nydelig pakistansk lammegryte på, helt fra scratch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Compile and show [GFM](https://help.github.com/articles/github-flavored-markdown) docs in your browser. | |
# Before this works you need to `gem install bcat` | |
# | |
# Usage: gfm.sh FILE.md | |
# | |
curl --silent --data-binary @- https://api.github.com/markdown/raw -H "Content-Type: text/plain" | bcat |
Use case: Travis CLI. One command invokes one or more sequential HTTP requests.
Note that startup time and the first request are very significant for a command line tool like this.
Clone the repo if you want to follow along.
Note: numbers might be due to how libraries are used (via faraday)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ActiveRecord | |
module ApplicationName | |
def self.included(base) | |
unless base.respond_to? :establish_connection_with_application_name | |
base.extend ClassMethods | |
base.class_eval do | |
class << self | |
alias_method_chain :establish_connection, :application_name | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sublime, sublime_plugin | |
import os | |
class DetectFileTypeCommand(sublime_plugin.EventListener): | |
""" Detects current file type if the file's extension isn't conclusive """ | |
""" Modified for Ruby on Rails and Sublime Text 2 """ | |
""" Original pastie here: http://pastie.org/private/kz8gtts0cjcvkec0d4quqa """ | |
def on_load(self, view): | |
filename = view.file_name() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def quoted_date(value) | |
if value.acts_like?(:time) && value.respond_to?(:usec) | |
begin | |
"#{value.getutc.to_s(:db)}.#{sprintf("%06d", value.usec)} #{value.formatted_offset}" | |
rescue | |
"#{super}.#{sprintf("%06d", value.usec)}" | |
end | |
else | |
super |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Rack middleware to insert git commit id into http response header | |
# For Rails, put this script under RAILS_ROOT/config/initializers | |
module Rack | |
class GitCommitHeader | |
def initialize(app) | |
@app = app | |
c = `git rev-parse HEAD`.chomp | |
@commit = (c =~ /^[0-9a-f]{40}$/) ? c : nil | |
end |
NewerOlder