Table of Contents
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
| public class Startup | |
| { | |
| public IServiceProvider ConfigureServices(IServiceCollection services) | |
| { | |
| services.AddMvc().AddJsonOptions(options => | |
| { | |
| options.SerializerSettings.Converters.Add(new Newtonsoft.Json.Converters.StringEnumConverter()); | |
| options.SerializerSettings.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore; | |
| }); | |
| } |
- using Ansible command line:
ansible-playbook --connection=local 127.0.0.1 playbook.yml- using inventory:
127.0.0.1 ansible_connection=local
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
| [ | |
| { | |
| "text":"The only people who never fail are those who never try.", | |
| "from":"Ilka Chase" | |
| }, | |
| { | |
| "text":"Failure is just another way to learn how to do something right.", | |
| "from":"Marian Wright Edelman" | |
| }, | |
| { |
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
| # Bash Stuff | |
| alias reload='source ~/.bash_profile' | |
| alias a='echo "------------Your aliases------------";alias' | |
| alias sa='source ~/.bash_profile;echo "Bash aliases sourced."' | |
| alias bp='vim ~/.bash_profile' | |
| # Install git completion here: brew install git bash-completion | |
| [ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion | |
| # Git Stuff |
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
| "use strict"; | |
| var stackTrace = (new Error()).stack; // Only tested in latest FF and Chrome | |
| var callerName = stackTrace.replace(/^Error\s+/, ''); // Sanitize Chrome | |
| callerName = callerName.split("\n")[1]; // 1st item is this, 2nd item is caller | |
| callerName = callerName.replace(/^\s+at Object./, ''); // Sanitize Chrome | |
| callerName = callerName.replace(/ \(.+\)$/, ''); // Sanitize Chrome | |
| callerName = callerName.replace(/\@.+/, ''); // Sanitize Firefox | |
| console.log(callerName) |
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
| App.LibraryRoute = App.ApplicationRoute.extend({ | |
| activate: function () { | |
| //no longer enter | |
| this._super(); | |
| only called once on entering a route. | |
| }, | |
| beforeModel: function () { | |
| // any state you want in place before the model is initialized, this is called before any model promises are resolved | |
| // also could be used to conditionally prevent access to a route by throwing transition.abort |
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 'rails_helper' | |
| RSpec.describe TodosController, :type => :controller do | |
| describe "GET #index" do | |
| #describe "POST #create" do | |
| #describe "GET #show" do | |
| #describe "PATCH #update" do (or PUT #update) | |
| #describe "DELETE #destroy" do | |
| #describe "GET #new" 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
| # Model | |
| expect(@user).to have(1).error_on(:username) # checks whether there is an error in username | |
| expect(@user.errors[:username]).to include("can't be blank") # check for the error message | |
| # Rendering | |
| expect(response).to render_template(:index) | |
| # Redirecting |
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
| # Using these pry gems -- copy to your Gemfile | |
| # group :development, :test do | |
| # gem 'awesome_print' # pretty print ruby objects | |
| # gem 'pry' # Console with powerful introspection capabilities | |
| # gem 'pry-byebug' # Integrates pry with byebug | |
| # gem 'pry-doc' # Provide MRI Core documentation | |
| # gem 'pry-rails' # Causes rails console to open pry. `DISABLE_PRY_RAILS=1 rails c` can still open with IRB | |
| # gem 'pry-rescue' # Start a pry session whenever something goes wrong. | |
| # gem 'pry-theme' # An easy way to customize Pry colors via theme files | |
| # end |