紀錄 2018 - 2020 解決 Leetcode 過程。
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
public class URLUtils { | |
private static final String fGOOGLE_DOC_URL = "http://docs.google.com/gview?embedded=true&url=%s"; | |
private enum GoogleDocType{ | |
PDF(".pdf"), DOC(".doc"), XLS(".xls"), DOCX(".docx"), XLSX(".xlsx"); | |
private String mSuffix; | |
GoogleDocType(String suffix){ | |
mSuffix = suffix; |
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
# This script is based on the script provided at http://stackoverflow.com/questions/9258344/xcode-better-way-of-incrementing-build-number | |
# The only difference is, that it uses hexadecimal build numbers instead of decimal ones. | |
# For instructions on how to use this script, see the link above. | |
#!/bin/sh | |
if [ $# -ne 1 ]; then | |
echo usage: $0 plist-file | |
exit 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
/** | |
* Copyright 2013 Bo Wang | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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 | |
DEFAULT_URL=http://updates.jenkins-ci.org/current/latest/jenkins.war | |
TMP_PATH=/tmp/jenkins.war | |
APP_PATH=/Applications/Jenkins/jenkins.war | |
PLIST_PATH=/Library/LaunchDaemons/org.jenkins-ci.plist | |
url=${1-$DEFAULT_URL} | |
echo 'Downloading WAR package...' |
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
[ -f Cartfile.resolved ]; then | |
CARTFILE_CHANGED=`git diff --stat $(GIT_PREVIOUS_SUCCESSFUL_COMMIT) $(GIT_COMMIT) | grep '\|' | awk '{print $$1}' | grep Cartfile.resolved` | |
if test "$(CARTFILE_CHANGED)" ; then | |
echo "## STEP: Updating Carthage" | |
carthage bootstrap --platform iOS --no-use-binaries | |
else | |
echo "## Carthage is up to date" | |
fi | |
else | |
echo "## STEP: Installing Carthage Dependencies" |
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
apply plugin: 'maven-publish' | |
project.afterEvaluate { | |
def androidExtension = project.extensions.findByName("android") | |
if (androidExtension.hasProperty('libraryVariants')) { | |
androidExtension.libraryVariants.all { final variant -> | |
task("${variant.name}Javadoc", type: Javadoc) { | |
description "Generates Javadoc for ${variant.name}." | |
failOnError = false | |
source = variant.javaCompile.source |
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
<key>Customized</key> | |
<dict> | |
<key>Delete Line</key> | |
<string>selectLine:, deleteBackward:</string> | |
<key>Duplicate Lines</key> | |
<string>selectLine:, copy:, moveToEndOfLine:, insertNewline:, paste:, deleteBackward:</string> | |
<key>Duplicate Current Line</key> | |
<string>moveToBeginningOfLine:, deleteToEndOfLine:, yank:, insertNewline:, moveToBeginningOfLine:, yank:</string> | |
</dict> |
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
/** | |
* Custom implementation of AdapterDataObserver to show empty layouts | |
* for RecyclerView when there's no data | |
* | |
* Usage: | |
* | |
* adapter.registerAdapterDataObserver(new RVEmptyObserver(recyclerView, emptyView)); | |
*/ | |
public class RVEmptyObserver extends RecyclerView.AdapterDataObserver { | |
private View emptyView; |
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
//: Playground - noun: a place where people can play | |
// | |
// The result is not guaranteed to be accurate. Typically, the function requires 200-400 characters to reliably guess the language of a string. | |
// Reference: [CFStringTokenizerCopyBestStringLanguage(_:_:)](https://developer.apple.com/reference/corefoundation/1542136-cfstringtokenizercopybeststringl) | |
// | |
import Foundation | |
extension String { | |
func guessLanguage() -> String { |
OlderNewer