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
# Quick way to log both stubbing instructions and the response of a real request. | |
# Useful for stubbing real requests without having to resort to VCR. | |
WebMock.allow_net_connect! | |
WebMock.after_request do |request_signature, response| | |
puts "\nA real HTTP request was made." | |
puts WebMock::RequestSignatureSnippet.new(request_signature).stubbing_instructions | |
puts "----- RESPONSE HEADERS -----" |
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/bash | |
DBNAME=${DBNAME:-database} | |
help() { | |
echo "A very lol key/value database written in bash. | |
usage: bashdb <command> <args> | |
get <key> Get a value from the database |
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 { Observable } from 'rxjs' | |
// Takes a higher-order observable as input and subscribes to its inner | |
// observables. Emits an array containing the last emitted value from each *active* | |
// inner observable when: | |
// | |
// 1. any inner observable emits | |
// 2. any inner observable completes | |
// | |
// In contrast to `combineLatest`, the latest value from completed observables |
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
# Allows `require` to work for libs outside of Bundler's environment, so you can require | |
# gems that aren't in the project's Gemfile while inside an irb session (for example). | |
if defined?(Gem.post_reset_hooks) | |
Gem.post_reset_hooks.reject!{ |hook| hook.source_location.first =~ %r{/bundler/} } | |
Gem::Specification.reset | |
load 'rubygems/custom_require.rb' | |
alias gem require | |
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
@import 'compass/css3'; | |
// Create a media query for hidpi (retina) devices. If `$image` is provided, | |
// generates CSS that sets the image as a background for both normal and hidpi | |
// screens, assuming that the hidpi version ends with `@2x` before the file | |
// extension. `$extension` must be supplied separately because Sass does not | |
// yet support string substitution (defaults to png). | |
// | |
// Note: assumes a Rails 3.1 environment using the asset pipeline with compass | |
// installed. Only minimal changes are needed for it to work elsewhere. |
I love my new 13" rMBP, but there are performance issues here and there - Sublime is definitely one of them. However with a few tweaks I've been able to get performance up to what I would call acceptable.
Steps:
- Grab the latest build of Sublime (currently 2219); it has retina fixes. http://www.sublimetext.com/nightly
- Install HEAD of the Soda theme (instructions under "Download Manually"): https://github.com/buymeasoda/soda-theme/
- Make these tweaks to your User Preferences (cmd-,):
{
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
VCR.configure do |c| | |
c.after_http_request do |request, response| | |
puts "\n\n#{request.method.upcase} #{request.uri}" | |
puts | |
puts caller.grep(/^#{Rails.root}/) | |
puts | |
puts request.to_yaml | |
puts | |
puts response.to_yaml | |
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
require 'parallel' # gem install parallel (https://github.com/grosser/parallel) | |
# Monkey patch to Sprockets::StaticCompiler, a class provided by actionpack | |
# that's used by the assets:precompile task. This patch uses the Parallel gem | |
# to parallelize asset compilation in the simplest way possible. | |
# | |
# Parallel wraps Process.fork to handle things like inter-process communication | |
# via pipes and determining the maximum number of processes to run based on | |
# your system's total logical processors. So far only tested on MRI 1.9.3 on OS X. | |
module Sprockets |
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
# encoding: utf-8 | |
module Mongoid #:nodoc: | |
module Associations #:nodoc: | |
module EmbeddedCallbacks | |
# bubble callbacks to embedded assocaitions | |
def run_callbacks(*args) | |
# now bubble callbacks down | |
self.associations.each_pair do |name, meta| | |
if meta.association == Mongoid::Associations::EmbedsMany |
NewerOlder