Skip to content

Instantly share code, notes, and snippets.

View jptoto's full-sized avatar
😃

JP Toto jptoto

😃
View GitHub Profile
@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 / 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 / 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 / uploadify.js
Created May 15, 2011 20:14
uploadify
$(document).ready(function() {
$("#fileUpload2").fileUpload({
'uploader': 'uploadify/uploader.swf',
'cancelImg': 'uploadify/cancel.png',
'script': 'uploadify/upload.php',
'folder': '',
'multi': true,
'fileDesc': 'Afbeeldingen',
'fileExt': '*.jpg;*.jpeg;*.gif;*.png',
'checkScript': 'uploadify/check.php',
@jptoto
jptoto / authcookie.cs
Created May 14, 2011 17:02
Manually set Auth Cookie
HttpContext.Current.Response.Cookies.Set(new HttpCookie(name, data));
require 'rubygems'
require 'fileutils'
require 'albacore'
@buildnumber = 10
@deployroot = "c:/deploy/raf/"
task :default => [:versioning, :build, :cleandeploy, :publish]
assemblyinfo :versioning do |asm|
@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"];
@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 / AuthorizeAttribute.cs
Created February 8, 2011 20:12
AuthorizeAttribute.cs
private IUserRepository userRepository;
public CloudAuthorizeAttribute()
{
userRepository = MvcApplication.Container.Get<IUserRepository>();
}
@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}");