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
#!/bin/bash | |
# check if main.go file exists | |
if [ -f "main.go" ]; then | |
echo "go run ." | |
go run . | |
exit $? | |
fi | |
# check if go.mod file exists |
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
#! /usr/bin/env node | |
const { exec } = require('child_process'); | |
const fs = require('fs'); | |
const doOutput = (z) => { | |
console.log(z.gitdir, z.status); | |
}; | |
const doGitPull = (next) => (z) => { | |
exec('git pull', { cwd: z.gitdir }, (err, stdout, stderr) => { |
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
#! /usr/bin/env node | |
// Method 1, using get and set literals instead of the function keyword | |
var time1 = { | |
seconds: 0, | |
get milliseconds() {return this.seconds * 1000;}, | |
set milliseconds(x) {this.seconds = x / 1000;} | |
}; | |
time1.milliseconds = 1750; | |
console.log(time1.seconds, time1.milliseconds); // outputs 1.75 1750; |