Skip to content

Instantly share code, notes, and snippets.

//Returns the number of factors of x, starting at n
public int mystery (int n, int x) {
return (n<x)?((int) n%x==0)+mystery(n+1, x):0;
}
@jononon
jononon / LCD.c
Created January 31, 2016 18:06
void clearLCD () {
clearLCDLine(0);
clearLCDLine(1);
}
void waitForRelease () {
while(nLCDButtons != 0)
delay(25);
}
there is n:d=4,o=5,b=150:12d3,24f#3,39p,64e,12a3,12p,12p,12f#3,24f#3,39p,64g,12a3,12p,12p,12a3,12f#3,12a3,12p,12p,12d4,12f#3,12a3,12p,12p,12b3,12b3,12d4,12p,12p,12g3,12b3,12d4,12p,12p,12d3,12f#3,12a3,12p,12p,12f#3,12f#3,12a3,12p,12p,12g3,24b3,39p,64f#,12d4,12p,12p,12b3,24b3,39p,64a,12d4,12p,12p,12d3,24f#3,39p,64e,12a3,12p,12p,12f#3,24f#3,39p,64a4,12a3,12p,12p,12e3,24g3,39p,64d,12b3,12p,12p,12g3,24g3,39p,64f#,12b3,12p,12p,12a3,12c#4,12e4,12p,12p,12c#3,12b3,12a3,12p,12p,12d3,24f#3,39p,64e,12a3,12p,12p,12f#3,24f#3,39p,64g,12a3,12p,12p,12a3,12f#3,12a3,12p,12p,12d4,12f#3,12a3,12p,12p,12b3,12b3,12d4,12p,12p,12g3,12b3,12d4,12p,12p,12d3,12f#3,12a3,12p,12p,12f#3,12f#3,12a3,12p,12p,12g3,24b3,39p,64f#,12d4,12p,12p,12b3,24b3,39p,64a,12d4,12p,12p,12d3,24f#3,39p,64e,12a3,12p,12p,12f#3,24f#3,39p,64a4,12a3,12p,12p,12e3,24g3,39p,64d,12b3,12p,12p,12g3,24g3,39p,64f#,12b3,12p,12p,12a3,12c#4,12e4,12p,12p,12c#3,12b3,12a3,12p,12p,12g2,24b3,39p,64a4,12d4,12p,12p,12b2,24b3,39p,64c#,12d4,12p,12p,12d3,12f#3,12a3,12p,12p,12f#3,24f#3,39p
public class Name implements Comparable {
private String first, last;
public Name (String firstName, String lastName) {
first = firstName;
last = lastName;
}
public int compareTo(Object obj) {
Name other = (Name) obj;
repeat
-- Get the "hour"
set timeStr to time string of (current date)
set Pos to offset of ":" in timeStr
set theHour to characters 1 thru (Pos - 1) of timeStr as string
set timeStr to characters (Pos + 1) through end of timeStr as string
-- Get the "minute"
set Pos to offset of ":" in timeStr
set theMin to characters 1 thru (Pos - 1) of timeStr as string
#pragma config(Motor, port1, rightWheel1, tmotorVex393_HBridge, openLoop)
#pragma config(Motor, port2, rightWheel2, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port3, rightWheel3, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port4, leftWheel2, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port5, leftWheel3, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port10, leftWheel1, tmotorVex393_HBridge, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#pragma platform(VEX)
import java.util.*;
public class Compat {
public static void main (String args[]) {
Random r = new Random(System.nanoTime());
System.out.println(""+r.nextInt(100)+"&");
}
}
public class dogtagexample{
/**
* Checks that a dog tag is valid
* @param dogTag the dog tag to be checked
* @return true if the dog tag is a valid dog tag
*/
public static boolean checkDogTag (String dogTag) {
if(dogTag.length()!=4)
throw new IndexOutOfBoundsException();
public class intester {
public static void main (String args[]) {
int testInt = 135;
int sum = 0;
sum = testInt%10; //adds 5 to the sum
testInt=testInt/10; //devides the test int by 10
sum = sum + testInt%10; //adds 3 to the sum
testInt=testInt/10; //devides the test int by 10
sum = sum + testInt%10; //adds 1 to the sum
System.out.println(sum); //returns 9
@jononon
jononon / code-1.htm
Last active August 29, 2015 14:21 — forked from bennadel/code-1.htm
<script type="text/javascript">
// This will parse a delimited string into an array of
// arrays. The default delimiter is the comma, but this
// can be overriden in the second argument.
function CSVToArray( strData, strDelimiter ){
// Check to see if the delimiter is defined. If not,
// then default to comma.
strDelimiter = (strDelimiter || ",");