Skip to content

Instantly share code, notes, and snippets.

View bezzad's full-sized avatar
:octocat:
Hi

Behzad Khosravifar bezzad

:octocat:
Hi
View GitHub Profile
// SmoothScroll v0.9.9
// Licensed under the terms of the MIT license.
// People involved
// - Balazs Galambosi: maintainer (CHANGELOG.txt)
// - Patrick Brunner (patrickb1991@gmail.com)
// - Michael Herf: ssc_pulse Algorithm
$ = jQuery.noConflict();
function ssc_init(){if(!document.body)return;var e=document.body;var t=document.documentElement;var n=window.innerHeight;var r=e.scrollHeight;ssc_root=document.compatMode.indexOf("CSS")>=0?t:e;ssc_activeElement=e;ssc_initdone=true;if(top!=self){ssc_frame=true}else if(r>n&&(e.offsetHeight<=n||t.offsetHeight<=n)){ssc_root.style.height="auto";if(ssc_root.offsetHeight<=n){var i=document.createElement("div");i.style.clear="both";e.appendChild(i)}}if(!ssc_fixedback){e.style.backgroundAttachment="scroll";t.style.backgroundAttachment="scroll"}if(ssc_keyboardsupport){ssc_addEvent("keydown",ssc_keydown)}}function ssc_scrollArray(e,t,n,r){r||(r=1e3);ssc_directionCheck(t,n);ssc_que.push({x:t,y:n,lastX:t<0?.99:-.99,lastY:n<0?.99:-.99,start:+(new Date)});if(ssc_pending){return
@scrubmx
scrubmx / HTML5Validation.html
Last active July 6, 2024 15:40
Change the language of error message for html5 required fields.
/*
|-----------------------------------------------------------------------
| With HTML
|-----------------------------------------------------------------------
*/
<input
type="number"
id="userProvidedHeight"
min="211"
@DanielSWolf
DanielSWolf / Program.cs
Last active November 9, 2025 21:44
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);
@herman1vdb
herman1vdb / MinifyHtmlAttribute.cs
Last active May 7, 2020 07:22
Minify HTML with inline css/javascript for MVC C# as a ActionFilterAttribute
using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Mvc;
using System.Web.Optimization;
using ZetaProducerHtmlCompressor.Internal;
namespace PmdWebsite.Helpers.ActionFilters
@vgerbase
vgerbase / smtp.cs
Last active August 20, 2022 09:49
C# code to switch off certificate validation
{
...
ServicePointManager.ServerCertificateValidationCallback =
delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) {
return true;
};
smtpclient.Send();
...
}
@zhiguangwang
zhiguangwang / README.md
Last active March 29, 2026 16:39
Installing and running shadowsocks on Ubuntu Server

Installing and running shadowsocks on Ubuntu Server

16.10 yakkety and above

  1. Install the the shadowsocks-libev package from apt repository.

     sudo apt update
     sudo apt install shadowsocks-libev
    
  2. Save ss.json as /etc/shadowsocks-libev/config.json.

@bezzad
bezzad / VersionUpdater.tt
Created July 18, 2016 13:06
Auto .net project version updater by TextTemplete (.tt)
<#@ template language="C#" hostspecific="true" #>
<#@ import namespace="System.IO" #>
<#@ import namespace="System.Text.RegularExpressions" #>
<#@ output extension=".txt" #>
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
@bezzad
bezzad / NumericTextBox.cs
Last active August 30, 2016 08:08
C#.Net Numeric TextBox by thousand separator like: 123,456,789
public class NumericTextBox : TextBox
{
private const char Delete = (char)8;
private const char Backspace = '\b';
public bool IsNumeric { get; set; } = false;
public new string Text
{
get { return IsNumeric ? base.Text?.Replace(",", "") : base.Text; }
@huoxudong125
huoxudong125 / Readme.md.md
Last active August 27, 2024 08:28
WPF Get ActualWidth & ActualHeight and assign to ViewModel.

OneWayToSource Binding seems broken in .NET 4.0

@bezzad
bezzad / Bundle Extension
Last active December 29, 2016 05:46 — forked from deanhume/Bundle Extension
An ASP.NET MVC bundle extension file to handle optional HTML attributes such as async, defer, and media for CSS links.
namespace Optimization.Custom
{
using System.Collections.Generic;
using System.Web;
using System.Text;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
/// <summary>