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
Arrays.stream(TimeZone.getAvailableIDs()).forEach(id -> { | |
boolean flag = false; | |
try { | |
ZoneId.of(id); | |
flag = true; | |
} catch (Exception e) { | |
//ignore; | |
} | |
if (!flag) | |
System.out.printf("[%s] %s%n", flag ? "x" : " ", id); |
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
package com.gem.demo.java; | |
import java.util.NoSuchElementException; | |
import java.util.Random; | |
public class RandomString { | |
public static void main(String[] args) { | |
long time = System.currentTimeMillis(); | |
generate("hello"); | |
generate("world"); |
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
### | |
# define serialize in +ActiveRecord::AttributeMethods::Serialization#serialization+ | |
# => create coder | |
# which is used in +ActiveRecord::Type::Serialized+ | |
# attr is loaded in +ActiveRecord::Type::Serialized#type_cast_from_database+ | |
# attr is dumped in +ActiveRecord::Type::Serialized#type_cast_for_database+ | |
### | |
# active_record/coders/yaml.rb | |
module ActiveRecord::Coders |
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
module Serializable | |
extend ActiveSupport::Concern | |
module ClassMethods | |
def dump(obj) | |
return if obj.nil? | |
assert_valid_value obj | |
ActiveSupport::JSON.encode obj | |
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
<web-fragment version="3.0" | |
xmlns="http://java.sun.com/xml/ns/javaee" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd"> | |
</web-fragment> |
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
### OmniAuth Settings | |
###! Docs: https://docs.gitlab.com/ce/integration/omniauth.html | |
gitlab_rails['omniauth_enabled'] = true # Show "Signin with..." button in Login page | |
gitlab_rails['omniauth_allow_single_sign_on'] = ['google_oauth2'] # Create account automatically | |
# gitlab_rails['omniauth_sync_email_from_provider'] = 'saml' | |
gitlab_rails['omniauth_auto_sign_in_with_provider'] = 'google_oauth2' # Redirect to provider login page when enter gitlab login page | |
# gitlab_rails['omniauth_block_auto_created_users'] = true # true: auto-created user must be admin approved | |
# gitlab_rails['omniauth_auto_link_ldap_user'] = false | |
# gitlab_rails['omniauth_auto_link_saml_user'] = false | |
# gitlab_rails['omniauth_external_providers'] = ['twitter', 'google_oauth2'] |
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
alias ..='cd ..' | |
if [[ ! "$PATH" =~ (^|:)"$HOME/.local/bin"(:|$) ]]; then | |
export PATH="$HOME/.local/bin:$PATH" | |
fi | |
export SDKMAN_DIR="$HOME/.sdkman" | |
[[ -s "$SDKMAN_DIR/bin/sdkman-init.sh" ]] && source "$SDKMAN_DIR/bin/sdkman-init.sh" | |
export NVM_DIR="$HOME/.nvm" |
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
variables: | |
ANDROID_COMPILE_SDK: "28" | |
test:unit: | |
image: circleci/android:api-${ANDROID_COMPILE_SDK} | |
cache: | |
key: gradle-cache | |
paths: [ .gradle ] | |
variables: | |
# GRADLE_OPTS: "-Dorg.gradle.daemon=false" |
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
deploy:paas-gae: | |
stage: deploy | |
image: google/cloud-sdk | |
before_script: | |
- echo "${GCLOUD_SERVICE_KEY}" > /tmp/.gsa.key | |
- gcloud auth activate-service-account --key-file /tmp/.gsa.key | |
- gcloud config set project "${PROJECT_NAME}" # TODO: change this | |
script: | |
- gcloud app deploy | |
environment: |
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 jinja2 | |
loader = jinja2.FileSystemLoader(searchpath="./") | |
env = jinja2.Environment(loader=loader) | |
TEMPLATE_FILE = "template.j2" | |
template = env.get_template(TEMPLATE_FILE) | |
output = template.render() | |
print(f"[{output}]") |