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
// Author: neotam | |
// https://neot.am | |
// MIT License | |
package main | |
import ( | |
"fmt" | |
"io/ioutil" | |
"net/http" |
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
// https://neot.am | |
// Verifying if given year is leap year using switch wityout expression syntax | |
package main | |
import "fmt" | |
func main() { | |
var n int | |
fmt.Printf("Enter year: ") |
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
package main | |
import "fmt" | |
func main() { | |
var n int | |
fmt.Printf("Enter year: ") | |
fmt.Scanf("%d", &n) | |
if n%4 == 0 { |
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.lang.annotation.ElementType; | |
import java.lang.annotation.Retention; | |
import java.lang.annotation.RetentionPolicy; | |
import java.lang.annotation.Target; | |
@Retention(RetentionPolicy.RUNTIME) | |
@Target(ElementType.METHOD) | |
public @interface Information { | |
String name(); | |
String description(); |
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
public enum BrandColor { | |
RED("#FF0000"), GREEN("#00FF00"), BLUE("#0000FF"), | |
NAVY("000080"), CORAL("#FF7F50"), LINEN("#FAF0E6"), | |
SESASHELL("#FFF5EE"), STEELBLUE("#4682B4"); | |
private final String hexcode; | |
BrandColor(String hexcode) { | |
this.hexcode = hexcode; | |
} |
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
def foo(a, b, c, /, x, y, z="default", *, name, operation, **kwargs): | |
print(f"Position-only parameters {a}, {b}, {c}") | |
print(f"Positional or Keyword arguments {x}, {y}, {z}") | |
print(f"Keyword Only Arguments {name}, {operation}") | |
print(f"Variable length keyword arguments {kwargs}") #Since params left to / are not keywords those parameter names remain avaialbe in kwargs | |
print("{:^80}".format("_"*50)) | |
#Valid Function Calls | |
foo(1, 3, 4, 8, 9, 2, name="test", operation="noop") |
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
public interface GameInterface extends Runnable, Closeable { | |
int MAXLIFES = 3; | |
String APISERVER = "https://api.example.com/v1/"; | |
void start(); | |
void pause(); | |
void pause(double seconds); | |
int score(int playerID); | |
} |
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
public class Student { | |
private int rollno; | |
private String lname; | |
private String fname; | |
protected int section; | |
private Map<String, Double> marks = new HashMap<>(); | |
Student(int rollno, String fname, String lname, int section){ | |
this.rollno = rollno; | |
this.fname = fname; |
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
/* | |
Site: https://getkt.com | |
Print 32-bit HexDecimal Memory representation | |
*/ | |
#include <stdio.h> | |
void dumpMemRep(char *ptr, int n) { | |
for(int i=0; i < n; i++) | |
printf(" %.2x", ptr[i]); |
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.Console; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.util.Scanner; | |
import java.util.StringTokenizer; | |
public class Main { | |
public static void main(String[] args) throws IOException { |
NewerOlder