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
function testDivisors(value, divisor1, divisor2) { | |
if ((value != divisor1) && (value % divisor1 === 0)) { | |
return divisor1; | |
} else if (value != divisor2 && value % divisor2 === 0) { | |
return divisor2; | |
} else { | |
return 0; | |
} | |
} | |
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
' Tutorial @ http://www.youtube.com/watch?v=G6ZbQ1kpAtQ&list=PL63C2673281C99172&index=4 | |
Private Sub _KeyDown(ByVal Sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown | |
If e.KeyValue = Keys.W Then | |
Label1.Text = "W Pressed" | |
End If | |
If e.KeyValue = Keys.S Then | |
Label2.Text = "S Pressed" | |
End If | |
End Sub |
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
' Tutorial @ http://www.youtube.com/watch?v=Pd8TGRrDDMc&list=PL63C2673281C99172&index=3 | |
Option Explicit On | |
Imports System.IO | |
Imports System.Net.Sockets | |
Public Class Form1 | |
Dim Listener As New TcpListener(8000) | |
Dim Client As TcpClient | |
Private Sub _FormClosing() Handles Me.FormClosing |
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
' Tutorial @ http://www.youtube.com/watch?v=1TKdNy2lDH0&list=PL63C2673281C99172&index=2 | |
Imports System.IO | |
Public Class Form1 | |
Private Sub readFile() Handles Button1.Click | |
Dim Location As String = "" | |
Dim Reader As New StreamReader(location, false) | |
TextBox1.Text = Reader.ReadToEnd | |
Reader.Close() | |
End Sub |
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
var x, y, Xs, Ys; | |
// Assign objects. | |
x = { | |
"id": 0, | |
"Ys": [] | |
}; | |
y = { | |
"id": 0, |
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
var makeSealer = function () { | |
var users = [], passwords = []; | |
return { | |
sealer: function (username, password) { | |
var i = users.length, | |
user = {username: username}; | |
users[i] = user; | |
passwords[i] = password; | |
return user; |
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 math | |
# This solution assumes valid input in terms of type and range. | |
# Main returns the sign, exponent and mantissa in "Excess 64" format. | |
def main(): | |
value = float(input("Enter a number. ")) | |
sign = "0" | |
if value < 0: | |
sign = "1" | |
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
var foo = (function me(x) { | |
if (x < 10) { | |
return me(x + 1); | |
} | |
else { | |
return x; | |
} | |
}(1)); | |
// In this case foo will be equal to 10. |
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
sqrt = (() -> | |
sqrtIter = (guess, x) -> | |
if goodGuess(guess, x) then guess | |
else sqrtIter((guess + x / guess) / 2, x) | |
goodGuess = (guess, x) -> Math.abs(guess * guess - x) / x < 0.0000001 | |
(x) -> sqrtIter(1.0, x) | |
)() |
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
var triangular = function (value) { | |
var abs = Math.abs(value); | |
return ((abs / 2) * (abs + 1)) * (abs / value) || 0; | |
}; | |
// Testing code. | |
var testTriangular = function () { | |
var testTriangularValue = function (arg, value, id) { | |
console.log(triangular(arg) === value ? "Test " + id + " passed." : "Test " + id + " failed."); | |
}; |
OlderNewer