Deploy a Express.js project on Heroku
Step by step from command line by Steve Tuan
const PORT = process.env.PORT || 3000
app.listen(PORT, () => console.log(`Example app listening on port ${PORT}!`))
| <?php | |
| class UserFactory | |
| { | |
| private function __construct() | |
| { | |
| } | |
| public static function Instance() | |
| { |
| <?php | |
| class Automobile | |
| { | |
| private $vehicleMake; | |
| private $vehicleModel; | |
| public function __construct($make, $model) | |
| { | |
| $this->vehicleMake = $make; | |
| $this->vehicleModel = $model; |
| <?php | |
| class Database | |
| { | |
| protected $adapter; | |
| public function __construct() | |
| { | |
| $this->adapter = new MysqlAdapter; | |
| } |
| // delete With temp table | |
| CREATE TABLE temp_users AS | |
| SELECT * FROM users GROUP BY user_name; | |
| DROP TABLE users; | |
| RENAME TABLE temp_users TO users; | |
| // delete and keep lower id | |
| DELETE u1 FROM users u1, users u2 |
| <?php | |
| $ch = curl_init('https://pal-test.adyen.com/pal/servlet/Payment/v25/refund'); | |
| # Setup request to send json via POST. | |
| $payload = '{ | |
| "merchantAccount": "ZaloraTW", | |
| "modificationAmount": { | |
| "currency": "TWD", | |
| "value": 8739100.00 | |
| }, |
| import requests | |
| API_URL = 'https://en.wikipedia.org/w/api.php?action=parse§ion=0&prop=text&format=json&page=' | |
| def get(topic): | |
| r = requests.get(API_URL + topic) | |
| return r.text | |
| def getTopicCount(topic): | |
| text = get(topic) |
| #include <iostream> | |
| #include <vector> | |
| using namespace std; | |
| int tour(int num_kid, int x) | |
| { | |
| vector<int> v; | |
| for (int i=0; i<num_kid; i++) { | |
| v.push_back(i); | |
| } |
| // you can use includes, for example: | |
| // #include <algorithm> | |
| #include <unordered_set> | |
| // you can write to stdout for debugging purposes, e.g. | |
| // cout << "this is a debug message" << endl; | |
| int solution(vector<int> &A) { | |
| // write your code in C++14 (g++ 6.2.0) | |
| unordered_set<int> s; | |
| int max = 0; |
Step by step from command line by Steve Tuan
const PORT = process.env.PORT || 3000
app.listen(PORT, () => console.log(`Example app listening on port ${PORT}!`))
| class Notifier | |
| { | |
| constructor() { | |
| this.events = []; | |
| } | |
| on(eventName, callback) { | |
| var self = this; | |
| this.events.push(callback); |