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
| #.bash_profile | |
| if [ -f ~/.bashrc ]; then | |
| . ~/.bashrc | |
| fi | |
| #============================================================ | |
| # | |
| # ALIASES AND FUNCTIONS | |
| # Arguably, some functions defined here are quite big. | |
| # If you want to make this file smaller, these functions can |
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
| private void createInitReturnItems(List<Delivery> deliveryItems) throws Exception { | |
| // 생략 | |
| deliveryMapper.createDeliveryItems(deliveryItems.stream() | |
| .filter(d -> d.getDeliveryTrackingNumber().equals(targetTrackingNumber)) | |
| .map(d -> DeliveryFactory.createInitReturnItem(d)) | |
| .collect(Collectors.toList())); | |
| // 생략 |
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
| var Q = require("q"); | |
| var something = function(callback) { | |
| return Model.findAll() | |
| .nodeify(callback); | |
| } |
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
| var something = function(callback) { | |
| Model.findAll() | |
| .then(function(result) { | |
| return callback(result); | |
| }) | |
| .catch(function(err) { | |
| return callback(err); | |
| }); | |
| } |
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
| var fs = require("fs"); | |
| var Q = require("q"); | |
| var existsPromise = function() { | |
| var deferred = Q.defer(); | |
| fs.exists("./copy.txt", function(exists) { | |
| if(!exists) { | |
| return deferred.reject(new Error()); | |
| } | |
| deferred.resolve(exists); |
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
| var fs = require('fs'); | |
| fs.exists("./copy.txt", function (exists) { | |
| if(exists) { | |
| console.log("파일을 발견했습니다."); | |
| fs.readFile("./copy.txt", "utf-8", function (err, data) { | |
| if (err) throw err; | |
| fs.writeFile("paste.txt", data, function (err) { | |
| if (err) throw err; | |
| console.log("파일을 저장했습니다."); |
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
| var fs = require("fs"); | |
| var Q = require("q"); | |
| var asyncFunction = Q.denodeify(fs.readFile); | |
| asyncFunction("./sample.file", "utf8") | |
| .then(function(result) { | |
| console.log(result); | |
| }); |
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
| var fs = require("fs"); | |
| var asyncFunction = function(callback) { | |
| fs.readFile("./sample.file", "utf8", function(err, data) { | |
| callback(data); | |
| }); | |
| } | |
| asyncFunction(function(result) { | |
| console.log(result); |
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
| var fs = require(“fs”); | |
| var asyncFunction = function(callback) { | |
| fs.exists(“./sample.file”, function (exists) { | |
| callback(exists); | |
| }); | |
| } | |
| asyncFunction(function(result) { | |
| console.log(result); |
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
| var fs = require("fs"); | |
| var Q = require("q"); | |
| var asyncFunction = function() { | |
| var deferred = Q.defer(); | |
| fs.exists("./sample.file", function (exists) { | |
| deferred.resolve(exists); | |
| }); | |
| return deferred.promise; | |
| } |
NewerOlder