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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
package learnjava.testing; | |
/** | |
* Created by Isuru on 20/03/2017. | |
*/ | |
public class Main { | |
public static void main(String args[]){ | |
System.out.println(" J A V V A"); | |
System.out.println(" J A A V V A A"); | |
System.out.println("J J AAAAA VV AAAAA"); |
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
package learnjava.testing; | |
import javax.swing.*; | |
/** | |
* Created by Isuru on 20/03/2017. | |
*/ | |
public class Main { | |
public static void main(String args[]){ |
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
package learnjava.general; | |
/** | |
* Created by Isuru on 23/03/2017. | |
*/ | |
public class RandomCharacter { | |
/** Generates random character */ | |
public static char getRandomCharacter(char ch1, char ch2){ | |
return (char) (ch1 + Math.random() * (ch2 - ch1 + 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
package uk.co.stableweb; | |
public class HelloWord { | |
/** | |
* Launch the application. | |
*/ | |
public static void main(String[] args) { | |
System.out.println("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
/* | |
|-------------------------------------------------------------------------- | |
| Web Routes | |
|-------------------------------------------------------------------------- | |
| | |
| Here is where you can register web routes for your application. These | |
| routes are loaded by the RouteServiceProvider within a group which | |
| contains the "web" middleware group. Now create something great! | |
| | |
*/ |
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/env python | |
#A System Information Gathering Script | |
import subprocess | |
#Command 1 | |
uname = “uname” | |
uname_arg = “-a” | |
print "Gathering system information with %s command:\n" % uname |
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/env python | |
#A System Information Gathering Script | |
import subprocess | |
#Command 1 | |
def uname_func(): | |
uname = "uname" | |
uname_arg = "-a" | |
print "Gathering system information with %s command:\n" % uname |
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
def search(arr, x, lowest_index, highest_index): | |
#find the middle index | |
middle_index = lowest_index + (highest_index - lowest_index) / 2 | |
print "Middle index is ", middle_index | |
# checks whether the value is in the middle index | |
if (arr[middle_index] == x): | |
return middle_index | |
elif (arr[middle_index] > x): | |
# checks in <- direction |
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
package uk.co.stableweb; | |
public class BinarySearch { | |
public static void main(String[] args) { | |
// Create an array | |
int[] array = {1, 3, 5, 7, 9, 11, 15, 17, 19}; | |
// Initially lowest index is 0 | |
int lowestIndex = 0; |
OlderNewer