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
defmodule MyApp.App.Mixfile do | |
use Mix.Project | |
def project do | |
[ | |
app: :my_app, | |
version: "0.0.1-#{sha()}", | |
... | |
def sha do |
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
... | |
defp deps do | |
[... | |
{:prometheus, "~> 4.0", override: true}, | |
{:prometheus_ex, "~> 3.0"}, | |
{:prometheus_phoenix, "~> 1.2"}, | |
{:prometheus_plugs, "~> 1.1.5"}, | |
{:prometheus_ecto, "~> 1.0.1"}, | |
{:prometheus_process_collector, "~> 1.3.1"} |
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
# see http://stackoverflow.com/questions/1698335/can-i-use-rspec-mocks-to-stub-out-version-constants | |
class Object | |
def self.with_constants(constants, &block) | |
saved_constants = {} | |
constants.each do |constant, val| | |
saved_constants[ constant ] = const_get( constant ) | |
Kernel::silence_warnings { const_set( constant, val ) } | |
end | |
begin |
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
Why | |
--- | |
My site is backbone.js and rails, including the static marketing content. I wanted this content to be readable by google and I don't want two copies. | |
Background | |
---------- | |
I'm using the haml_assets gem so I can write backbone.js views in haml. | |
Routes | |
------ |
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
group :development, :test do | |
gem 'jasmine', '1.2.0.rc2', :git => 'https://github.com/pivotal/jasmine-gem.git', :require => false | |
# gem 'jasmine' | |
gem 'headless', :require => false | |
bundle install | |
bundle exec jasmine init | |
rm lib/tasks/jasmine.rake |
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
do -> | |
_parse = Backbone.Model.prototype.parse | |
_.extend Backbone.Model.prototype, | |
initNestedCollections: (nestedCollections) -> | |
@_nestedCollections = {} | |
_.each nestedCollections, (theClass, key) => | |
@_nestedCollections[key] = new theClass([]) | |
@resetNestedCollections() |
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
## remember to add this file to application.rb | |
## config.assets.precompile << 'site.js' | |
#= require_self | |
#= require_tree ./site/template | |
#= require_tree ./site/view | |
window.Site = |
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
TEMPLATE | |
---- | |
%form#uploadAsset{"accept-charset" => "UTF-8", :action => "/admin/assets", "data-remote" => "true", :enctype => "multipart/form-data", :method => "post"} | |
%div{:style => "margin:0;padding:0;display:inline"} | |
%input{:name => "utf8", :type => "hidden", :value => "✓"}/ | |
%input{:name => "authenticity_token", :type => "hidden", :value => ""}/ | |
.element | |
.avatar.thin | |
%label.hint#assetLabel | |
Your Asset |
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
TEMPLATE | |
-------- | |
%div{:style => "margin:0;padding:0;display:inline"} | |
%input{:name => "utf8", :type => "hidden", :value => "✓"}/ | |
%input{:name => "authenticity_token", :type => "hidden", :value => ""}/ | |
%input{:name => "_method", :type => "hidden", :value => "put"}/ | |
VIEW | |
---- |
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 'rspec/core/formatters/base_formatter' | |
class FormatterPretty < RSpec::Core::Formatters::BaseFormatter | |
PENDING_FORMAT = "\e[1m\e[37m%s\n\e[33m [PENDING] %s\e[0m" | |
PENDING_FORMAT_MSG = " \e[34m%s\e[0m" | |
PENDING_FORMAT_CALLER = " \e[34m# %s\e[0m" | |
FAILURE_FORMAT = "\e[1m\e[37m%s\n\e[31m\e[1m[FAILURE] %s\e[0m" | |
FAILURE_FORMAT_LINE = " \e[31m%s\e[0m" |
NewerOlder