Skip to content

Instantly share code, notes, and snippets.

Bozhin Karaivanov bozhink

Block or report user

Report or block bozhink

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View git-branch-configure.sh
# See https://stackoverflow.com/questions/48341920/git-branch-command-behaves-like-less
git config --global pager.branch false
@bozhink
bozhink / disable-back.js
Created May 14, 2018
Disable back button with JavaScript
View disable-back.js
// See https://codepen.io/dhavalt10/pen/rGLBzB
history.pushState(null, null, location.href);
window.onpopstate = function () {
history.go(1);
};
@bozhink
bozhink / serialize-object.js
Created Dec 20, 2017
jQuery: serialize form to object
View serialize-object.js
$.fn.serializeObject = function () {
var i, len, item, object = {}, array = $(this).serializeArray() || [];
len = array.length;
for (i = 0; i < len; i += 1) {
item = array[i];
object[item.name] = item.value;
}
return object;
}
@bozhink
bozhink / ReportPrinter.cs
Created Nov 7, 2017
C# WinForms Report Printer
View ReportPrinter.cs
public class ReportPrinter : IDisposable
{
private int currentPageIndex;
private IList<Stream> streams;
private DataTable LoadSalesData()
{
// Create a new DataSet and read sales data file
// data.xml into the first DataTable.
DataSet dataSet = new DataSet();
View elastic-nest.cs
// See https://github.com/elastic/elasticsearch-net/issues/2860
public class MyDocument
{
public string RecordType { get; set; }
}
var client = new ElasticClient();
client.Search<MyDocument>(s => s
@bozhink
bozhink / stop-telemetry.ps1
Created Sep 9, 2017
PowerShell: turn off Telemetry in Windows10
View stop-telemetry.ps1
Stop-Service DiagTrack
Set-Service DiagTrack -StartupType Disabled
@bozhink
bozhink / npoisi.cs
Created Aug 11, 2017
NPOI Summary Information
View npoisi.cs
/// See https://stackoverflow.com/questions/11143303/how-to-set-author-name-to-excel-file-using-poi
public static void SetAuthor(this IWorkbook workbook, string author)
{
if (workbook is NPOI.XSSF.UserModel.XSSFWorkbook)
{
var xssfWorkbook = workbook as NPOI.XSSF.UserModel.XSSFWorkbook;
var xmlProps = xssfWorkbook.GetProperties();
var coreProps = xmlProps.CoreProperties;
coreProps.Creator = author;
return;
@bozhink
bozhink / GetCallingMethodName.cs
Created Aug 10, 2017
Get calling mathod name C#
View GetCallingMethodName.cs
internal class Helpers
{
internal string GetCallingMethodName()
{
string result = "unknown";
StackTrace trace = new StackTrace(false);
for (int i = 0; i < trace.FrameCount; i++)
{
StackFrame frame = trace.GetFrame(i);
MethodBase method = frame.GetMethod();
@bozhink
bozhink / geo-location.html
Created Jul 6, 2017
Geo Location in HTML5
View geo-location.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<script>
You can’t perform that action at this time.