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
#!/usr/local/bin/python | |
import sys | |
import ast | |
import inspect | |
import keyring # for storing password in OS X Keychain | |
from datetime import datetime | |
from subprocess import check_output | |
from astunparse import unparse | |
from grab import Grab |
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
import android.text.Layout; | |
... | |
private class ReactSelectionWatcher implements SelectionWatcher { | |
private ReactEditText mReactEditText; | |
private EventDispatcher mEventDispatcher; | |
private int mPreviousSelectionStart; | |
private int mPreviousSelectionEnd; |
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
/** | |
* Event emitted by EditText native view when the text selection changes. | |
*/ | |
/* package */ class ReactTextInputSelectionEvent | |
extends Event<ReactTextInputSelectionEvent> { | |
private static final String EVENT_NAME = "topSelectionChange"; | |
private int mSelectionStart; | |
private int mSelectionEnd; |
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
/** | |
* Object containing information about a TextInput's selection. | |
*/ | |
@interface RCTTextSelection : NSObject | |
@property (nonatomic, assign, readonly) NSInteger start; | |
@property (nonatomic, assign, readonly) NSInteger end; | |
/* >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> */ | |
@property (nonatomic, assign, readonly) CGPoint cursorPosition; |
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
@implementation RCTTextSelection | |
/* >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> */ | |
- (instancetype)initWithStart:(NSInteger)start end:(NSInteger)end cursorPosition:(CGPoint)cursorPosition | |
/* <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< */ | |
{ | |
if (self = [super init]) { | |
_start = start; | |
_end = 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
- (RCTTextSelection *)selection | |
{ | |
id<RCTBackedTextInputViewProtocol> backedTextInput = self.backedTextInputView; | |
UITextRange *selectedTextRange = backedTextInput.selectedTextRange; | |
return [[RCTTextSelection new] initWithStart:[backedTextInput offsetFromPosition:backedTextInput.beginningOfDocument toPosition:selectedTextRange.start] | |
end:[backedTextInput offsetFromPosition:backedTextInput.beginningOfDocument toPosition:selectedTextRange.end] | |
/* >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> */ | |
cursorPosition:[backedTextInput caretRectForPosition:selectedTextRange.start].origin]; | |
/* <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< */ |
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
/** | |
* Convert | |
* | |
* foo: { | |
* bar: ['baz', 'qux'], | |
* } | |
* | |
* to | |
* | |
* foo: { |
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
function getFromRegexKeys(key, map) { | |
for (let [re, val] of map.entries()) { | |
if (re.test(key)) { | |
return val(key.match(re)); | |
} | |
} | |
} | |
const map = new Map([ | |
[/^foo\/(.+)$/, matchResults => matchResults[1]], |
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
[alias] | |
# https://hackernoon.com/lesser-known-git-commands-151a1918a60 | |
# https://gist.github.com/robmiller/6018582 | |
# https://www.atlassian.com/blog/git/advanced-git-aliases | |
# https://bitbucket.org/durdn/cfg/src/master/.gitconfig?at=master | |
# https://softwaredoug.com/blog/2022/11/09/idiot-proof-git-aliases.html | |
# template: "!f() { git ; }; f" | |
st = status --short --branch | |
ls = "!f() { git log --oneline -${1-1}; }; f" | |
la = "!f() { git log -${1-1}; }; f" |
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 enum import Enum | |
from typing import List, Optional, Tuple, Type, Union | |
from django.contrib.auth.models import AbstractUser | |
from django.db import models | |
from django.db.backends.base.base import BaseDatabaseWrapper | |
from django.db.models.expressions import Expression | |
from django.forms import TypedChoiceField | |
OlderNewer