This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let s:startedScrolling = 0 | |
function! g:TriggerCompletion() | |
if pumvisible() | |
call s:OnStartScrolling() | |
return "\<C-n>" | |
endif | |
return "" | |
endfunction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Normal way of declaring variable arguments with default values: | |
function! ExampleFunc1(fix1, fix2, ...) | |
let var1 = a:0 > 0 ? a:1 : 'defaultVal1' | |
let var2 = a:0 > 1 ? a:2 : 5 | |
echo a:fix1 .','. a:fix2 .','. var1 .','. var2 | |
endfunction | |
" Alternative approach using a command: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unmapAll | |
let scrollstep = 75 | |
let barposition = "bottom" | |
let mapleader = "," | |
set typelinkhints | |
set numerichints |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Base = {} | |
function Base:new() | |
local obj = {foo = 'asdf'} | |
return setmetatable(obj, { __index = self }) | |
end | |
function Base:run() | |
print(self.foo) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AsyncTaskProcessor : ITickable | |
{ | |
public event Action LoadStarted = delegate {}; | |
public event Action LoadComplete = delegate {}; | |
// New workers to prevent a process from being popped before completion | |
List<WorkerData> _newWorkers = new List<WorkerData>(); | |
// We use a stack here because otherwise sub process of current workers would never execute | |
// causing a state of limbo. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hs.urlevent.bind("reloadKarabinerConfig", function(eventName, params) | |
hs.application.launchOrFocusByBundleID("org.pqrs.Karabiner-Elements.Preferences") | |
local delay = 10 | |
hs.timer.doAfter(1, function() | |
-- Select the complex modifications tab | |
hs.eventtap.keyStroke({}, "right", delay) | |
hs.eventtap.keyStroke({}, "right", delay) | |
hs.timer.doAfter(1, function() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if !NOT_UNITY3D | |
using System; | |
using System.Collections; | |
using UnityEngine.SceneManagement; | |
using UnityEngine; | |
using ModestTree; | |
namespace Zenject | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def assert_throws(func): | |
try: | |
func() | |
except Exception: | |
return True | |
return False | |
def test_empty(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from jsonpickle.unpickler import loadclass | |
import jsonpickle | |
import typeguard # type: ignore | |
from dataclasses import is_dataclass | |
import inspect | |
# The entire purpose of this class is just to hook into the unpickle event | |
# so that we can call validate_member_types | |
# We want to be as strict as possible when deserializing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MIT License | |
Copyright (c) 2021 Steven Vermeulen | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
OlderNewer