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
import java.util.Scanner; // initialize scanner | |
// Pythagorean Theorem a^2 + b^2 = c^2 | |
public class PythagoreanTriple | |
{ | |
public static void main( String[] args ) | |
{ | |
for ( int a = 1; a <= 500; a++ ) | |
{ | |
for ( int b = 1; b <= 500; b++ ) | |
{ |
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
import java.util.Scanner; | |
class primeNumber { | |
public static void main(String[] args) { | |
Scanner scanner = new Scanner(System.in); | |
System.out.print("Enter your input number:"); | |
int n = scanner.nextInt(); | |
int j = 2; | |
int result = 0; | |
while (j <= n / 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
<script src="http://code.jquery.com/jquery-2.1.3.min.js"></script> | |
<script type="text/javascript"> | |
$(document).ready(function(){ | |
$("#submit").click(function(){ | |
var postInputVal = $("#postinput").val(); | |
$("#postecho").val(postInputVal); | |
console.log("OK!"); | |
}); | |
}); | |
</script> |
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
<?php | |
require_once('TwitterAPIExchange.php'); | |
$settings = array( | |
'oauth_access_token' => "", | |
'oauth_access_token_secret' => "", | |
'consumer_key' => "", | |
'consumer_secret' => "" | |
); | |
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
#output grade results dependent on student score | |
puts "Enter the students score: " | |
score = gets.to_i | |
while score > 100 | |
puts "You must enter a number less then or equal to 100 " | |
puts "Enter the students score: " | |
score = gets.to_i | |
end | |
while score == 100 |
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
#!/usr/bin/ruby | |
# Request 2 numbers from user and perform calculation | |
print "Enter value of a: " | |
a = gets | |
print "Enter value of b: " | |
b = gets | |
print " a = " + a | |
print " b = " + b | |
print "b - a + 100 = " , (b.to_i - a.to_i + 100) |
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
puts("Hello World!") |
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
<?php | |
$unix = new DateTime(); //Unix Time Stamp (seconds since Jan 01 1970. (UTC)) | |
$unix_ts = $unix->getTimestamp(); | |
$now = $unix_ts - 1420070400; //seconds between Unix Time Stamp and Jan 1 2015(UTC) | |
$y_sui_tot = $now / 766.385574378; //suicide occurs every 766 seconds | |
$f_sui = number_format($y_sui_tot); | |
echo "<h1>Total Suicides in 2015: <br/>".$f_sui."</h1>"; | |
$y_sui_att = 25 * $y_sui_tot; // 25 suicide attempts before fatality |
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
<?php | |
// identify the data type of a $value using gettype function | |
// http://php.net/manual/en/function.gettype.php | |
$json = file_get_contents("http://mikestratton.net/temp/bigdatabox/tweetjson_RAW.php"); | |
$t_query = json_decode($json,true); | |
$name = $t_query ['statuses'][0]['user']['name']; | |
$screen = $t_query ['statuses'][0]['user']['screen_name']; | |
$text = $t_query ['statuses'][0]['text']; | |
$query = $t_query ['search_metadata']['query']; |
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
<?php | |
//Use the force, Luke: https://twitteroauth.com/ | |
require "vendor/autoload.php"; | |
use Abraham\TwitterOAuth\TwitterOAuth; | |
$twitterConnection = new TwitterOAuth( | |
'', //Consumer Key | |
'', //Consumer secret | |
'', //Access token | |
'' //Access token secret |