This is content converted from Markdown!
Here's a JSON sample:
{
"foo": "bar"
}| # backbone_sync.coffee | |
| # Defines a synchronization strategy that works with the Google Gadgets container | |
| # options hash: | |
| # "manualOverride" defines a callback that takes the "obj" parameters from | |
| # makeRequest; intended for manually inspecting/parsing the service response. | |
| # "success" and "error" are like their Backbone.js equivalents. | |
| # "nocache" if truthy, ignore the value in makeRequest() cache. | |
| Backbone.sync = (method, model, options) -> | |
| syncParams = {} | |
| syncParams[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.JSON |
| log_level :info | |
| log_location STDOUT | |
| ssl_verify_mode :verify_none | |
| chef_server_url "http://localhost:4001" | |
| signing_ca_path "/var/chef/ca" | |
| couchdb_database 'chef' | |
| cookbook_path [ "/Users/dra/git/chef/cookbooks" ] | |
| indexer: chef-expander -n1 | |
| solr: chef-solr | |
| server: chef-server -N -e production -p 4001 | |
| serverweb: chef-server-webui -p 4040 -e production |
| #!/usr/bin/env ruby | |
| require 'httparty' | |
| require 'optparse' | |
| require 'ostruct' | |
| # That was simple | |
| class PingdomAPI | |
| include HTTParty | |
| base_uri 'https://api.pingdom.com/' |
| using System.Threading.Tasks; | |
| using Microsoft.AspNetCore.Builder; | |
| using Microsoft.AspNetCore.Http; | |
| namespace interval.Support { | |
| public class ReverseProxyHttpsEnforcer { | |
| private const string ForwardedProtoHeader = "X-Forwarded-Proto"; | |
| private readonly RequestDelegate _next; | |
| public ReverseProxyHttpsEnforcer(RequestDelegate next) { |
| public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory lf) { | |
| if (env.IsDevelopment()) { | |
| app.UseDeveloperExceptionPage(); | |
| } else { | |
| app.UseExceptionHandler("/error"); | |
| app.UseReverseProxyHttpsEnforcer(); | |
| } | |
| app.UseAuthentication(); | |
| app.UseStaticFiles(); |
| // Bad version | |
| protected DollarCents Calculate() { | |
| var x = Events.OfType<CardSaleAttached>().Select(e => e.Sale) | |
| .Aggregate(DollarCents.Zero, (a, b) => a + b.SecuredMoney()); | |
| var y = Events.OfType<FolioPaymentReceived>() | |
| .Aggregate(DollarCents.Zero, (a, b) => a + b.Amount); | |
| return x + y; | |
| } | |
| // Good version |
| public virtual CheckInRequestResult CanCheckIn(EventHydrationContext ehc, IClock clock, | |
| ReservationFolioState fs) { | |
| if (State == ReservationState.CheckedIn) { | |
| return CheckInRequestResult.AlreadyCheckedIn; | |
| } | |
| if (State != ReservationState.Open) { | |
| return CheckInRequestResult.NoOpenReservation; | |
| } |
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Net; | |
| using System.Net.Http; | |
| using System.Net.Http.Headers; | |
| using System.Text; | |
| using System.Threading.Tasks; | |
| using Microsoft.AspNetCore.Http; | |
| using Microsoft.AspNetCore.Http.Extensions; |