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 arr = [2,1,7,9,8,6,4,5,10,3] | |
// initial state of the array | |
println arr | |
// bubble up the largest element for each increment of the outer loop | |
def bubbleSort(arr) { | |
for (int i = 0 ; i < arr.size() - 1; i++) { | |
for (int j = 0 ; j < (arr.size() - i -1 ); j++) { | |
if (arr[j] > arr[j+1]){ | |
def tmp = arr[j] |
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 matrix = [[ 1, 2, 3, 4, 17], | |
[ 5, 6, 7, 8, 18], | |
[ 9,10,11,12, 19], | |
[13,14,15,16, 20], | |
[21,22,23,24, 25]] | |
/* Output | |
[21, 13, 9, 5, 1] | |
[22, 14, 10, 6, 2] | |
[23, 15, 11, 7, 3] | |
[24, 16, 12, 8, 4] |
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 arr2 = [1,3,4,5,9] | |
def sum = 16 | |
def twoSum(arr, sum) { | |
if (arr[0] > sum) return; | |
if (arr[1] > sum || arr[1] + arr[0] > sum) return; | |
int i = 0; | |
int j = arr.size() -1 | |
for ( ; i < j ; ) { | |
if ((arr[i] + arr[j]) > sum) { |
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
int vertices = 4 | |
int edges = 5 | |
int[][] edgeWeightArr = [[1,2,7],[1,4,6],[4,2,9],[4,3,8],[2,3,6]] | |
// LIFO | |
class Stack { | |
int [] arr | |
int top = 0 | |
public Stack(int size) { | |
arr = new int[size] | |
} |
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
// max sum of non-consecutive numbers | |
def arr = [3, 1, 4, 2, 5, 10 ] | |
//def arr = [4,1,1,4,2,1] | |
//def arr = [2,5,3,1,7] | |
def map = [:] | |
// non dynamic solution - brute force | |
for (int i = 0 ; i < arr.size() ; i++) { | |
def sum = arr[i] | |
def op = [arr[i]] |
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
Steps for installing the Android Emulator from EC2 console: | |
----------------------------------------------------------- | |
sudo apt install default-jdk | |
wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip | |
unzip sdk-tools-linux-4333796.zip -d android-sdk | |
sudo mv android-sdk /opt/ | |
export ANDROID_SDK_ROOT=/opt/android-sdk | |
echo "export ANDROID_SDK_ROOT=/opt/android-sdk" >> ~/.bashrc | |
echo "export PATH=$PATH:$ANDROID_SDK_ROOT/tools" >> ~/.bashrc | |
re-login |
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
const wdio = require("webdriverio"); | |
const assert = require("assert"); | |
const fs = require('fs'); | |
const opts = { | |
port: 4723, | |
capabilities: { | |
platformName: "Android", | |
platformVersion: "7.1", | |
deviceName: "Android Emulator", |
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
npm login -registry=http://nexus.you.love/repository/nexus-npm/ | |
npm publish -registry=http://nexus.you.love/repository/nexus-npm/ |
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 versionMajor = 3 | |
def versionMinor = 0 | |
def versionPatch = 0 | |
def versionBuild = 0 // get from Jenkins -PversionBuild=${env.BUILD_NUMBER} | |
android { | |
defaultConfig { | |
versionCode versionMajor * 10000 + versionMinor * 1000 + versionPatch * 100 + versionBuild |
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
stage('Upload APK to internal Nexus') { | |
environment { | |
// the creds your Jenkins use to communicate with your nexus | |
JENKINS_USER_CREDS = credentials('jenkins-user-password') | |
ENV_NAME = "${env.BRANCH_NAME}" | |
} | |
when { | |
anyOf { | |
// choose what kinds of builds you want to arhive in your nexus | |
branch 'develop'; |
OlderNewer