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
for(int i = 0; i < arr.length; i++) { | |
for(int j = 0; j < arr[i].length; j++) { | |
System.out.print(arr[i][j] + "\t"); | |
} | |
System.out.println(); | |
} |
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 make_sites(options = {}) | |
times = options[:times] ? options[:times] : 50 | |
users = options[:users] ? options[:users] : User.all | |
times.times do |t| | |
n = Site.new | |
begin | |
n.user = users.sample | |
n.hostname = "siteno#{t}" | |
n.save | |
puts t |
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 make_sites(options = {}) | |
times = options[:times] ? options[:times] : 50 | |
users = options[:users] ? options[:users] : User.all | |
times.times do |t| | |
n = Site.new | |
begin | |
n.user = users.sample | |
n.hostname = "siteno#{t}" | |
n.save | |
puts "site #{t}" |
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
public class experiment { | |
public static void main(String[] args) { | |
throw new ArrayIndexOutOfBoundsException(); | |
} | |
} |
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
public class TestExample { | |
public static void main(String[] args) { | |
int[] a = {}; | |
expect("it should leave the empty list alone", a, "[]"); | |
int[] b = {39}; | |
expect("it should leave the single element list alone", b, "[39]"); | |
int[] c = {39, 42}; | |
expect("it should leave the two element list alone", c, "[39, 42]"); | |
int[] d = {39, 42, 9001}; | |
expect("it should reverse this one chunk of three", d, "[9001, 42, 39]"); |
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
public void testFunction() { | |
reverse3(); | |
} |
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
public int compareTo(Human other) { | |
if(age < other.age) { | |
return -1; | |
} else if (age > other.age) { | |
return 1; | |
} else { | |
return 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
public int compareTo(Human other) { | |
if(age < other.age) { | |
return -1; | |
} else if (age > other.age) { | |
return 1; | |
} else { | |
// Fall back to the logic for the second field only if the first two are equal. | |
if(guiltyPleasure < other.guiltyPleasure) { | |
return -1; | |
} else if(guiltyPleasure > other.guiltyPleasure) { |
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
# string_transform | |
# Usage: | |
# ruby string_transform.rb <target string> | |
# | |
# The hello world of genetic algorithms creates | |
# a random string and mutates it until it becomes | |
# the target string | |
def get_worth(item, target) | |
sum = 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
#!/usr/bin/sh | |
dafuq="echo \" betsuni baka baka\"" | |
$dafug |
OlderNewer