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
| defmodule TimeMacro do | |
| defmacro deftime(function_name, [do: block] = expression) do | |
| quote do | |
| def unquote(function_name) do | |
| start_time = NaiveDateTime.utc_now() | |
| result = unquote(block) | |
| finish_time = NaiveDateTime.utc_now() | |
| IO.puts("sent #{start_time} and #{finish_time}") | |
| result | |
| 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 Ember from 'ember'; | |
| import computed from 'ember-computed'; | |
| export default Ember.Component.extend({ | |
| classNameBindings: ['componentName'], | |
| componentName: computed(function() { | |
| return this | |
| .toString() | |
| .match(/:(.+)::/)[1] | |
| }), |
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 Ember from 'ember'; | |
| import titleComponent from 'app/components/x-list/list-item' | |
| export default Ember.Component.extend({ | |
| titleComponent: titleComponent, | |
| }); |
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
| require 'pry' | |
| results = `git branch -r`.split("\n") | |
| ignored = ['master', 'production', 'new_mobile_nav'] | |
| results.map!(&:strip) | |
| results.map! do |branch| | |
| args = branch.split("/") | |
| [args[0], args[1]] |
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 NavigationHelpers | |
| def path_to(page_name) | |
| case page_name | |
| when /the home\s?page/ | |
| '/' | |
| when /^that ([\w ]+)'s page$/ | |
| polymorphic_path(instance_variable_get("@#{$1.parameterize('_')}")) | |
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
| require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths")) | |
| Given /^(?:|I )am on (.+)$/ do |page_name| | |
| visit path_to(page_name) | |
| end | |
| Then /^(?:|I )should be on (.+)$/ do |page_name| | |
| current_path = URI.parse(current_url).path | |
| if current_path.respond_to? :should | |
| current_path.should == path_to(page_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
| US_STATES = [ | |
| ['Alabama', 'AL'], | |
| ['Alaska', 'AK'], | |
| ['Arizona', 'AZ'], | |
| ['Arkansas', 'AR'], | |
| ['California', 'CA'], | |
| ['Colorado', 'CO'], | |
| ['Connecticut', 'CT'], | |
| ['Delaware', 'DE'], | |
| ['District of Columbia', 'DC'], |
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
| unless defined?(Rails) | |
| require 'active_record' | |
| connection_info = YAML.load(File.open("config/database.yml"))["test"] | |
| ActiveRecord::Base.establish_connection(connection_info) | |
| RSpec.configure do |config| | |
| config.around do |example| | |
| ActiveRecord::Base.transaction do |
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
| require 'active_model' | |
| def errors_on(attribute) | |
| self.valid? | |
| [self.errors[attribute]].flatten.compact | |
| end | |
| alias :error_on :errors_on |
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
| %ul | |
| - Dir.glob('app/views/ui/*.html.haml').sort.each do |file| | |
| - wireframe = File.basename(file,'.html.haml') | |
| - unless wireframe == 'index' || wireframe.match(/^_/) | |
| %li= link_to wireframe.titleize, action: wireframe unless wireframe == 'index' |
NewerOlder