Skip to content

Instantly share code, notes, and snippets.

View omerfarukz's full-sized avatar
🍓

Omer omerfarukz

🍓
View GitHub Profile
var floatToStringPipe = new FuncPipe<float, string>(f => $"Given {f}")
.Then(new FuncPipe<string, int>(f => f.Length))
.Then(new FuncPipe<int, string>(f => String.Join(String.Empty, Enumerable.Range(1, f + 1))));
var result = floatToStringPipe.Execute(3.14f); // float, string
Console.WriteLine(result);
// 1234567891011
var toBoldAndItalic = new ToHtmlBoldPipe().Then(new ToHtmlUnderlinePipe());
// Simple URI parser with ANTLR4
// Omer Faruk Zorlu, Jun 2021
grammar URI;
prog : (segment)+ ;
segment : protocol? host path? ;
protocol : VALID_CHARSET+ PROTOCOL_DELIMITER ;
host : VALID_CHARSET+ ~'/'? ;
path : (VALID_CHARSET | PATH_DELIMITER)+ query? ;
query : VALID_CHARSET? QUERY_DELIMITER query_name_value ;
$fn = 60;
node_radius = 3;
node_bar_height = 16;
nodes = [40, 50];
node_height = 3;
bend_padding = 4;
bend_height = 1.5;
bend_angle = -5;
public static class ServiceCollectionExtensions
{
private static MethodInfo _method;
public static void ConfigureTypeNamed<T>(this ServiceCollection serviceCollection, IConfigurationRoot configuration)
=> ConfigureTypeNamed(serviceCollection, configuration, typeof(T));
public static void ConfigureTypeNamed(this ServiceCollection serviceCollection, IConfigurationRoot configuration, Type type)
{
if (_method == null)
namespace Mapping
{
public class Mapper
{
private Configuration _configuration;
public Mapper(Configuration configuration)
{
_configuration = configuration;
}
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
namespace LocalizationDemo
{
class Program
{
static void Main(string[] args)
$response = (curl "http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types")
$headerPassed = $False
ForEach ($line in $($response.Content -split '[\r\n]')) {
if ($headerPassed -eq $False) {
$headerPassed = $line.StartsWith("# =")
continue
}
else
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace jnbug
{
import UIKit
class MySegueBase: UIStoryboardSegue
{
open func getDestinationFromPosition(viewFrameSize : CGSize!) -> CGAffineTransform {
return CGAffineTransform(translationX: 2*source.view.frame.size.width, y: 0);
}
open func getSourceTargetPositon(viewFrameSize : CGSize!) -> CGAffineTransform {
return CGAffineTransform(translationX: -viewFrameSize.width, y: 0);
using System;
using AutoMapper;
namespace pp
{
class MainClass
{
public static void Main (string [] args)
{
Mapper.Initialize ((obj) => obj.AddProfile<MyProfile> ());