Skip to content

Instantly share code, notes, and snippets.

View logicbomb's full-sized avatar

Jason Turim logicbomb

  • Chevy Chase, MD
View GitHub Profile
@logicbomb
logicbomb / keybase.md
Created March 31, 2020 21:10
keybase proof

Keybase proof

I hereby claim:

  • I am logicbomb on github.
  • I am jason_t (https://keybase.io/jason_t) on keybase.
  • I have a public key whose fingerprint is 1EFF FCD8 4C77 5312 900C 47D4 B18F 6B2C B61A 596E

To claim this, I am signing this object:

@logicbomb
logicbomb / check_twilio_errors.sh
Last active January 20, 2016 20:17
Scripts for retrieving and scrubbing twilio message documents
#!/bin/bash
ERR_CODE="∑"
while [ $# -gt 0 ]; do
case "$1" in
-e | --error_code)
ERR_CODE=$2
;;
esac
shift
@logicbomb
logicbomb / twilio_error_codes.csv
Last active September 3, 2023 22:06
Twilio error codes
Code Desc Details
10001 Account is not active https://www.twilio.com/docs/api/errors/10001
10002 Trial account does not support this feature https://www.twilio.com/docs/api/errors/10002
10003 Incoming call rejected due to inactive account https://www.twilio.com/docs/api/errors/10003
11100 Invalid URL format https://www.twilio.com/docs/api/errors/11100
11200 HTTP retrieval failure https://www.twilio.com/docs/api/errors/11200
11205 HTTP connection failure https://www.twilio.com/docs/api/errors/11205
11206 HTTP protocol violation https://www.twilio.com/docs/api/errors/11206
11210 HTTP bad host name https://www.twilio.com/docs/api/errors/11210
11215 HTTP too many redirects https://www.twilio.com/docs/api/errors/11215
//set up fake it easy
var authService = A.Fake<IAuthenticationService>();
var connFactory = A.Fake<IDbConnectionFactory>();
var publisher = A.Fake<IPublisher>();
var identity = A.Fake<IUserIdentity>();
A.CallTo(() => identity.Claims).Returns(new List<string> {"Admin"});
A.CallTo(() => identity.UserName).Returns("[email protected]");
A.CallTo(()=>authService("[email protected]", "password")).Returns(new User{Id=1, Claims=new List<string> {"admin"});
@{ var x = 0 }
<h2>
@(89/x).ToString()
</h2>
@{ var x = 0 }
<h2>
@(89/x).ToString()
</h2>
public class TestModule : NancyModule
{
public TestModule()
{
Get["/error-handled"] = _ => {
// the error handler is called
var x = 0;
return (89/x).ToString();
};
@logicbomb
logicbomb / gist:4060140
Created November 12, 2012 15:54
Process doesn't exit after delayed start
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using Quartz;
using Quartz.Impl;
namespace quartz.test
{
public class MyModule : NancyModule
{
public MyModule()
{
// this occasionally causes OutOfRangeException
Get["/{id}"] => x => getView(x.Id);
// this works without issue
Get["/{id}"] => x => getView((Guid)x.Id);
}
public enum CoreLogLevel
{
Debug, Error, Fatal, Info, Warn
}
public interface ICoreLogService
{
void Start(Uri saveLocation, int persistAfterThisManyMessagesHaveBeenLogged = 1);
void Stop();
void LogMessage(CoreLogLevel level, ILoggingSource source, string msg, params object[] formatParameters);