Skip to content

Instantly share code, notes, and snippets.

View nescalante's full-sized avatar
🐢

Nicolas Escalante nescalante

🐢
View GitHub Profile
@nescalante
nescalante / DataUtil.cs
Last active December 11, 2015 04:39
Store Procedure to DataTable Helper
using System;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Reflection;
public static class DataUtil
{
public static T Fill<T>(string procedureName, string connectionString, object values = null, object mappings = null) where T : DataSet, new()
{
@nescalante
nescalante / MailerBase.cs
Created March 4, 2013 14:35
Mvc Mail Sender
using System;
using System.Diagnostics;
using System.IO;
using System.Net.Mail;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
public abstract class MailerBase : ControllerBase
{
@nescalante
nescalante / linq.js
Created August 16, 2013 14:13
LINQ-style Javascript Array Extensions
Array.prototype.sum = function (selector) {
var source = this;
var totalSum = 0;
for (var i = 0; i < source.length; i++) {
totalSum += selector(source[i]);
}
return totalSum;
};
@nescalante
nescalante / SCP.js
Last active May 2, 2020 18:25
Horas del SCP
var doc = window.frames[1] ? window.frames[1].frames[0].document : document,
user = doc.all.usuario_id.value,
array = doc.querySelectorAll(".linkmenu > div[width]"),
list = [],
url = "/SCP/cargaHoras/blanco.asp",
proyecto = getByName('cmb_proyectos'),
tarea = getByName('cmb_tareas'),
empresa = getByName('cmb_empresas'),
request = {
usuario: user,
@nescalante
nescalante / array-batch.js
Last active August 29, 2015 13:58
Array batch execution
function batch(array, size, callback, done) {
var index = 0,
processed = 0;
while (index < size) {
next();
}
function next() {
var item = array[index];
@nescalante
nescalante / container.js
Created July 23, 2014 17:41
container.js
var container = (function() {
var instances = {};
return {
set: function (key, value) {
instances[key] = value;
},
get: function (key) {
return instances[key]
}
SET @scriptName = '$(fileName)'
DECLARE @count int
select @count = count(Name) from Script where Name = @scriptName and RanOk = 1
IF (@count = 0)
BEGIN
BEGIN TRY
BEGIN TRANSACTION
@nescalante
nescalante / SP_RunScript.sql
Created July 24, 2014 13:29
RunScript Stored Procedure
IF ( OBJECT_ID('dbo.RunScript') IS NOT NULL )
DROP PROCEDURE dbo.RunScript
GO
CREATE PROCEDURE dbo.RunScript
@scriptUrl nvarchar(max)
AS
BEGIN
SET NOCOUNT ON
@nescalante
nescalante / affirmation
Created December 11, 2014 21:56
MuleSoft Contributor Agreement Acceptance by Nicolas Escalante
I, Nicolas Escalante, have read and do accept the MuleSoft Contributor Agreement
at http://www.mulesoft.org/legal/contributor-agreement.html
Accepted on Thu Dec 11 2014 18:56:55 GMT-0300 (Argentina Standard Time)
@nescalante
nescalante / getElementsByClassName.js
Created January 8, 2015 16:10
Polyfill for getElementsByClassName
if (!document.getElementsByClassName) {
document.getElementsByClassName = function(search) {
var d = document, elements, pattern, i, results = [];
if (d.querySelectorAll) { // IE8
return d.querySelectorAll("." + search);
}
if (d.evaluate) { // IE6, IE7
pattern = ".//*[contains(concat(' ', @class, ' '), ' " + search + " ')]";
elements = d.evaluate(pattern, d, null, 0, null);
while ((i = elements.iterateNext())) {