Skip to content

Instantly share code, notes, and snippets.

Enrico Candino enrichman

View GitHub Profile
@enrichman
enrichman / nth_prime.rs
Created Apr 26, 2020
Find the nth prime
View nth_prime.rs
const MAX_SIZE: usize = 110_000;
pub fn nth(n: u32) -> u32 {
let primes = get_primes();
match primes.get(n as usize) {
None => {
println!("{}nth prime not found", n);
1
},
View LoginViewExample_step1_MainActivity.java
package it.enricocandino.loginviewexample;
import android.content.Context;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
View LoginViewExample_step1_activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="it.enricocandino.loginviewexample.MainActivity">
<LinearLayout
android:layout_width="200dp"
View main.go
// ref: https://github.com/buger/goterm
package main
import (
"fmt"
"os"
"runtime"
"syscall"
"time"
View CrossCorrelationDistance.java
import weka.core.*;
public class CrossCorrelationDistance extends NormalizableDistance {
@Override
public double distance(Instance first, Instance second) {
double mx = 0;
double my = 0;
@enrichman
enrichman / main.c
Last active Jun 12, 2016
Esercizio Rapporto
View main.c
/****************************************************************************
* $Id:: tmrtest.c 6098 2011-01-08 02:26:20Z nxp12832 $
* Project: NXP LPC17xx Timer example
*
* Description:
* This file contains Timer test modules, main entry, to test Timer APIs.
*
****************************************************************************
* Software that is described herein is for illustrative purposes only
* which provides customers with programming information regarding the
View gist:6e03fb1488e14e944343
public enum Feature {
A("nameA", "urlA.com"),
B("nameB", "urlB.com");
private String name;
private String url;
Feature(String name, String url) {
this.name = name;
@enrichman
enrichman / NewsActivity.java
Last active Jan 16, 2016
Simple RSS example with PkRSS
View NewsActivity.java
public class NewsActivity extends AppCompatActivity {
private SwipeRefreshLayout mSwipeRefreshLayout;
private NewsRecyclerView mListView;
private NewsCallback newsCallback = new NewsCallback();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
You can’t perform that action at this time.