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 addons from '@storybook/addons'; | |
import { FORCE_RE_RENDER } from '@storybook/core-events'; | |
import { themes } from '@storybook/theming'; | |
// Automatically switch light/dark theme based on system pref. | |
addons.register("auto-theme-switcher", api => { | |
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)'); | |
let lastTheme; |
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
// | |
// Quick & Dirty Google Cloud Storage emulator for tests. Requires | |
// `stream-buffers` from npm. Use it like this: | |
// | |
// `new MockStorage().bucket('my-bucket').file('my_file').createWriteStream()` | |
// | |
class MockStorage { | |
buckets: {[name: string]: MockBucket}; |
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
HttpClient httpClient = vertx.createHttpClient(); | |
httpClient.setHost("localhost"); | |
httpClient.setPort(8888); | |
httpClient.setConnectTimeout(1000); // 1 second | |
httpClient.exceptionHandler(new Handler<Throwable>() { | |
@Override | |
public void handle(Throwable event) { | |
System.out.println("Failed!"); // never called | |
} | |
}); |
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 <UIKit/UIKit.h> | |
@interface UIView (SMFrameAdditions) | |
@property (nonatomic, assign) CGPoint $origin; | |
@property (nonatomic, assign) CGSize $size; | |
@property (nonatomic, assign) CGFloat $x, $y, $width, $height; // normal rect properties | |
@property (nonatomic, assign) CGFloat $left, $top, $right, $bottom; // these will stretch the rect | |
@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
/* | |
The MIT License | |
Copyright (c) 2010 Nick Farina | |
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 |
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(){ // begin private function | |
var copyProperties = function(props, o, overwrite, wrapFunctions) { | |
var wrap = wrapFunctions ? wrapFunctionWithSelf : nowrapFunction; | |
if (props) { | |
for (key in props) if (overwrite || o[key] === undefined) { | |
var getter = props.__lookupGetter__(key); | |
var setter = props.__lookupSetter__(key); |
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
// Removes those unsightly shadows from the top+bottom of your nice webview | |
@interface UIWebView (HideShadows) | |
- (void)hideShadows; | |
- (void)showShadows; | |
@end |
NewerOlder