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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
/* | |
* Usage: | |
* new Date().weekBounds() | |
* | |
* or | |
* | |
* weekBounds(new Date()); | |
*/ | |
function weekBounds(date) { |
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
function dayBounds(date) { | |
var t1 = new Date(date.getTime()); | |
t1.setHours(0, 0, 0, 0); | |
var t2 = new Date(date.getTime()); | |
t2.setHours(23, 59, 59, 999); | |
return [t1, t2]; | |
} |
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
package main | |
import ( | |
"fmt" | |
"log" | |
"os" | |
"os/signal" | |
"syscall" | |
) |
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
#!/bin/sh | |
read -p "Install directory [/root]: " installDir; installDir=${installDir:-/root}; echo $installDir |
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
#!/bin/bash | |
for i in {1..10000}; do | |
echo "[$(date)] - Lorem ipsum dolor sit amet, consectetur adipisicing elit -> $i" >> log/app.log; | |
done |
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 jsonTimeLayout = "2006-01-02T15:04:05+07:00" | |
// JSONTime is the time.Time with JSON marshal and unmarshal capability | |
type JSONTime struct { | |
time.Time | |
} | |
// UnmarshalJSON will unmarshal using 2006-01-02T15:04:05+07:00 layout | |
func (t *JSONTime) UnmarshalJSON(b []byte) error { | |
parsed, err := time.Parse(jsonTimeLayout, string(b)) |
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
// Timeout promise for delaying something | |
function timeout(millis) { | |
return new Promise((resolve, reject) => { | |
setTimeout(() => { | |
resolve(); | |
}, millis); | |
}) | |
} | |
// Costly function, it require 1sec every invocation. |
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
function timeout(millis) { | |
return new Promise((resolve, reject) => { | |
setTimeout(resolve, millis); | |
}); | |
} | |
class Dispatcher { | |
constructor() { | |
this.listeners = []; | |
this.delayedListeners = []; |
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
- pipeline: "Staging " | |
trigger_mode: "ON_EVERY_PUSH" | |
ref_name: "master" | |
ref_type: "BRANCH" | |
actions: | |
- action: "Build Docker image" | |
type: "DOCKERFILE" | |
login: "$DOCKER_LOGIN" | |
password: "$DOCKER_PASS" | |
docker_image_tag: "$BUDDY_EXECUTION_REVISION,stage" |
OlderNewer