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 |
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
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
/* | |
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
#!/bin/bash | |
# | |
# Backs up my entire website, in case Tumblr or CloudApp goes down someday. | |
# Last time I ran this, it took 18 minutes. | |
# | |
wget \ | |
--mirror `# turns on recursion and timestamping, basically says we want to "mirror" the whole site` \ | |
--convert-links `# after download, convert all links to point to localhost` \ |
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 { DependencyList, Dispatch, SetStateAction, useState } from "react"; | |
/** | |
* This is like useState() but with the added feature of returning the initial | |
* value whenever the dependency list changes. This is super useful for allowing | |
* components to "reset" some internal state as a result of getting new props. | |
*/ | |
export function useResettableState<S>( | |
initial: S | (() => S), | |
deps: DependencyList, |
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
// ==UserScript== | |
// @name Duolingo Helper | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Adds useful features to Duolingo, including more keyboard shortcuts, and hidden "hint text" for translation exercises to concentrate on listening skills. | |
// @author Nick Farina | |
// @match https://*.duolingo.com/* | |
// @grant none | |
// ==/UserScript== |
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
/** | |
* A "fast" version of @types/styled-components that does not impact the | |
* performance of the TypeScript language service (which is directly related to | |
* the performance of VSCode). | |
* | |
* NOTE: This implements only a fraction of the features provided by the | |
* @types/styled-component package. Notably, it does not support typing the | |
* "props" parameter when interpolating within template strings. If someone | |
* knows how to type that without impacting performance, please let me know! | |
*/ |
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
'Declare statements | |
DECLARE SUB playGame () | |
DECLARE SUB setParms () | |
DECLARE SUB clearTanks () | |
DECLARE SUB checkGround () | |
DECLARE SUB explodeTank () | |
DECLARE SUB fireShotRight () | |
DECLARE SUB fireShotLeft () | |
DECLARE SUB getInfoRight () |
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 { useCallback, useEffect, useState } from "react"; | |
// Adapted from: | |
// https://github.com/rehooks/local-storage/blob/master/src/use-localstorage.ts | |
type Setter<S> = (value: S) => any; | |
/** | |
* React hook to enable updates to state via localStorage. | |
* This updates when the {writeLocalStorage} function is used, when the returned function |
OlderNewer