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
| selectImage = async () => { | |
| ImagePicker.showImagePicker(options, async (response) => { | |
| if (response.didCancel) { | |
| this.setState({ error: 'Image upload failed', loading: null }); | |
| } else if (response.error) { | |
| this.setState({ error: 'Image upload failed', loading: null }); | |
| } else if (response.customButton) { | |
| this.setState({ error: 'Image upload failed', loading: 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
| upload = async () => { | |
| this.setState({ | |
| loading: true | |
| }); | |
| if (!this.state.uploadStatus) { | |
| this.setState({ loading: null }) | |
| return alert('Image yet to be uploaded') | |
| } | |
| if (this.state.label === '') { | |
| this.setState({ loading: 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
| const code =fs.readFileSync('./contracts/StoreHash.sol').toString(); | |
| const solc = require('solc'); | |
| const compiledCode = solc.compile(code); | |
| const abi =JSON.parse(compiledCode.contracts[':SaveAddress'].interface); | |
| const SavingContract = new web3.eth.Contract(abi, '0xb1caf625d9d29421dfd8dae4a7a9083b4175f80a'); | |
| // where 0xb1caf625d9d29421dfd8dae4a7a9083b4175f80a is the ethereum address |
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
| exports.getScreenShot = async (req, res) => { | |
| const { address } = req.query; | |
| // web address you want to screenshot , Default is medium.com | |
| const webAddress = `https://${( address || 'medium')}.com`; | |
| try { | |
| const browser = await puppeteer.launch(); | |
| const page = await browser.newPage(); | |
| await page.goto(webAddress); | |
| await page.screenshot({ path: `./assets/snapshot.png` }); | |
| await browser.close(); |
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
| exports.getNews = async (req, res) => { | |
| const { address } = req.query; | |
| const webAddress = `https://${(address || 'news.ycombinator')}.com`; | |
| try { | |
| const browser = await puppeteer.launch(); | |
| const page = await browser.newPage(); | |
| await page.goto(`${webAddress}`, { waitUntil: 'networkidle2' }); | |
| await page.pdf({ path: `./assets/news.pdf`, format: 'A4' }); |
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
| exports.scrapeTwittter = async (req, res) => { | |
| let ret = []; | |
| const { search } = req.query; | |
| try { | |
| const browser = await puppeteer.launch({ args: ['--no-sandbox', '--disable-setuid-sandbox'] }); | |
| const page = await browser.newPage(); | |
| await page.goto(`https://twitter.com/search?f=tweets&vertical=default&q=${search}&src=typd`); | |
| //set viewport for the autoscroll function | |
| await page.setViewport({ | |
| width: 1200, |
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 path = require('path'); | |
| const glob = require('glob'); | |
| const fs = require('fs'); | |
| const loadMetroConfig = require('@react-native-community/cli/build/tools/loadMetroConfig') | |
| .default; | |
| const loadConfig = require('@react-native-community/cli/build/tools/getLegacyConfig') | |
| .default; | |
| const Server = require('metro/src/Server'); |
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 models | |
| import ( | |
| "github.com/jinzhu/gorm" | |
| ) | |
| //User struct declaration | |
| type User struct { | |
| gorm.Model | |
| Name string |
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 utils | |
| import ( | |
| "auth/models" | |
| "fmt" | |
| "log" | |
| "os" | |
| "github.com/jinzhu/gorm" | |
| _ "github.com/jinzhu/gorm/dialects/postgres" //Gorm postgres dialect interface |
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 ( | |
| "auth/models" | |
| "auth/utils" | |
| "encoding/json" | |
| "fmt" | |
| "net/http" | |
| "golang.org/x/crypto/bcrypt" | |
| ) |