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
git clean -xfd | |
git submodule foreach --recursive git clean -xfd | |
git reset --hard | |
git submodule foreach --recursive git reset --hard | |
git submodule update --init --recursive |
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
var l = getEventListeners(document).copy[0]; | |
document.removeEventListener('copy', l.listener, l.useCapture); | |
// change format so that codes inside `PRE` tag can show correctly in notion | |
for (let strong of [...document.getElementsByTagName('code')].filter(i => i.parentNode.tagName === 'PRE')) { | |
const textNode = document.createElement('span'); | |
textNode.innerHTML = strong.innerHTML; | |
strong.parentNode.replaceChild(textNode, strong); | |
} | |
for (let strong of [...document.getElementsByTagName('strong')].filter(i => i.parentNode.tagName === 'PRE')) { | |
const textNode = document.createElement('span'); |
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 | |
# usage: get [ RESOLUTION [ YEAR [ IDS... ] ] ] | |
resolution=${1:-SD} | |
year=${2:-2015} | |
shift | |
shift | |
ids=$* | |
RESOLUTION=$(echo $resolution | tr '[:lower:]' '[:upper:]') |
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
@interface NSObject (Debounce) | |
- (void)debounce:(SEL)action delay:(NSTimeInterval)delay; | |
@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
// A for nearly all cases reasonable good implementation was proposed in Josh Bloch's "Effective Java" in item 8. The best thing is to look it up there because the author explains there why the approach is good. | |
// A short version: | |
// 1) Create a int result and assign a non-zero value. | |
// 2) For every field tested in the equals-Method, calculate a hash code c by: | |
// If the field f is a boolean: calculate (f ? 0 : 1); | |
// If the field f is a byte, char, short or int: calculate (int)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
// http://stackoverflow.com/questions/3860351/relative-position-in-dom-of-elements-in-jquery | |
// What this does is .add() the additional element (or selector) | |
// (which jQuery keeps in document order) and then checks if it's the second of the two. | |
(function($) { | |
$.fn.isBefore = function(elem) { | |
if(typeof(elem) == "string") elem = $(elem); | |
return this.add(elem).index(elem) > 0; | |
} | |
})(jQuery) |
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 https://github.com/facebookarchive/AsyncDisplayKit/issues/616#issuecomment-133422166 | |
- (void)reloadData | |
{ | |
UIView *snapshot = [_tableView snapshotViewAfterScreenUpdates:NO]; | |
[self.view insertSubview:snapshot aboveSubview:_tableView]; | |
[_tableView beginUpdates]; | |
[_tableView reloadData]; | |
[_tableView endUpdatesAnimated:NO completion:^(BOOL completed) { |
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
/* disable font boosting on mobile browsers */ | |
body * { | |
max-height: 1000000em; /* Chrome for Android */ | |
-moz-text-size-adjust: none; /* Firefox Mobile */ | |
-webkit-text-size-adjust: 100%; /* Safari */ | |
} |
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 trick is to link the DeviceSupport folder from the beta to the stable version. | |
// Updated on Jan 24th, 2017 for Xcode 8.3b1 | |
ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/10.3\ \(14E5230d\)/ /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport | |
// Then restart Xcode and reconnect your devices. You will need to do that for every beta of future iOS versions | |
// sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :) |
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
→ curl -iI -v -A " " "http://www.la-grange.net/" | |
* About to connect() to www.la-grange.net port 80 (#0) | |
* Trying 128.30.54.58... connected | |
* Connected to www.la-grange.net (128.30.54.58) port 80 (#0) | |
> HEAD / HTTP/1.1 | |
> User-Agent: | |
> Host: www.la-grange.net | |
> Accept: */* | |
> | |
< HTTP/1.1 200 OK |
NewerOlder