Skip to content

Instantly share code, notes, and snippets.

View jptoto's full-sized avatar
😃

JP Toto jptoto

😃
View GitHub Profile
@jptoto
jptoto / AccountController.cs
Created June 8, 2011 19:45
Encrypting Passwords
[HttpPost]
public ActionResult Logon(LoginUserViewModel loginUser)
{
if (!ModelState.IsValid)
return View(loginUser);
User user = userRepository.GetUser(loginUser.UserName);
if (user != null)
{
@jptoto
jptoto / search_stored_procs.sql
Created June 13, 2011 16:01
Searching for txt in a Stored Proc
SELECT ROUTINE_NAME, ROUTINE_DEFINITION
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_DEFINITION LIKE '%TEXT%'
AND ROUTINE_TYPE='PROCEDURE'
@jptoto
jptoto / gist:1054231
Created June 29, 2011 16:25
Tacking URL Function for SSRS
Function GetTrackingURL(ServiceProvider as String, TrackingNumber as String)
If ServiceProvider = "UPS" Then
Return string.format("http://wwwapps.ups.com/WebTracking/processInputRequest?InquiryNumber1={0}&sort_by=status&tracknums_displayed=1&TypeOfInquiryNumber=T&track.x=0&track.y=0",TrackingNumber)
Else
Return string.format("http://www.fedex.com/Tracking?tracknumbers={0}&action=track&language=english&state=0&cntry_code=us",TrackingNumber)
End If
End Function
@jptoto
jptoto / webapi.cs
Created February 1, 2012 12:42
WebAPI Error Catch
[WebInvoke(UriTemplate = "", Method = "POST")]
public Email Post(Email email)
{
try
{
repository.Add(email);
foreach (var file in email.Attachments)
{
// ReSharper disable CheckNamespace
namespace RestSharp.Deserializers
// ReSharper restore CheckNamespace
{
public class DynamicJsonDeserializer : IDeserializer
{
public string RootElement { get; set; }
public string Namespace { get; set; }
public string DateFormat { get; set; }
@jptoto
jptoto / gist:5265126
Last active December 15, 2015 13:09
Postmark PHP Inbound Example
<?php
// Uses https://github.com/jjaffeux/postmark-inbound-php
require_once 'lib/Postmark/Autoloader.php';
\Postmark\Autoloader::register();
$inbound = new \Postmark\Inbound(file_get_contents('php://input'));
$filename = 'test.txt';
@jptoto
jptoto / gist:6225332
Created August 13, 2013 20:27
Swift PHP Mailer Example
<?php
require_once 'lib/swift_required.php';
// Create the Transport
$transport = Swift_SmtpTransport::newInstance('staging-smtp.postmarkapp.com', 2525)
->setUsername('api_key')
->setPassword('api_key')
;
/*
@jptoto
jptoto / gist:7910411
Created December 11, 2013 13:27
log4net Debug
<appSettings>
<add key="log4net.Internal.Debug" value="true"/>
</appSettings>
<system.diagnostics>
<trace autoflush="true">
<listeners>
<add
name="textWriterTraceListener"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="C:\temp\log4net.txt" />
* How do I release this?
* I must be able to perform a 'rolling' release this in a live system w/o
causing a service interruption
* does it break backward compatability with existing users of the api/system/etc
* do we need to cut a new XSD? A new version (URI prefix) of our API?
* did we make updates to checkouts/SNAPSHOT deps? Do we need to cut new versions of project deps?
* how do I support existing users?
* in what order do the affected systems need to be released?
* are there system or service configuration changes that are required?
* What are the Security implications of my change?
Introduction to Elasticsearch
Elasticsearch is a flexible and powerful open source, distributed, real-time search and analytics engine. Architected
from the ground up for use in distributed environments where reliability and scalability are must haves, Elasticsearch
gives you the ability to move easily beyond simple full-text search.
In this demonstration, Nick will take us through installing Elasticsearch and creating a cluster. He'll talk about
configuration and best practices and some examples of how we use Elasticsearch at Wildbit on both Postmark and
Beanstalk. JP will introduce Elasticsearch queries and talk about how information is indexed in Elasticsearch.
He'll review aggregating data and the benefits of full-text searching.