Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Mikeal Rogers mikeal

🏠
Working from home
View GitHub Profile
View example.js
class NeedsReady {
constructor () {
this.ready = new Promise(resolve => setTimeout(resolve, 1000))
}
async foo () {
await this.ready
return 'bar'
}
}
@mikeal
mikeal / stateless-interface.js
Created Feb 27, 2019
stateless interface example
View stateless-interface.js
class Database {
constructor (storage) {
this.count = 0
this.storage = storage
}
async get (cid) {
this.count += 1
return this.storage.get(cid.toBaseEncodedString())
}
async put (block) {
@mikeal
mikeal / script.zsh
Created Feb 21, 2019
delete all the aws log streams
View script.zsh
aws logs describe-log-streams --log-group-name="/aws/lambda/ghmetrics-staging-get-filter" --query 'logStreams[*].l│··········
ogStreamName' --output table | awk '{print $2}' | grep -v ^$ | while read x; do aws logs delete-log-stream --log-stream-name="$x" --log-group-name="/a│··········
ws/lambda/ghmetrics-staging-get-filter"; done
@mikeal
mikeal / vue.config.js
Created Apr 24, 2018
Vue config file for Electron demo.
View vue.config.js
module.exports = {
configureWebpack: config => {
if (process.env.NODE_ENV === 'production') {
config.output.publicPath = `${process.cwd()}/dist/`
}
}
}
@mikeal
mikeal / install.sh
Created Apr 24, 2018
Install step for Vue.js and Electron
View install.sh
npm install -g @vue/cli
vue create my-project
cd my-project
npm install electron
View sample.js
let myCid = await ipfs.dag.put({name: "Mikeal Rogers"})
let projectsCid = await ipfs.dag.put(
{ title: "A new post!",
content: "Opinions about things!"
author: {'/': myCid.toBaseEncodedString()}
}
)
@mikeal
mikeal / package.json
Created Apr 24, 2018
Dev script for package.json Vue.js Electron demo.
View package.json
{ "scripts":
{ "dev": "NODE_ENV=DEV vue-cli-service serve & sleep 5 && NODE_ENV=DEV electron app.js" }
}
@mikeal
mikeal / app.js
Created Apr 24, 2018
Application file for Vue.js Electron demo app.
View app.js
const electron = require('electron')
const app = electron.app
const BrowserWindow = electron.BrowserWindow
let url
if (process.env.NODE_ENV === 'DEV') {
url = 'http://localhost:8080/'
} else {
url = `file://${process.cwd()}/dist/index.html`
}
View app.js
const electron = require('electron')
const app = electron.app
const BrowserWindow = electron.BrowserWindow
let url
if (process.env.NODE_ENV === 'DEV') {
url = 'http://localhost:8080/'
} else {
url = `file://${process.cwd()}/dist/index.html`
}