This file contains hidden or 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
| val s = Array(1,2,3,4,5) | |
| for( i<-1 until (s.length, 2)) { | |
| val t = s(i-1) | |
| s(i-1) = s(i) | |
| s(i) = t | |
| } | |
| s | |
| //Array[Int] = Array(2, 1, 4, 3, 5) |
This file contains hidden or 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: 'java' | |
| repositories { | |
| mavenCentral() | |
| } | |
| dependencies { | |
| runtime group: 'org.robotframework', name: 'robotframework', version: '2.8.7' | |
| runtime group: 'com.github.markusbernhardt', name:'robotframework-selenium2library-java', version:'1.4.0.7' | |
| } |
This file contains hidden or 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
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 | |
| http://maven.apache.org/maven-v4_0_0.xsd"> | |
| <modelVersion>4.0.0</modelVersion> | |
| <groupId>org.robotframework</groupId> | |
| <artifactId>robotframework-maven-plugin-test-java-keyword</artifactId> | |
| <version>1.0-SNAPSHOT</version> | |
| <packaging>jar</packaging> | |
| <name>Test</name> |
This file contains hidden or 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
| require 'zlib' | |
| require 'stringio' | |
| require 'json' | |
| def gunzip(data) | |
| io = StringIO.new(data, "rb") | |
| gz = Zlib::GzipReader.new(io) | |
| decompressed = gz.read | |
| end | |
This file contains hidden or 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
| def request_json | |
| @response['headers']['Content-Type']='application/json' | |
| obj = {"a" => 1, "b"=> 2} | |
| result = obj.to_json | |
| render :string => result, :use_layout_on_ajax => true | |
| end |
This file contains hidden or 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
| $.getJSON(<%= url_for :action => :request_json %>, function(data) { | |
| alert(data.a); | |
| alert(data.b); | |
| }); |
This file contains hidden or 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
| private static void addTiming(CtClass clas, String mname) | |
| throws NotFoundException, CannotCompileException { | |
| // get the method information (throws exception if method with | |
| // given name is not declared directly by this class, returns | |
| // arbitrary choice if more than one with the given name) | |
| CtMethod mold = clas.getDeclaredMethod(mname); | |
| // rename old method to synthetic name, then duplicate the | |
| // method with original name for use as interceptor |
This file contains hidden or 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 Mod | |
| alias_method :orig_exit, :exit | |
| def exit(code=0) | |
| puts "Exiting with code #{code}" | |
| orig_exit(code) | |
| end | |
| end | |
| include Mod | |
| exit(99) |
This file contains hidden or 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 void test_load_2_files() { | |
| CompositeConfiguration config = new CompositeConfiguration(); | |
| try { | |
| config.addConfiguration(new PropertiesConfiguration( | |
| "user.properties")); | |
| config.addConfiguration(new PropertiesConfiguration( | |
| "app.properties")); | |
| Configuration extConfig = config.interpolatedConfiguration(); |
This file contains hidden or 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
| #user.properties | |
| user.name=steve | |
| user.password=nobody | |
| #app.properties | |
| connection.string=${user.name}:${user.password} | |