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 init() { | |
final AsyncTask<String, Void, Document> t = new ParseTextTask().execute(new String[] {"http://google.com"}); | |
} | |
private class ParseTextTask extends AsyncTask<String, void, Document> { | |
@Override | |
protected Document doInBackground(String... params) { | |
return Jsoup.connect(params[0]).get(); |
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
/* | |
=RESPONSIVE STYLES | |
by Johan Brook for Macpro.se | |
--------------------------------------------- */ | |
@media only screen and (max-width: 900px) { | |
#page { | |
margin: 0 5%; | |
max-width: none; | |
font-size: 1.6rem; |
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
._6nw._4g5r .fbPageBannerInner, html ._6nw._4g5r #blueBarHolder #blueBar { | |
margin-left: -205px !important; | |
} | |
body._4g5r .fbChatSidebar { | |
left: auto !important; | |
right: 0 !important; | |
} | |
._4_37 { |
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
quick_sort(f, left, right) -> | |
return if right < left | |
first, last = f.first, f.last | |
pivot = (first + last) / 2 | |
middle = _partition(f, 0, last, pivot) | |
swap(middle, pivot, f) |
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 path between to a node, with a weight and stored | |
* reference for a path from a start node. | |
*/ | |
private class ComparableDijkstraPath<V extends Edge> | |
implements Comparable<ComparableDijkstraPath<V>> { | |
/** | |
* The reached node | |
*/ |
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
@Test | |
public void testBinarySqrt() { | |
double number = 2; | |
double delta = 10E-6; | |
double ourResult = Uppg2.binarySqrt(number, delta); | |
double mathResult = Math.sqrt(number); | |
System.out.println("Our result: "+ ourResult); | |
System.out.println("Math.sqrt(): " + mathResult); |
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
# PostgreSQL. Versions 8.2 and up are supported. | |
# | |
# Install the pg driver: | |
# gem install pg | |
# On Mac OS X with macports: | |
# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config | |
# On Windows: | |
# gem install pg | |
# Choose the win32 build. | |
# Install PostgreSQL and put its /bin directory on your path. |
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
/** | |
* Where all the action is. Listens to card clicks. | |
*/ | |
public void actionPerformed(ActionEvent e){ | |
// Handle the New game and Quit button events: | |
String action = e.getActionCommand(); | |
if("new".equals(action) && !timer.isRunning()){ | |
nyttSpel(); |
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
// Fetch and set the IMDb ID stored in the title field | |
String imdbID = (String) this.titleField.getTag(); | |
if(imdbID != null) { | |
movie.setImdbID(imdbID); | |
} | |
// Insert into database | |
ContentValues movieValues = new ContentValues(); | |
movieValues.put(MoviesTable.COLUMN_TITLE, movie.getTitle()); | |
movieValues.put(MoviesTable.COLUMN_RATING, movie.getRating()); |
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
/** | |
* Get the nth prime number. | |
* | |
* @param n A number | |
* @return The nth prime number | |
*/ | |
public static int prime(int n) { | |
int counter = 0; | |
int number = 1; | |