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
data:text/html,<h2><a href="https://www.khanacademy.org/computer-programming/what-is-it-adjustable/4857201710727168">What is it? (adjustable)</a></h2> <script src="https://www.khanacademy.org/computer-programming/what-is-it-adjustable/4857201710727168/embed.js?editor=yes&buttons=yes&author=yes&embed=yes"></script> <p>Made using: <a href="http://www.khanacademy.org/computer-programming">Khan Academy Computer Science</a>.</p> |
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
//Include Firebase and jQuery AJAX | |
var http = require("http"); | |
var Firebase = require("Firebase"); | |
var najax = require("najax"); | |
var minuteInterval = 30; | |
var howOften = 60 * 1000 * minuteInterval; //Should evaluate to "minuteInterval" minutes | |
//ka_api.js | |
/*** |
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
/* | |
* Step 1: Check to make sure user is logged in (if not, leave page) | |
* Step 2: Check to make sure logged in user, is an administrator (if not, leave page) | |
* Step 3: Load all tools onto the page. | |
*/ | |
/* The data we have on the current user. */ | |
var userData; | |
/* True iff we're done with the auth checks. */ | |
var authChecksDone = false; |
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
//The event names. These change according to whether or not the user is on a mobile device, or specifically a Windows Phone. | |
var isIEMobile = navigator.userAgent.indexOf("IEMobile") != -1; | |
var isMobile = navigator.userAgent.indexOf("Mobile") != -1; | |
var mouseevents = { | |
click: "click", | |
mousedown: isIEMobile ? "pointerdown" : (isMobile ? "touchstart" : "mousedown"), | |
mouseup: isIEMobile ? "pointerup" : (isMobile ? "touchend" : "mouseup"), | |
mousemove: isIEMobile ? "pointermove" : (isMobile ? "touchmove" : "mousemove"), | |
mouseenter: isIEMobile ? "pointerenter" : (isMobile ? "touchenter" : "mouseenter"), | |
mouseleave: isIEMobile ? "pointerleave" : (isMobile ? "touchleave" : "mouseleave") |
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
function characterPresent(stringParam, character) | |
--[[ | |
This function returns true if and only if character is in stringParam. | |
]]-- | |
--Loop through stringParam: | |
for i=1, #stringParam do | |
--If the current character is character, return true. | |
if stringParam:sub(i, i) == character then return true end | |
end | |
--If we go through the whole string without returning true, we get to this point. |
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
from math import sqrt | |
max = 800000 | |
smallest_prime_factor = [] | |
for num in range(max): smallest_prime_factor.append(0) | |
for num in range(2, max): | |
if smallest_prime_factor[num] == 0: | |
smallest_prime_factor[num] = num | |
for num2 in range(max//num): | |
if smallest_prime_factor[num*num2] == 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
def implies(x, y): | |
'''Tells us if x --> y''' | |
return ((not x) or y) | |
def digits(num, base=10): | |
'''Converts num to an array containing its digits from base specified''' | |
if num < base: return [num] | |
return digits((num-(num % base))//base, base)+[num % base] | |
# Answer for part d |
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
/** | |
* A class that models mathematical expressions. | |
* | |
* @author Noble H. Mushtak | |
* @version 1.0 (6 Oct 2016) | |
*/ | |
public class Expression | |
{ | |
/** | |
* These are the five operations allowed in our expressions. |
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
#include <stdio.h> | |
#include <stdlib.h> | |
//This is a datatype that can be either "A" or "B". | |
enum side { A, B }; | |
typedef enum side side; | |
//This is a datatype representing a record. | |
//It has both a side and a record number. | |
typedef struct { | |
side side; |
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.util.*; | |
/** | |
* Description | |
* | |
* @author Noble Mushtak | |
* @version 1.0 (DATE) | |
*/ | |
public class Template { | |
/** |
OlderNewer