Skip to content

Instantly share code, notes, and snippets.

View grigorye's full-sized avatar

Grigorii Entin grigorye

View GitHub Profile
@grigorye
grigorye / npm-using-https-for-git.sh
Created June 22, 2021 13:22 — forked from taoyuan/npm-using-https-for-git.sh
Force git to use https:// instead of git://
# npm using https for git
git config --global url."https://github.com/".insteadOf [email protected]:
git config --global url."https://".insteadOf git://
# npm using git for https
git config --global url."[email protected]:".insteadOf https://github.com/
git config --global url."git://".insteadOf https://
// Reusing the idea in https://gist.github.com/akosma/07249e6718ace1ba6066
precedencegroup ElementOfPrecedence {
associativity: left
higherThan: BitwiseShiftPrecedence
}
infix operator ∈ : ElementOfPrecedence
func ∈<T> (x: T, array: [T]) -> Bool where T: Equatable {
array.contains(x)
1. Install the extension
2. Login into pro account
3. Open chrome://extensions
4. Enable Developer mode
5. Open Vivaldi > Inpect views > background page and execute the following:
> chrome.permissions.request({permissions: ["webNavigation", "tabs", "contextMenus", "activeTab"], origins: ["https://your.github.enterprise.com/*"]})
# Then *login* into pro account
@grigorye
grigorye / open-image-diff
Created April 29, 2020 15:32
Poor man's image comparator (suitable for integration with Git clients)
#! /bin/sh
set -euo pipefail
tmpdir=$(mktemp -d "/tmp/$(basename "$0").XXXXX")
bn1=$(basename "$1")
bn2=$(basename "$2")
diff="$tmpdir/diff-$bn1-$bn2.png"
@grigorye
grigorye / xcscheme-enable-code-coverage
Created August 6, 2019 09:48
Enable code coverage for the given .xcscheme
#! /usr/bin/ruby
require 'xcodeproj'
xcscheme, * = ARGV
scheme = Xcodeproj::XCScheme.new File.join(xcscheme)
test_action = scheme.test_action
test_action.code_coverage_enabled = true
scheme.test_action = test_action
@grigorye
grigorye / RunLoopPerformVsDispatchQueueAsyncTests.swift
Created February 6, 2019 10:09
RunLoop.main.perform vs DispatchQueue.main.async
class RunLoopPerformVsDispatchQueueAsyncTests: XCTestCase {
func testRunLoopPerformTakesPriorityOverDispatchAsync() {
enum Event {
case dispatchQueueAsync
case runLoopPerform
}
protocol MyProtocol {
func methodA()
func methodB()
}
class MyProtocolDefaults {
func methodA() {
print("Default methodA")
}
protocol MyProtocol {
func methodA()
func methodB()
}
extension MyProtocol {
func methodA() {
print("Default methodA")
}
protocol P {
func foo()
}
extension P {
func foo() { print("P") }
}
class A: P {}
class B: A {
@grigorye
grigorye / Podfile
Last active January 10, 2022 12:37
Disable coverage for cocoapods (incl. Swift)
# Append the block below to your Podfile
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |configuration|
configuration.build_settings['CLANG_ENABLE_CODE_COVERAGE'] = 'NO'
configuration.build_settings['SWIFT_EXEC'] = '$(SRCROOT)/SWIFT_EXEC-no-coverage'
end
end
end