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 override async Task<IEnumerable<City>> GetAllAsync() | |
{ | |
var cities = new Dictionary<long, City>(); | |
//var areas = new Dictionary<long, Area>(); | |
const string sql = | |
@"SELECT c.id, c.name, a.id, a.name FROM cities c | |
INNER JOIN city_areas ca ON ca.city_id = c.id | |
INNER JOIN areas a ON a.id = ca.area_id"; | |
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
// Methods: After, Before | |
string response = @"hello_world"; | |
string after = response.After("hello"); | |
// after = "_world" | |
string before = response.Before("world"); | |
// before = "hello_" |
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
var keyboard = new InlineKeyboardMarkup(new InlineKeyboardButton[][] | |
{ | |
new [] { | |
new InlineKeyboardButton { | |
Text ="Текст для первой кнопки", | |
CallbackData = "cb1" | |
}, | |
}, | |
}); |
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
<?php | |
public static $currencies = false; | |
public static function getCurrenciesJson() | |
{ | |
if (!self::$currencies) { | |
$json = json_decode(system::GET('http://www.floatrates.com/daily/rub.json'), true); | |
self::$currencies = !empty($json) ? $json : false; | |
} | |
return self::$currencies; |
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
// Telegram has 4096 limit per message. So use chunkSize = 4096. | |
public static IEnumerable<string> ChunkUnicode(this string self, int chunkSize) | |
{ | |
if (string.IsNullOrEmpty(self)) | |
return Enumerable.Empty<string>(); | |
if (chunkSize < 4) | |
throw new ArgumentException("Minimum chunk size is 4.", nameof(chunkSize)); | |
var results = new List<string>(); |
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
<#@ template language="C#" #> | |
using System.Reflection; | |
using System.Runtime.InteropServices; | |
// General Information about an assembly is controlled through the following | |
// set of attributes. Change these attribute values to modify the information | |
// associated with an assembly. | |
[assembly: AssemblyTitle("Project")] | |
[assembly: AssemblyDescription("")] |
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
// ==UserScript== | |
// @name Don't track me Google | |
// @namespace Rob W, Grand Silence | |
// @description Removes the annoying link-conversion at Google Search/maps/... The Referrer is also hidden to improve your privacy. Designed for Firefox and Google Chrome. | |
// @version 3.7 | |
// @match *://*.google.com/* | |
// @match *://*.google.ad/* | |
// @match *://*.google.ae/* | |
// @match *://*.google.com.af/* | |
// @match *://*.google.com.ag/* |
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 static T? DeepCopy<T>(this T self) where T : class | |
{ | |
if (!typeof(T).IsSerializable) | |
throw new ArgumentException("Type must be serializable"); | |
if (ReferenceEquals(self, null)) | |
return default; | |
var formatter = new BinaryFormatter(); | |
using var stream = new MemoryStream(); |
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
<Target Name="AfterBuild"> | |
<!-- the ILMergePath property points to the location of ILMerge.exe console application --> | |
<Exec Command="$(ILMergeConsolePath) /target=winexe /ndebug=false /targetplatform=v4 /wildcards bin\Release\App.exe ^ | |
/out:bin\Release\App_merged.exe ^ | |
bin\Release\*.dll" /> | |
</Target> |
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
let locale = "ru" | |
let langmap = "Ё|АFБ<ВDГUДLЕTЖ:ЗPИBЙQКRЛKМVНYОJПGРHСCТNУEФAХ{ЦWЧXШIЩOЪ}ЫSЬMЭ\"Ю>ЯZаfб\\,вdгuдlеtж\\;зpиbйqкrлkмvнyоjпgрhсcтnуeфaх[цwчxшiщoъ]ыsьmэ'ю.яzё\\№#" | |
let qmark m = ["https://mail.google.com"] | |
let qmark g = ["https://github.com/grandsilence?tab=repositories"] | |
let qmark n = ["https://github.com/new"] | |
let qmark h = ["https://www.cheatography.com/yograf/cheat-sheets/cvim/"] | |
let blacklists = ["https://console.hetzner.cloud/*","http://trans-energo36.ru/*","https://2doom.itch.io/*","https://music.yandex.ru/*"] |