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 cluster = require('cluster'); | |
| if (cluster.isWorker) { | |
| console.log('Worker ' + process.pid + ' has started.'); | |
| // Send message to master process. | |
| process.send({msgFromWorker: 'This is from worker ' + process.pid + '.'}) | |
| // Receive messages from the master process. |
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
| # Sample Nginx config with sane caching settings for modern web development | |
| # | |
| # Motivation: | |
| # Modern web development often happens with developer tools open, e. g. the Chrome Dev Tools. | |
| # These tools automatically deactivate all sorts of caching for you, so you always have a fresh | |
| # and juicy version of your assets available. | |
| # At some point, however, you want to show your work to testers, your boss or your client. | |
| # After you implemented and deployed their feedback, they reload the testing page – and report | |
| # the exact same issues as before! What happened? Of course, they did not have developer tools | |
| # open, and of course, they did not empty their caches before navigating to your site. |
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
| // 1. Por Defecto - Funcion ejecutada como “funcion”. | |
| function regresaMiContexto(){ | |
| return this; | |
| } | |
| function regresaMiContextoEnModoEstricto(){ | |
| 'use strict'; | |
| return this; | |
| } |
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
| if ($request_uri = /) { | |
| set $test A; | |
| } | |
| if ($host ~* teambox.com) { | |
| set $test "${test}B"; | |
| } | |
| if ($http_cookie !~* "auth_token") { | |
| set $test "${test}C"; |
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
| Running shell scripts that have contain sudo commands in them from jenkins might not run as expected. To fix this, follow along | |
| Simple steps: | |
| 1. On ubuntu based systems, run " $ sudo visudo " | |
| 2. this will open /etc/sudoers file. | |
| 3. If your jenkins user is already in that file, then modify to look like this: | |
| jenkins ALL=(ALL) NOPASSWD: ALL | |
| 4. save the file by doing Ctrl+O (dont save in tmp file. save in /etc/sudoers, confirm overwrite) | |
| 5. Exit by doing Ctrl+X | |
| 6. Relaunch your jenkins job |
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
| /** | |
| * This gist was inspired from https://gist.github.com/homam/8646090 which I wanted to work when uploading an image from | |
| * a base64 string. | |
| * Updated to use Promise (bluebird) | |
| * Web: https://mayneweb.com | |
| * | |
| * @param {string} base64 Data | |
| * @return {string} Image url | |
| */ | |
| const imageUpload = async (base64) => { |
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
| /** | |
| * Delete an image from the S3 Bucket | |
| * | |
| * @author Daveyon Mayne <@MirMayne> | |
| * @date July 14th 2019 | |
| */ | |
| const AWS = require('aws-sdk'); | |
| const deletePhoto = async (avatar_url) => { |
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 commentSchema = new Schema({ | |
| postId: { | |
| type: String, | |
| hashKey: true | |
| }, | |
| id: { | |
| type: String, | |
| rangeKey: true, | |
| default: shortId.generate |