⌘T | go to file |
⌘⌃P | go to project |
⌘R | go to methods |
⌃G | go to line |
⌘KB | toggle side bar |
⌘⇧P | command prompt |
This file contains 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 |
This file contains 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 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 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 |
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 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 |
This file contains 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
# If you're having cert issues on ruby 2.0.0-p0, the issue is most likely that ruby can't | |
# find the required intermediate certificates. If you built it via rbenv/ruby-build, then | |
# the certs are already on your system, just not where ruby expects them to be. | |
# When ruby-build installs openssl, it installs the CA certs here: | |
~/.rbenv/versions/2.0.0-p0/openssl/ssl/cacert.pem | |
# Ruby is expecting them here: | |
$(ruby -ropenssl -e 'puts OpenSSL::X509::DEFAULT_CERT_FILE') | |
# Which for me, is this path: |
Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
OlderNewer