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- / bookmarklet.js
Created October 26, 2023 18:38
This is jailbrake script for YouTube + ADblocker. Create bookmarklet from this script, and You can continue use ADblocker with YouTube.
javascript: ((document, tagName, target) => {
var iframeScript = document.createElement(tagName);
iframeScript.src = "https://www.youtube.com/iframe_api";
var contentScript = document.createElement(tagName);
var text = document.createTextNode(`function onYouTubeIframeAPIReady() {
new YT.Player(${target}, { videoId: new URLSearchParams(window.location.search).get("v") });
}`);
contentScript.appendChild(text);
@FoC-
FoC- / falsehoods-programming-time-list.md
Created May 15, 2023 10:22 — forked from timvisee/falsehoods-programming-time-list.md
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
@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;
# 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- / 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>
@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 {}
https://pp.vk.me/c638823/v638823354/122a6/6HydUwbnGEs.jpg
a + b = 8
b + c = 8
d - c = 6
a + d = 13
------------------------
b = 8 - a
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)
time
down
life
left
back
code
data
show
only
site
@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]