Skip to content

Instantly share code, notes, and snippets.

View gon250's full-sized avatar
💃
I may be slow to respond.

Gonzalo gon250

💃
I may be slow to respond.
View GitHub Profile
namespace Solution.IoC
{
public class DependencyInjectionProvider
{
private IKernel _kernel;
private void SetUpDependencyInjection()
{
//create _kernel
_kernel = new StandardKernel();
public class JsDateHelper : IJsDateHelper
{
public DateTime FromUnixTime(double unixTime)
{
var epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
return epoch.AddMilliseconds(unixTime);
}
public long ToUnixTime(DateTime date)
{
using Ninject;
using MMWebsites.DAL.Helpers;
using MMWebsites.DAL.Repository;
using MMWebsites.Global.Contracts;
using MMWebsites.Global.Helpers;
namespace MMWebsites.IoC
{
public class DependencyInjectionProvider
@gon250
gon250 / gulpfile.js
Created April 13, 2015 08:22
Quick example - gulp
"use strict";
var gulp = require('gulp'),
jshint = require('gulp-jshint'),
browserSync = require('browser-sync'),
runSequence = require('run-sequence'),
reload = browserSync.reload;
gulp.task('lint', function() {
return gulp.src('./app/**/*.js')
@gon250
gon250 / main.js
Created April 27, 2015 09:22
tablesorter
$(document).ready(function () {
$.tablesorter.themes.bootstrap = {
// these classes are added to the table. To see other table classes available,
// look here: http://getbootstrap.com/css/#tables
table: 'table table-bordered table-striped',
caption: 'caption',
// header class names
header: 'bootstrap-header', // give the header a gradient background (theme.bootstrap_2.css)
sortNone: '',
sortAsc: '',
@gon250
gon250 / iecors
Created May 5, 2015 15:43
Adds XDomainRequest IE CORS support to jQuery
// Based on https://github.com/jaubourg/ajaxHooks/blob/master/src/ajax/xdr.js
(function( jQuery ) {
if ( window.XDomainRequest && !jQuery.support.cors ) {
jQuery.ajaxTransport(function( s ) {
if ( s.crossDomain && s.async ) {
if ( s.timeout ) {
s.xdrTimeout = s.timeout;
delete s.timeout;
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http.Formatting;
using System.Net.Http.Headers;
using System.Reflection;
@gon250
gon250 / Example
Created May 12, 2015 14:50
access to a website(c#) from a class library and avoid .NET login
//GET COOKIE
var authCookie = _loginHelper.GetAuthCookie(email, password);
//SERIELIZE JSON
var jsonDetails = JsonConvert.SerializeObject(details);
//RESPONSE
var response = _portfolioHelper.HttpPost( _path, jsonDetails, authCookie);
var result = JsonConvert.DeserializeObject<Response<int?>>(response);
@gon250
gon250 / Example.cs
Last active June 4, 2018 15:23
EPPLUS - c#
[Authorize]
public ActionResult Export() {
try
{
var fileDownloadName = "FileName-" + DateTime.Now.ToShortDateString() + ".xlsx";
const string contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
var clients = this._clientsRepository.Get();
var package = new ExcelPackage();
(function ($) {
/**
* @function
* @property {object} jQuery plugin which runs handler function once specified element is inserted into the DOM
* @param {function} handler A function to execute at the time when the element is inserted
* @param {bool} shouldRunHandlerOnce Optional: if true, handler is unbound after its first invocation
* @example $(selector).waitUntilExists(function);
*/