This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//By Amen Ayach | |
using System; | |
using System.Windows.Forms; | |
using System.Drawing; | |
public class Mac | |
{ | |
public enum eDirection | |
{ | |
Up, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace System.Windows.Forms | |
{ | |
//This class requires JSON.net package, to install from the nuget console use: | |
//Install-Package Newtonsoft.Json | |
using Newtonsoft.Json.Linq; | |
using System.IO; | |
using System.Linq; | |
public static class StickyInput | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Linq; | |
public static class Base64FileConverter | |
{ | |
public static string ToBase64(byte[] bytes) | |
{ | |
if (bytes == null || bytes.Length == 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace SqlSample | |
{ | |
using System; | |
using System.Data; | |
using System.Data.SqlClient; | |
public class SqlService | |
{ | |
private readonly string connectionString; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function http(url, method, payload, callback) { | |
const options = { | |
method: method ? method : 'GET', | |
headers: { | |
"Content-Type": "application/json" | |
} | |
}; | |
if(payload) { | |
options.body = JSON.stringify(payload); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from requests import get | |
from requests.exceptions import RequestException | |
from contextlib import closing | |
from bs4 import BeautifulSoup | |
#Best used via Jupyter | |
def download_text(url): | |
try: | |
with closing(get(url, stream=True)) as resp: | |
if is_good_response(resp): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getRandomChar(isChar) { | |
return parseInt(Math.random() * 100) % (isChar === true ? 26 : 10); | |
} | |
function getRandomString(length) { | |
return [...new Array(length)] | |
.map((x, i) => | |
i % 2 === 0 ? | |
String.fromCharCode(65 + getRandomChar(true)).toString() : | |
getRandomChar(false).toString()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public sealed class Nester<T, TSortKey> : IDisposable | |
{ | |
private readonly IEnumerable<T> flatList; | |
private Func<T, T, bool> parentChildPredicate; | |
private PropertyInfo nestingPropertyInfo; | |
private Func<T, TSortKey> sortingKeySelector; | |
private Func<T, bool> rootLevelPredicate; | |
private Nester(IEnumerable<T> flatList, | |
Func<T, bool> rootLevelPredicate, |
OlderNewer