View Completion.vim
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 |
View cleverVariableArgs.vim
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: |
View .cvimrc
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 |
View InheritanceExample.lua
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 |
View gist:6ad9cd812c306730376d
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. |
View gist:996213b4c6747c8c20f5a498ca67f932
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() |
View ZenjectSceneLoader.cs
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 | |
{ |
View linq_python_examples.py
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(): |
View MoonScriptLineNumberMap.moon
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
-- TODO - instead of calculating this every time we should cache the map to file | |
class MoonScriptLineNumberMap | |
new: => | |
@_fileMapMap = {} | |
@_jobManager = LazyResolve('JobManager') | |
_createFileMap: (moonPath) => | |
lines = @_jobManager\executeAndWaitGetAllOutputLines("moonc -X '#{moonPath}'") | |
fileMap = {} | |
first = true |
View pod.py
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 |
OlderNewer