Skip to content

Instantly share code, notes, and snippets.

View eranbetzalel's full-sized avatar

Eran Betzalel eranbetzalel

View GitHub Profile
@eranbetzalel
eranbetzalel / 10bis-notify-open-rest.userscript.js
Last active August 11, 2021 10:31
10Bis - Receive alert when a restaurant is opened
// ==UserScript==
// @name 10bis Notfiy Restaurant has opened
// @description Receive alert when a restaurant is opened
// @version 0.1
// @include http*//www.10bis.co.il/next/Restaurants/menu/delivery/*
// @copyright Eran Betzalel
// ==/UserScript==
//======================================================================================================
@eranbetzalel
eranbetzalel / jira-sum-issue-rows.js
Created March 25, 2020 13:31
JIRA - Add Issues Sum Row (userscript)
// ==UserScript==
// @name JIRA - Add Issues Sum Row
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Calculate the sum row for JIRA issues view
// @author You
// @match https://*.atlassian.net/issues/*
// @grant none
// ==/UserScript==
@eranbetzalel
eranbetzalel / ngrams.js
Last active March 7, 2016 12:38
Implementation of the n-gram algorithm using JavaScript
function ngrams(array, length) {
var ngramsArray = [];
for (var i = 0; i < array.length - (length - 1); i++) {
var subNgramsArray = [];
for (var j = 0; j < length; j++) {
subNgramsArray.push(array[i + j])
}
@eranbetzalel
eranbetzalel / DecimalBytesConvertor.cs
Created April 14, 2013 20:07
Two methods for bytes-decimal conversion.
public decimal BytesToDecimal(byte[] buffer, int offset = 0)
{
var decimalBits = new int[4];
decimalBits[0] = buffer[offset + 0] | (buffer[offset + 1] << 8) | (buffer[offset + 2] << 16) | (buffer[offset + 3] << 24);
decimalBits[1] = buffer[offset + 4] | (buffer[offset + 5] << 8) | (buffer[offset + 6] << 16) | (buffer[offset + 7] << 24);
decimalBits[2] = buffer[offset + 8] | (buffer[offset + 9] << 8) | (buffer[offset + 10] << 16) | (buffer[offset + 11] << 24);
decimalBits[3] = buffer[offset + 12] | (buffer[offset + 13] << 8) | (buffer[offset + 14] << 16) | (buffer[offset + 15] << 24);
return new Decimal(decimalBits);
@eranbetzalel
eranbetzalel / DelimitedFileWriter.cs
Created April 12, 2013 12:58
Simple implementation of CSV (or any other character delimited file) writer.
class Car
{
public int CarId { get; set; }
public DateTime ManufactureDate { get; set; }
public decimal SomeDecimal { get; set; }
}
class DelimitedFileWriterExample
{
static void Main()