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
| resource "aws_instance" "myInstance" { | |
| ami = "ami-06ce3edf0cff21f07" | |
| instance_type = "t2.micro" | |
| user_data = <<-EOF | |
| #!/bin/bash | |
| sudo su | |
| yum -y install httpd | |
| echo "<p> My Instance! </p>" >> /var/www/html/index.html | |
| sudo systemctl enable httpd | |
| sudo systemctl start httpd |
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
| exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1 | |
| echo "Started User Data" | |
| sudo su | |
| yum install httpd | |
| echo "<p> Instance 2! </p>" >> /var/www/html/index.html | |
| sudo systemctl enable httpd | |
| sudo systemctl start httpd |
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
| /* ----- Your Microservice ----- */ | |
| // An imaginary database | |
| const DATABASE = [{ id: 2, name: "Lou" }] | |
| // library.js | |
| function databaseLibrary() { | |
| return { | |
| findByID: (searched_id) => DATABASE.find(id => searched_id) | |
| } |
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
| import React, { Component } from "react"; | |
| import axios from "axios"; | |
| export default class extends Component { | |
| constructor(props) { | |
| super(props); | |
| this.state = { | |
| upload_file: null | |
| }; | |
| } |
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
| - name: Make artifact directory | |
| run: mkdir -p ./artifacts/${{ github.repository }} | |
| - name: Create Zip File | |
| uses: montudor/[email protected] | |
| with: | |
| args: zip -r ./artifacts/${{ github.repository }}/${{ github.sha }}.zip ./src | |
| - name: Push Zip to S3 | |
| uses: jakejarvis/[email protected] |
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
| class Initialisation { | |
| constructor() { | |
| this.aFunctionThatThrowsImmediately(); | |
| this.aFunctionThatThrowsLater(); | |
| } | |
| // Fake stuff to show the return values of module | |
| aFunctionThatThrowsImmediately() { | |
| console.log(this.errorCallback()); // error thrown, but platform not set | |
| } |
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 toCurry = function (func) { | |
| return function (val) { | |
| func(val); | |
| } | |
| }; | |
| toCurry(console.warn)('sdfsdf'); | |
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
| javascript: | |
| function createCookie(name,value,days) { | |
| if (days) { | |
| var date = new Date(); | |
| date.setTime(date.getTime() + (days * 24 * 60 * 60 *1000)); | |
| var expires = "; expires=" + date.toGMTString(); | |
| } else { | |
| var expires = ""; |
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
| const db = require('../../database/db.js'); | |
| // The following would be library code, touched barely ever | |
| const _executeTransaction = async(transaction) => { | |
| try { | |
| return await db.tx(transaction); | |
| } catch (e) { | |
| console.log(e); | |
| // Handle DB error | |
| } |
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
| Array.prototype.reduceLou = function( func, start = 0 ){ | |
| let state = start; | |
| for(let i = 0; i < this.length; i++) { | |
| state = func(state, this[i]); | |
| } | |
| return state; |