Skip to content

Instantly share code, notes, and snippets.

@jackinf
jackinf / Slider-shorter.js
Created July 28, 2012 08:39 — forked from alfongj/Slider-shorter.js
Shorter version of Jeffrey Way's jQuery slider done in episode 15 of Learn jQuery in 30 days
(function($) {
var sliderUL = $('div.slider').css('overflow', 'hidden').children('ul'),
imgs = sliderUL.find('img'),
imgWidth = imgs[0].width, // 600
imgsLen = imgs.length, // 4
current = 0, //0: first
$('#slider-nav').show().find('button').on('click', function() {
var direction = $(this).data('dir'),
move = ( direction === 'next' ) ? 1 : -1; //1 forward, -1 backward
@jackinf
jackinf / teamcity.xml
Created January 10, 2014 14:56
Chutzpah Teamcity MSBuild
<?xml version="1.0" encoding="utf-8" ?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Chutzpah" ToolsVersion="4.0">
<PropertyGroup>
<ChutzpahPath>..\packages\Chutzpah.1.3.1.1\tools\chutzpah.console.exe</ChutzpahPath>
<TestSourcePath>spec</TestSourcePath>
</PropertyGroup>
<Target Name="Chutzpah">
<Exec Command="$(ChutzpahPath) $(TestSourcePath) /teamcity" />
</Target>
</Project>
@jackinf
jackinf / program.cpp
Created January 10, 2014 15:26
Simple Window application in Win32
/ GT_HelloWorldWin32.cpp
// compile with: /D_UNICODE /DUNICODE /DWIN32 /D_WINDOWS /c
#include <windows.h>
#include <stdlib.h>
#include <string.h>
#include <tchar.h>
// Global variables
@jackinf
jackinf / HomeController.cs
Created January 16, 2014 09:58
File Uploader for ASP .NET MVC
public class HomeController : Controller
{
// This action renders the form
public ActionResult Index()
{
return View();
}
// This action handles the form POST and the upload
[HttpPost]
@jackinf
jackinf / datetime.bat
Created January 25, 2014 14:20
Date Time batch
@echo off
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b)
For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set mytime=%%a%%b)
echo %mydate%_%mytime%
@jackinf
jackinf / cmd-scripts.md
Last active August 19, 2019 17:32
Windows CMD scripts

CMD scripts

If env variables changed and you don't want to close the session

refreshenv

Cleans all the bin folders recursively

FOR /F "tokens=*" %G IN ('DIR /B /AD /S *bin*') DO RMDIR /S /Q "%G"
@jackinf
jackinf / serialization.cs
Created February 26, 2014 08:47
JSON Serialization and Deserialization in C#
private class AdditionalInfoJson
{
public bool hasErrors { get; set; }
public List<string> errors { get; set; }
}
...
// data = Json(new { hasErrors = true, errors }, JsonRequestBehavior.AllowGet)
string json = new JavaScriptSerializer().Serialize(data.Data);
@jackinf
jackinf / Html.html
Created June 11, 2014 18:48
How to use a keypress event in angularjs
<div ng-app="" ng-controller="MainCtrl">
<input type="text" ng-enter="doSomething()">
</div>
@jackinf
jackinf / gist:55067dda68e25253d8e1
Created June 26, 2014 07:20
[ASP MVC] File download split into chunks on server side
//Function for File Download in ASP.Net in C# and
//Tracking the status of success/failure of Download.
private bool DownloadableProduct_Tracking()
{
//File Path and File Name
string filePath = Server.MapPath("~/ApplicationData/DownloadableProducts");
string _DownloadableProductFileName = "DownloadableProduct_FileName.pdf";
System.IO.FileInfo FileName = new System.IO.FileInfo(filePath + "\\" + _DownloadableProductFileName);
FileStream myFile = new FileStream(filePath + "\\" + _DownloadableProductFileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
@jackinf
jackinf / gist:7b39ac71c720bee193cc
Created June 26, 2014 07:21
implement IEquatable<T> for comparing objects
public class Author : IEquatable<Author>
{
public string FirstName { get; set; }
public string LastName { get; set; }
public bool Equals(Author other)
{
if (FirstName == other.FirstName && LastName == other.LastName)
return true;