Skip to content

Instantly share code, notes, and snippets.

View traktraktrugui's full-sized avatar

Trak Trak Trugui traktraktrugui

  • Sao Paulo, Brazil
View GitHub Profile
@traktraktrugui
traktraktrugui / SelectLastTopN.sql
Last active February 20, 2017 16:18
SQL Server Shortcuts procedure to select the latest lines, ordered by PK column
Use master
go
--SQL SERVER SHORTCUT CTRL+5
--Declare @DB as VarChar(200) = db_name(); exec master.dbo.SelectLastTopN 50, @DB,
If OBJECT_ID('SelectLastTopN') Is Not Null Drop Procedure SelectLastTopN
Go
Create Procedure SelectLastTopN
@traktraktrugui
traktraktrugui / Program.cs
Created May 7, 2016 07:08 — forked from DanielSWolf/Program.cs
Console progress bar. Code is under the MIT License: http://opensource.org/licenses/MIT
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
traktraktrugui / Pluralsight_OrderByAsc_Date.js
Created December 3, 2014 03:43
Ordenate Pluralsight courses by date ascending
// ==UserScript==
// @name Order Pluralsight Courses
// @version 1.1
// @description Ordena o cursos da pluralsight por data
// @match http://*www.pluralsight.com/*
// @require http://code.jquery.com/jquery-latest.js
// @copyright 2014+, Rods
// ==/UserScript==
var s_ajaxListener = new Object();
WebService wsrc = new WebService();
wsrc.Proxy = WebRequest.DefaultWebProxy;
wsrc.Proxy.Credentials = CredentialCache.DefaultNetworkCredentials;
@traktraktrugui
traktraktrugui / bdisp.xml
Created November 6, 2013 03:00
Code Snippets for the Dispose Pattern
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Base class disposable implementation.</Title>
<Shortcut>bdisp</Shortcut>
<Description>
Code snippet to create a scheleton implementation
of the IDisposable pattern for a base class.
</Description>
@traktraktrugui
traktraktrugui / RenderPartialViewToString.cs
Created October 17, 2013 03:12
Render MVC PartialView To String
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
traktraktrugui / GetLastLineFromTextFile.cs
Created October 17, 2013 03:10
Get a last line from a text file
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;
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using System.Data;
using System.ComponentModel;
using System.Dynamic;
namespace DynamicStatus
{
using System;
using System.Net.Mail;
using System.Text;
using System.Text.RegularExpressions;
public class EmailHelper
{
MailAddressCollection EmailsTo = new MailAddressCollection();
/// <summary>
@traktraktrugui
traktraktrugui / SVN2.flt
Created October 17, 2013 02:18
WinMerge Filters SVN
## 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