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 EmberRouter from '@ember/routing/router'; | |
| import { computed } from '@ember/object'; | |
| export default Ember.Controller.extend({ | |
| appName: 'Ember Twiddle!', | |
| myRoutes: computed('isInitialized', function(){ | |
| let owner = Ember.getOwner(this); | |
| let router = owner.lookup('router:main'); | |
| let routes = router._routerMicrolib.recognizer.names; |
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
| # Taken from https://thoughtbot.com/blog/how-to-stub-external-services-in-tests | |
| require 'sinatra/base' | |
| class FakeMuxApi < Sinatra::Base | |
| configure :production, :development do | |
| enable :logging | |
| end | |
| post '/video/v1/assets' 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
| # run as `ruby swedish_chef.rb` | |
| # Source: unknown, e.g. copied somewhere from the interwebs | |
| class SwedishChef | |
| def self.call(string) | |
| @string = string | |
| @string.gsub!(/an/, "un") | |
| @string.gsub!(/An/, "Un") | |
| @string.gsub!(/au/, "oo") | |
| @string.gsub!(/Au/, "Oo") |
OlderNewer