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 double EARTH_RADIUS = 6378137.0; | |
| public static LatLng to4326(Wgs84 wgs84) { | |
| double lat = Math.toDegrees(Math.atan(Math.exp(wgs84.getY() / EARTH_RADIUS)) * 2 - Math.PI/2); | |
| double lng = Math.toDegrees(wgs84.getX() / EARTH_RADIUS); | |
| return new LatLng(lat, lng); | |
| } | |
| public static Wgs84 toWgs84(LatLng latLng) { | |
| double x = Math.toRadians(latLng.longitude) * EARTH_RADIUS; |
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 static String codeHere(String inputData) { | |
| // Use this function to write your solution; | |
| String[] arrayInfo = inputData.split("\n"); | |
| int size = Integer.parseInt(arrayInfo[0]); | |
| int[] lenghsArray = new int[size]; | |
| String[] stringArray = arrayInfo[1].split(" "); | |
| List<Integer> subArray = new ArrayList<>(); | |
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
| ViewGroup.LayoutParams layoutParams = itemView.getLayoutParams(); | |
| if (layoutParams instanceof StaggeredGridLayoutManager.LayoutParams) { | |
| if (getAdapterPosition() == 0) { | |
| ((StaggeredGridLayoutManager.LayoutParams) layoutParams).setFullSpan(true); | |
| } else { | |
| ((StaggeredGridLayoutManager.LayoutParams) layoutParams).setFullSpan(false); | |
| } | |
| } |
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 class MultipartHelper { | |
| private final String fileDir; | |
| private final String outputDir; | |
| public MultipartHelper(String fileDir, String outputDir) { | |
| this.fileDir = fileDir; | |
| String baseDir = BaseApplication.getAppContext().getObbDir() + File.separator + "uploads"; | |
| this.outputDir = baseDir + File.separator; | |
| File upload = new File(baseDir); |
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
| liveData.observeLimit({ | |
| //asset 1 | |
| }, { | |
| //assert 2 | |
| })... |
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 class MainActivity extends AppCompatActivity { | |
| @Override | |
| protected void onCreate(@Nullable Bundle savedInstanceState) { | |
| super.onCreate(savedInstanceState); | |
| getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL, | |
| WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL); | |
| } | |
| } |
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
| Define these lines to the library gradle file: | |
| project.group = "io.github.rezaiyan" | |
| project.archivesBaseName = "LevelProgressBar" | |
| project.version = "1.0.0" | |
| apply from: '../publish.gradle' |
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
| #!/bin/bash | |
| #hi | |
| SAVEIFS=$IFS | |
| IFS=$(echo -en "\n\b") | |
| for rootFolder in */ ; do | |
| if [ -d $rootFolder"build" ]; then | |
| echo "do you want to delete build folders of \"${rootFolder%?}\" project?" | |
| read ans | |
| if [ "$ans" = "y" ] || [ "$ans" = "Y" ]; then |
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 client = OkHttpClient.Builder() | |
| .addInterceptor(MockInterceptor()) | |
| .build() | |
| //------------------------- | |
| import okhttp3.Interceptor | |
| import okhttp3.Protocol | |
| import okhttp3.Response | |
| import okhttp3.ResponseBody.Companion.toResponseBody |
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 { Web3 } = require('web3'); | |
| const EthereumTransaction = require('ethereumjs-tx').Transaction; | |
| // Step 1: Set up the appropriate configuration | |
| const web3 = new Web3(new Web3.providers.HttpProvider('http://127.0.0.1:7545')); | |
| async function transfer() { | |
| // Step 2: Set the sending and receiving addresses for the transaction | |
| const sendingAddress = 'sendingAddress'; | |
| const receivingAddress = 'receivingAddress'; |