Skip to content

Instantly share code, notes, and snippets.

View tommarien's full-sized avatar

Tom Marien tommarien

View GitHub Profile

Network Requests

There are a few ways to get info from an API


What is await?

const response = await fetch("mysite.com/api/dogs")
[alias]
co = checkout
stat = status
[merge]
tool = p4merge
[mergetool "p4merge"]
keepTemporaries = false
prompt = false
trustExitCode = false
@tommarien
tommarien / Mongoose
Created December 15, 2016 09:07
Mongoose connection settings
const mongoose = require('mongoose');
mongoose.connect('uri', { mongos: true });
(function ($) {
$(document).ready(function () {
//datepicker convention
$(':text[data-role="datepicker"]').datepicker({
dateFormat: 'dd-mm-yy'
});
});
})(jQuery);
<input type="text" name="birthDate" id="birthDate" data-role="datepicker" />
<h1>Modify your settings</h1>
@using (Html.BeginForm())
{
<div class="control-group">
<label class="control-label">Birthdate</label>
<div class="controls">
<div class="input-append">
<input type="text" name="birthDate" id="birthDate" />
<span class="add-on">
var container = new WindsorContainer()
// opt-in for Lazy
container.Register(Component.For<ILazyComponentLoader>()
.ImplementedBy<LazyOfTComponentLoader>());
// Necessary session registration
// ...
// Bind lifestyle of to whom it is intercepting
using System;
using Castle.DynamicProxy;
using NHibernate;
using IInterceptor = Castle.DynamicProxy.IInterceptor;
namespace Nebula.Bootstrapper.Interceptors
{
public class AutoTxInterceptor : IInterceptor
{
private readonly Lazy<ISession> session;
@tommarien
tommarien / gist:9059266
Last active August 29, 2015 13:56
CommandHandler with manual transaction handling
public class MoveCustomerCommandHandler : ICommandHandler<MoveCustomerCommand>
{
private readonly ISession session;
public MoveCustomerCommandHandler(ISession session)
{
this.session = session;
}
public void Handle(MoveCustomerCommand command)
@tommarien
tommarien / gist:8234469
Created January 3, 2014 07:57
FluentMigrator v2

FluentMigrator V2

Main goals

  • Extensibility
  • Conventionalize
  • Improve reusability

Concepts

Fluent API