Skip to content

Instantly share code, notes, and snippets.

View abhishekbhalani's full-sized avatar
🎄
working on latest framework...

Abhishek B. abhishekbhalani

🎄
working on latest framework...
View GitHub Profile
@liddellj
liddellj / DateTimeExtensions.cs
Created May 19, 2011 11:39
C# DateTime to Unix Timestamp Extension Method
public static class DateTimeExtensions
{
public static long ToUnixTimestamp(this DateTime d)
{
var duration = d - new DateTime(1970, 1, 1, 0, 0, 0);
return (long)duration.TotalSeconds;
}
}
@jonleighton
jonleighton / base64ArrayBuffer.js
Last active August 22, 2025 11:37
Encode an ArrayBuffer as a base64 string
// Converts an ArrayBuffer directly to base64, without any intermediate 'convert to string then
// use window.btoa' step. According to my tests, this appears to be a faster approach:
// http://jsperf.com/encoding-xhr-image-data/5
/*
MIT LICENSE
Copyright 2011 Jon Leighton
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
@hayashih
hayashih / RedirectNoTrailingSlashUrl.cs
Created November 29, 2010 11:29
ASP.NET MVC Grobal.asax.cs sample for redirect no trailing slash url.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using System.Web.Security;
namespace MyMvcWebSite
{
@ryanflorence
ryanflorence / static_server.js
Last active July 3, 2025 03:26
Node.JS static file web server. Put it in your path to fire up servers in any directory, takes an optional port argument.
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), uri);
<div>&nbsp;</div>
<!-- #### BEGIN: Quick Link #### -->
<table class="review">
<tbody>
<tr>
<td class="review-title">
<div class="review-title">In a Hurry?</div>
</td>
</tr>
<tr>