Skip to content

Instantly share code, notes, and snippets.

View FoC-'s full-sized avatar
💭
Taking shower and eating after midnight.

Mykola Kush FoC-

💭
Taking shower and eating after midnight.
View GitHub Profile
@FoC-
FoC- / Undead_beta
Created May 28, 2012 10:05
Need to create class which could not been destroyed by GC
using System;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
Undead undead = null;
try
{
@FoC-
FoC- / gist:4203761
Created December 4, 2012 13:14
Resharper bug
using System;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
var sellers = new string[2, 2];
sellers[1, 1] = Seller.Amazon.ToString();
@FoC-
FoC- / gist:6070678
Last active December 20, 2015 04:28
Nunit once per assembly setup teardown
using NUnit.Framework;
using TestingClasses;
namespace Tests
{
[SetUpFixture]
public class BaseContext
{
private A _a;
[SetUp]
time
down
life
left
back
code
data
show
only
site
private T Mesure<T>(Func<T> func, out TimeSpan time)
{
var stopwatch = new Stopwatch();
stopwatch.Start();
var result = func();
stopwatch.Stop();
time = stopwatch.Elapsed;
return result;
}
private void Mesure(Action func, out TimeSpan time)
https://pp.vk.me/c638823/v638823354/122a6/6HydUwbnGEs.jpg
a + b = 8
b + c = 8
d - c = 6
a + d = 13
------------------------
b = 8 - a
@FoC-
FoC- / export.js
Created May 2, 2017 09:00
ES6 export import cheat sheet
// default exports
export default 42;
export default {};
export default [];
export default (1 + 2);
export default foo;
export default function () {}
export default class {}
export default function foo () {}
export default class foo {}
@FoC-
FoC- / index.html
Created October 23, 2017 11:13 — forked from dreyescat/index.html
Webpack config to expose bundle in a variable in the global context
<html>
<head>
</head>
<body>
<script src="lib/yourlib.js"></script>
<script>
window.onload = function () {
EntryPoint.run();
};
</script>
# https://github.com/mongodb/bson-ruby/blob/master/lib/bson/object_id.rb#L369
# https://repl.it/languages/ruby
require "digest/md5"
require "socket"
@counter = rand(0x1000000)
puts "counter: #{@counter}"
@machine_id = Digest::MD5.digest(Socket.gethostname).unpack("N")[0]
puts "machine_id: #{@machine_id}"
@process_id = Process.pid % 0xFFFF
@FoC-
FoC- / PostProcessWhereIsACustomization.cs
Created January 7, 2020 12:47 — forked from bartelink/PostProcessWhereIsACustomization.cs
AutoFixture customization to allow insertion of arbitrary postprocessing logic a la Customize( c=>c.Do()) but in a global manner Revised for v3 (initally for v2)
namespace Ploeh.AutoFixture
{
using Kernel;
using System;
public class PostProcessWhereIsACustomization<T> : ICustomization
where T : class
{
readonly PostProcessSpecimensBehavior _behavior;