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 <iostream> | |
using namespace std; | |
int main() { | |
cout << "x postfix = " << x++ << endl; | |
cout << "x after postfix " << x << endl; | |
cout << "x prefix = " << ++x << endl; | |
cout << "x after prefix " << x << endl; | |
} |
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
URL url = new URL("http://yoururl.com"); | |
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection(); | |
conn.setReadTimeout(10000); | |
conn.setConnectTimeout(15000); | |
conn.setRequestMethod("POST"); | |
conn.setDoInput(true); | |
conn.setDoOutput(true); | |
Uri.Builder builder = new Uri.Builder() | |
.appendQueryParameter("firstParam", paramValue1) |
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
var totalSec = yourTime / 1000; | |
var minutes = parseInt( totalSec / 60 ) % 60; | |
var seconds = totalSec % 60; | |
var result = (hours < 10 ? "0" + hours : hours) + "-" + (minutes < 10 ? "0" + minutes : minutes) + "-" + (seconds < 10 ? "0" + seconds : seconds); |
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
// Chrome extension button / popup / requester | |
chrome.tabs.getSelected(null, function(tab) { | |
chrome.tabs.sendRequest( | |
tab.id, // id of the tab to send a request to. | |
{method: "getHighlighted", name: "John"}, // data to send to the tab | |
function(response) { // function to execute when the tab responds. | |
if (response.method == 'getHighlighted') { | |
chrome.setClipboard(response.data); // Something like this. | |
// response.data contains our highlighted text. | |
} |
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
var Student = function(name, course, pace) { | |
this.name = name; | |
this.course = course; | |
this.pace = pace; | |
this.printStudent = function() { | |
console.log(this.name, this.course, this.pace); | |
} | |
} |
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 HelloWorld{ | |
public static void main(String []args){ | |
System.out.println("Hello World"); | |
Float x = 5; | |
try { | |
Float.parseInt(x); | |
} catch (ParseException e) { | |
// Required to catch this because of throws statement in method declaraction | |
System.out.println("Parse exception"); |
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
Name: John Doe | |
Bloc Program / length: Android, 36-week | |
App Name: MoneyLens | |
Description: | |
This app blah blah | |
How did you come up with the idea? | |
I’m a blah blah and I blah therefore blah |
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
URL requestUrl = new URL(fullURLRequest); | |
HttpUrlConnection urlConnection = (HttpURLConnection) requestUrl.openConnection(); | |
InputStream inputStream = new BufferedInputStream(urlConnection.getInputStream()); | |
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); | |
StringBuilder jsonString = new StringBuilder(); | |
// You only want to call readLine once - the assignment will fail once readLine is null; | |
// calling ReadLine twice will cause an error. | |
while (String line = bufferedReader.readLine()) { | |
jsonString.append(line); | |
} |
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
Calendar calendar = new GregorianCalendar(TimeZone.getDefault()); |
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
this.collidesWith = function(otherObject) { | |
var width = 2*this.radius; | |
var height = 2*this.radius; | |
var translatedX = this.x - radius; | |
var translatedY = this.y - radius; | |
if (translatedX < otherObject.x + otherObject.width && | |
translatedX + width > otherObject.x && | |
translatedY < otherObject.y + otherObject.height && | |
height + translatedY > otherObject.y) { |