Skip to content

Instantly share code, notes, and snippets.


Trak Trak Trugui traktraktrugui

  • Sao Paulo, Brazil
View GitHub Profile
traktraktrugui / SelectLastTopN.sql
Last active Feb 20, 2017
SQL Server Shortcuts procedure to select the latest lines, ordered by PK column
View SelectLastTopN.sql
Use master
--Declare @DB as VarChar(200) = db_name(); exec master.dbo.SelectLastTopN 50, @DB,
If OBJECT_ID('SelectLastTopN') Is Not Null Drop Procedure SelectLastTopN
Create Procedure SelectLastTopN
traktraktrugui / Program.cs
Created May 7, 2016 — forked from DanielSWolf/Program.cs
Console progress bar. Code is under the MIT License:
View Program.cs
using System;
using System.Threading;
static class Program {
static void Main() {
Console.Write("Performing some task... ");
using (var progress = new ProgressBar()) {
for (int i = 0; i <= 100; i++) {
progress.Report((double) i / 100);
traktraktrugui / Pluralsight_OrderByAsc_Date.js
Created Dec 3, 2014
Ordenate Pluralsight courses by date ascending
View Pluralsight_OrderByAsc_Date.js
// ==UserScript==
// @name Order Pluralsight Courses
// @version 1.1
// @description Ordena o cursos da pluralsight por data
// @match http://**
// @require
// @copyright 2014+, Rods
// ==/UserScript==
var s_ajaxListener = new Object();
View WebProxy.cs
WebService wsrc = new WebService();
wsrc.Proxy = WebRequest.DefaultWebProxy;
wsrc.Proxy.Credentials = CredentialCache.DefaultNetworkCredentials;
traktraktrugui / bdisp.xml
Created Nov 6, 2013
Code Snippets for the Dispose Pattern
View bdisp.xml
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="">
<CodeSnippet Format="1.0.0">
<Title>Base class disposable implementation.</Title>
Code snippet to create a scheleton implementation
of the IDisposable pattern for a base class.
traktraktrugui / RenderPartialViewToString.cs
Created Oct 17, 2013
Render MVC PartialView To String
View RenderPartialViewToString.cs
public string RenderPartialViewToString(string viewName, object model)
if (string.IsNullOrEmpty(viewName))
viewName = ControllerContext.RouteData.GetRequiredString("action");
ViewData.Model = model;
using (StringWriter sw = new StringWriter())
ViewEngineResult viewResult = ViewEngines.Engines.FindPartialView(ControllerContext, viewName);
traktraktrugui / GetLastLineFromTextFile.cs
Created Oct 17, 2013
Get a last line from a text file
View GetLastLineFromTextFile.cs
void Main()
string fileName = @"c:\windows\setupapi.log";
byte[] array = new byte[100];
using (FileStream fs = new FileStream(fileName, FileMode.Open))
if (fs.CanSeek && fs.Length > 100)
fs.Position = fs.Length - 100;
View DynamicStatus.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using System.Data;
using System.ComponentModel;
using System.Dynamic;
namespace DynamicStatus
View MailAddressCollection.cs
using System;
using System.Net.Mail;
using System.Text;
using System.Text.RegularExpressions;
public class EmailHelper
MailAddressCollection EmailsTo = new MailAddressCollection();
/// <summary>
traktraktrugui / SVN2.flt
Created Oct 17, 2013
WinMerge Filters SVN
View SVN2.flt
## This is a directory/file filter template for WinMerge
name: SVN2
desc: SVN2
## Select if filter is inclusive or exclusive
## Inclusive (loose) filter lets through all items not matching rules
## Exclusive filter lets through only items that match to rule
## include or exclude
def: include