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 {Storage} = require('@google-cloud/storage'); | |
const storage = new Storage({ | |
projectId: 'akbarserver', | |
keyFilename: './service-account.json' | |
}); | |
function uploadFile(filename, bucketName) { | |
return storage.bucket(bucketName).upload(filename, { | |
gzip: true, |
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 ffmpeg = require('fluent-ffmpeg'); | |
var path = require('path'); | |
new ffmpeg(path.join(__dirname, 'input.mp4')) | |
.takeScreenshots({ | |
filename: 'thumbnail.png', | |
size: '640x480', | |
timemarks: [ '50%' ], | |
}, __dirname, function(err) { | |
if (err) { |
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 getThumbnails = (videoUrl) => { | |
const videoId = videoUrl.replace('https://www.youtube.com/watch?v=', ''); | |
return ['hqdefault', 'mqdefault', 'maxresdefault'].map(size => `https://img.youtube.com/vi/${videoId}/${size}.jpg`); | |
} |
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 getGoogleDriveFilePublicLink = (fileId) => `https://docs.google.com/uc?id=${fileId}`; | |
export default getGoogleDriveFilePublicLink; |
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 useFormik(props) { | |
// useState to keep the same observable around without recreating it on each render | |
const [formik] = React.useState(() => | |
mobx.observable({ | |
values: props.initialValues || {}, | |
touched: {} | |
}) | |
) | |
// just mutate state, this function itself can be considered an action+reducer |
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 Web3 = require('web3'); | |
const testnet = 'https://rinkeby.infura.io/'; | |
const walletAddress = '0xcde7bd7943944dc558a427ef061400a4da9ee822'; | |
void async function() { | |
try { | |
const web3 = new Web3(new Web3.providers.HttpProvider(testnet)); | |
const balance = await web3.eth.getBalance(walletAddress); | |
console.log('the balance is', web3.utils.fromWei(balance, 'ether')) | |
} catch (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
const axios = require('axios'); | |
const dashcore = require('dashcore-lib'); | |
const API_BASE_URL = 'https://testnet-insight.dashevo.org/insight-api-dash'; | |
const sender = { | |
address: 'yRtqi4khyBHknDGarrsgrJLdvDipmbcbXx', | |
privateKey: '6e38851a2df2866b95e87aa7cb1c37356a5f6a2546ba7249b86a656288ed18dd' | |
}; |
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 axios = require('axios'); | |
const dashcore = require('dashcore-lib'); | |
const API_BASE_URL = 'https://testnet-insight.dashevo.org/insight-api-dash'; | |
const sender = { | |
address: 'yRtqi4khyBHknDGarrsgrJLdvDipmbcbXx', | |
privateKey: '6e38851a2df2866b95e87aa7cb1c37356a5f6a2546ba7249b86a656288ed18dd' | |
}; |
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 from 'react'; | |
import messages from './messages.js'; | |
import { Link } from 'react-router'; | |
import { FormattedMessage } from 'react-intl'; | |
const Home = () => ( | |
<div> | |
<header> | |
<FormattedMessage {...messages.home_link}> | |
{(homeLink) => <FormattedMessage {...messages.header} values={{ link: <Link to="/">{ homeLink }</Link> }} />} |