Skip to content

Instantly share code, notes, and snippets.

View Peter-cloud-web's full-sized avatar
👨‍💻
Focusing

Peter Gichia Peter-cloud-web

👨‍💻
Focusing
View GitHub Profile
class Lambda {
companion object{
fun sum3(num1 :Int, num2:Int):Int{
return num1 + num2
}
}
}
class Lambda {
companion object{
// This expressions do not return anything
val noReturn : (Int) -> Unit = { num -> println(num * num) }
val n : (String) -> Unit = {name -> println(name)}
}
class Lambda {
companion object{
fun sum3(num1 :Int, num2:Int):Int{
return x + y
}
}
}
public class LongestCommonPrefix {
public static String longestCommonPrefix(String[] strs) throws ArrayIndexOutOfBoundsException {
StringBuilder sb = new StringBuilder();
for(int i = 0; i < strs.length; i++){
char c = strs[0].charAt(i);
@Peter-cloud-web
Peter-cloud-web / include_list_viewpager.xml
Created May 27, 2020 17:47 — forked from iPaulPro/include_list_viewpager.xml
CollapsingToolbarLayout with TabLayout
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright (C) 2015 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
{
"userId": 1,
"id": 1,
"title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
"body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"
}
@Peter-cloud-web
Peter-cloud-web / ItemClickSupport.java
Created May 14, 2020 09:08 — forked from nesquena/ItemClickSupport.java
Click handling for RecyclerView
/*
Source: http://www.littlerobots.nl/blog/Handle-Android-RecyclerView-Clicks/
USAGE:
ItemClickSupport.addTo(mRecyclerView).setOnItemClickListener(new ItemClickSupport.OnItemClickListener() {
@Override
public void onItemClicked(RecyclerView recyclerView, int position, View v) {
// do it
}
});
@Peter-cloud-web
Peter-cloud-web / index.php
Created December 11, 2019 13:02 — forked from drizzentic/index.php
Sample USSD Application
<!-- MIT License
Copyright (c) 2016 Derrick Rono
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: