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
#!/usr/bin/env python | |
import os | |
import re | |
import subprocess | |
import sys | |
RELEASE_NOTE_PATTERN = re.compile("release-([0-9]+\.[0-9]+\.[0-9]+)\.rst") |
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 java.time.Instant; | |
import java.time.ZonedDateTime; | |
import java.time.ZoneId; | |
import java.util.Calendar; | |
import java.util.Locale; | |
import org.joda.time.DateTimeZone; | |
public class AncientDays { | |
public static void main(String[] args) { | |
final ZonedDateTime zoned = ZonedDateTime.of(1000, 1, 1, 0, 0, 0, 0, ZoneId.of("Asia/Tokyo")); |
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
puts ENV['GEM_HOME'] | |
puts Gem.paths.home | |
Gem.paths = {'GEM_HOME' => '/tmp/bar'} | |
puts ENV['GEM_HOME'] | |
puts Gem.paths.home |
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 java.util.Collections; | |
import java.util.SortedMap; | |
import java.util.SortedSet; | |
import java.util.TreeMap; | |
import java.util.TreeSet; | |
public class TimeZoneIds { | |
public static void main(final String[] args) { | |
final TreeSet<String> onlyInJavaTime = new TreeSet<>(javaTimeZoneIds); | |
onlyInJavaTime.removeAll(jodaTimeZoneIds); |
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 com.fasterxml.jackson.databind.ObjectMapper; | |
public class JacksonExp { | |
public static void main(String[] args) throws java.io.IOException { | |
final String json = "{\"id\":12345e3}"; | |
final ObjectMapper mapper = new ObjectMapper(); | |
final SampleData data = mapper.readValue(json, SampleData.class); | |
System.out.println(data.toString()); | |
} | |
} |
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: EmbeddedPlugin | |
embeddedPluginConfig { | |
name = "Someone" | |
} | |
class EmbeddedPlugin implements Plugin<Project> { | |
void apply(Project project) { | |
project.extensions.create('embeddedPluginConfig', EmbeddedPluginExtension) | |
project.afterEvaluate { |
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 java.net.URL; | |
import java.security.CodeSource; | |
import java.security.ProtectionDomain; | |
public class CheckCodeSource { | |
public static void main(final String[] args) throws SecurityException { | |
final ProtectionDomain protectionDomain = CheckCodeSource.class.getProtectionDomain(); | |
System.out.println(">> ProtectionDomain:"); | |
System.out.println(protectionDomain.toString()); |
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 java.net.URL; | |
import java.net.URISyntaxException; | |
import org.jruby.embed.AttributeName; | |
import org.jruby.embed.LocalContextScope; | |
import org.jruby.embed.PathType; | |
import org.jruby.embed.ScriptingContainer; | |
/* | |
* Out-of-jar: | |
* $ ./gradlew run |
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 org.jruby.embed.LocalContextScope; | |
import org.jruby.embed.LocalVariableBehavior; | |
import org.jruby.embed.ScriptingContainer; | |
public class JRubyInstance { | |
public static void main(String[] args) { | |
/* | |
final ScriptingContainer container1 = new ScriptingContainer(LocalContextScope.SINGLETON); | |
container1.runScriptlet("puts 'Ruby1 $LOAD_PATH:'"); | |
container1.runScriptlet("$LOAD_PATH.each { |path| puts ' * ' + path.to_s }"); |
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 java.io.BufferedReader; | |
import java.io.InputStream; | |
import java.io.InputStreamReader; | |
import java.io.IOException; | |
import org.jruby.RubyInstanceConfig; | |
import org.jruby.embed.LocalContextScope; | |
import org.jruby.embed.LocalVariableBehavior; | |
import org.jruby.embed.ScriptingContainer; | |
public class JRubyEnv { |