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
QRect desktopRect = QApplication::desktop()->availableGeometry(this); | |
QPoint center = desktopRect.center(); | |
move(center.x()-width*0.5, center.y()-height*0.5); |
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 Dispatch | |
let semaphore = DispatchSemaphore(value: 0) | |
DispatchQueue.global().asyncAfter(deadline: .now() + 2.0) { | |
print("I am a delayed call!") | |
semaphore.signal() | |
} |
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
/* | |
In iOS 11, interactive view controller transitions no longer scrub by setting the layer speed to zero | |
and changing the timeOffset. As a result of this change, implicit animations that occur in places like | |
-viewWillAppear: (called during an interactive transition) no longer end up “caught in” the animation. | |
To get the same behavior for table view row deselection as before, you can either use UITableViewController | |
which implements this for you, or you can implement it manually by deselecting the row in an alongside | |
animation for the transition (set up in -viewWillAppear: using the transition coordinator). | |
Here is an example implementation which correctly handles some of the more subtle corner cases: |
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 sys | |
from io import StringIO | |
import contextlib | |
@contextlib.contextmanager | |
def stdoutIO(stdout=None): | |
old = sys.stdout | |
if stdout is None: | |
stdout = StringIO() | |
sys.stdout = stdout |
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
#include <unistd.h> | |
static int redirect_nslog(const char *prefix, const char *buffer, int size) | |
{ | |
NSLog(@"%s (%d bytes): %.*s", prefix, size, size, buffer); | |
return size; | |
} | |
static int stderr_redirect_nslog(void *inFD, const char *buffer, int size) | |
{ |
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
/etc/ssh/sshd_config: | |
GatewayPorts yes | |
Tunnel command: | |
ssh -R $SSH_RELAY_OPEN_PORT:localhost:$DEBUGGER_PORT $USER@$SSH_RELAY | |
Python source: | |
pydevd.settrace('$SSH_RELAY', port=$SSH_RELAY_OPEN_PORT, stdoutToServer=True, stderrToServer=True) |
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
osascript -l JavaScript -e 'Application("Safari").addReadingListItem("https://www.google.com")' |
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
target_include_directories(<target> PRIVATE ${Qt5Gui_PRIVATE_INCLUDE_DIRS}) | |
Q_DECLARE_METATYPE(QMargins) | |
#include <qpa/qplatformwindow.h> | |
#include <qpa/qplatformnativeinterface.h> | |
QVariant v = qVariantFromValue(QMargins{-8, -30, -8, -8}); | |
native_window->windowHandle()->setProperty("_q_windowsCustomMargins", v); |
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
adobe-source-han-sans-otc-fonts |
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
code, pre { | |
font-family: monospace !important; | |
} | |
.blob-num, .blob-code, .blob-code-inner { | |
font-family: monospace !important; | |
} | |
.crayon-font-consolas * { | |
font-family: monospace !important; |
OlderNewer