Skip to content

Instantly share code, notes, and snippets.

View jptoto's full-sized avatar
😃

JP Toto jptoto

😃
View GitHub Profile
@jptoto
jptoto / phpmailer.php
Created May 26, 2015 18:06
PHP Mailer Example
<?php
require 'PHPMailer/PHPMailerAutoload.php';
$mail = new PHPMailer;
//$mail->SMTPDebug = 3; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp.postmarkapp.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
mysqlimport.exe --fields-terminated-by="," --lines-terminated-by="|" --fields-optionally-enclosed-by="\"" --force --ignore -u root -p poc c:\Users\jtoto\Desktop\service.txt
@jptoto
jptoto / deploy.rb
Created March 25, 2009 18:41 — forked from r38y/deploy.rb
# this is for multistage deployments... to deploy to staging, do "cap staging deploy"
# this is also set up for passenger deployments
# change stuff where it says CHANGEME
# set stage-specific stuff in the task named after the stage below
set :domain, "CHANGME"
role :web, domain
role :app, domain
role :db, domain, :primary => true
/*
* Copyright 2004-2009 James House
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@jptoto
jptoto / global.asax
Created February 8, 2011 20:09
global.asax
namespace WebUI
{
// Note: For instructions on enabling IIS6 or IIS7 classic mode,
// visit http://go.microsoft.com/?LinkId=9394801
public class MvcApplication : NinjectHttpApplication
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
@jptoto
jptoto / AuthorizeAttribute.cs
Created February 8, 2011 20:12
AuthorizeAttribute.cs
private IUserRepository userRepository;
public CloudAuthorizeAttribute()
{
userRepository = MvcApplication.Container.Get<IUserRepository>();
}
@jptoto
jptoto / Sample Test
Created February 10, 2011 16:26
Sample Test w/ Moq
[Test]
public void Can_View_A_Single_Page_Of_Products()
{
//Arrange, if there are 5 products in the repository...
IProductsRepository repository = UnitTestHelpers.MockProductsRepository(
new Product { Name = "P1" }, new Product { Name = "P2" }, new Product { Name = "P3" },
new Product { Name = "P4" }, new Product { Name = "P5" }
);
var controller = new ProductsController(repository);
@jptoto
jptoto / Process Starter
Created April 4, 2011 14:51
Start a windows process / .exe
public class FileImporter {
public void RunImport() {
bool wait = true;
string exec = ConfigurationManager.AppSettings["Executable"];
string switches = ConfigurationManager.AppSettings["Switches"];
string parameters = ConfigurationManager.AppSettings["Params"];
string startDirectory = ConfigurationManager.AppSettings["StartDirectory"];
require 'rubygems'
require 'fileutils'
require 'albacore'
@buildnumber = 10
@deployroot = "c:/deploy/raf/"
task :default => [:versioning, :build, :cleandeploy, :publish]
assemblyinfo :versioning do |asm|
@jptoto
jptoto / authcookie.cs
Created May 14, 2011 17:02
Manually set Auth Cookie
HttpContext.Current.Response.Cookies.Set(new HttpCookie(name, data));