Skip to content

Instantly share code, notes, and snippets.

View yallie's full-sized avatar

Alexey Yakovlev yallie

View GitHub Profile
@yallie
yallie / gtcptest.cs
Last active August 24, 2018 10:29
Minimal GenuineChannels console application example with programmatic configuration
// Compile using: csc gtcptest.cs /r:GenuineChannels.dll
// First run — start server
// Second run — start client
using System;
using System.Collections.Generic;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using Belikov.GenuineChannels.GenuineTcp;
@Davidblkx
Davidblkx / LevenshteinDistance.cs
Created November 10, 2016 17:45
Levenshtein Distance in c#
using System;
namespace Algorithms
{
public static class LevenshteinDistance
{
/// <summary>
/// Calculate the difference between 2 strings using the Levenshtein distance algorithm
/// </summary>
/// <param name="source1">First string</param>
@newswim
newswim / example.js
Created September 27, 2016 16:52
Fetching data with React's constructor
// I did not write this.
var url = "https://jsonplaceholder.typicode.com/albums"
// Auto unwrap the response as we want the data not the full headers for this simple example
const stringifyResponse = response => {
if (response.status >= 400) throw new Error(response)
return response.headers.get("Content-Type").includes("application/json") ? response.json() : response.text()
}
@revolunet
revolunet / index.js
Created September 16, 2016 14:52
Load remote components at run-time with script.js
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
// https://github.com/ded/script.js
var $script = require("scriptjs");
// load remote component and return it when ready
// display current children while loading
class LoadRemoteComponent extends Component {
@dialogbox
dialogbox / oracle_first_without_groupby_to_postgresql.sql
Last active September 6, 2018 10:28
Example: Convert an Oracle FIRST/LAST query to EDB PAS/PostgreSQL
SELECT MAX(FCT_CODE) KEEP(DENSE_RANK FIRST ORDER BY FNL_UPD_DT desc, PRODC_MAGT_NO desc) AS FCT_CODE,
MAX(PLANT_CODE) KEEP(DENSE_RANK FIRST ORDER BY FNL_UPD_DT desc, PRODC_MAGT_NO desc) AS PLANT_CODE,
MAX(PRODC_MAGT_NO) KEEP(DENSE_RANK FIRST ORDER BY FNL_UPD_DT desc, PRODC_MAGT_NO desc) AS PRODC_MAGT_NO
FROM TBM_PM_PRODC_PRGS A
WHERE 1 = 1
AND (A.FCT_CODE, A.PLANT_CODE) IN (('C100A', 'P105'))
AND (A.PRODC_MAGT_NO = '0F5PH3AH700007H' OR A.PRODC_MAGT_NO LIKE '0F5PH3AH700007H'||'_')
AND ROWNUM = 1
-- ==>
private static void PreLoadResourcesFromMainAssembly()
{
const string RESOURCES_PREFIX = "MyApp.Properties.Resources.";
const string RESOURCES_EXTENTION = ".resources";
// get loaded resource sets from resource manager
var resourceManager = Resources.ResourceManager;
var resourceSetByCulture =
(
resourceManager.GetType().GetField("_resourceSets", BindingFlags.Instance | BindingFlags.NonPublic) ??
@subfuzion
subfuzion / github-wiki-how-to.md
Last active April 20, 2024 09:22
GitHub Wiki How-To

How do I clone a GitHub wiki?

Any GitHub wiki can be cloned by appending wiki.git to the repo url, so the clone url for the repo https://myorg/myrepo/ is: git@github.com:myorg/myrepo.wiki.git (for ssh) or https://github.com/my/myrepo.wiki.git (for https).

You make edits, and commit and push your changes, like any normal repo. This wiki repo is distinct from any clone of the project repo (the repo without wiki.get appended).

How do I add images to a wiki page?

@dadhi
dadhi / DryIoc_Issue164_EventAggregator.cs
Created September 17, 2015 16:22
DryIoc_Issue164_EventAggregator
using System;
using NUnit.Framework;
namespace DryIoc.IssuesTests
{
[TestFixture]
public class Issue164_EventAggregatorImpl
{
[Test]
public void Able_to_handle_multiple_events_being_singleton()
@smarr
smarr / truffle-material.md
Last active May 14, 2024 07:48
Truffle: Languages and Material
@ronnieoverby
ronnieoverby / JaroWinklerDistance.cs
Last active June 14, 2021 16:16
Some modifications to the algorithm found at http://stackoverflow.com/a/19165108/64334
public static class JaroWinklerDistance
{
/* The Winkler modification will not be applied unless the
* percent match was at or above the mWeightThreshold percent
* without the modification.
* Winkler's paper used a default value of 0.7
*/
private const double WeightThreshold = 0.7;
/* Size of the prefix to be concidered by the Winkler modification.