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
(Celsius -> Farenheit) | |
Love takes everything | |
Billie Jean was exquisite | |
Annie was broke | |
Tonight is all in | |
Put Billie Jean over Annie into the storm | |
Put everything of the storm into my heart | |
Give back tonight with my heart | |
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
extern crate hex; | |
extern crate rand; | |
use rand::Rng; | |
fn create_byte_vector() -> Vec<u8> { | |
let mut random_bytes = rand::thread_rng().gen::<[u8; 16]>(); | |
random_bytes[6] = (random_bytes[6] & 0x0f) | 0x40; | |
random_bytes[8] = (random_bytes[8] & 0x3f) | 0x80; | |
random_bytes.to_vec() |
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 githubStream(delayTime = 2) { | |
const delay = () => new Promise(resolve => setTimeout(resolve, delayTime * 1000)) | |
let repos = []; | |
let maxIterations = 100; | |
function getCursor() { | |
if (repos.length) { | |
return repos[repos.length - 1].cursor; | |
} | |
return ''; |
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 request = asyncy('https://jsonplaceholder.typicode.com/todos') | |
awaiter() | |
.then(awaiter) | |
.then(console.log) | |
function awaiter(item) { | |
return request.next(item).value | |
} |
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 axios from 'axios'; | |
export const fetchSomeData = async (store, params) => { | |
try { | |
const res = await axios.get(`endpoint/${params.id}`); | |
return store.commit('SET_SOME_DATA', res.data.result); | |
} catch (error) { | |
console.error(error.message); | |
} | |
}; |
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 tableCanceller = new Cancellation(); | |
... | |
export const fetchTableData = (store, payload) => { | |
tableCanceller.check('Table API request cancelled'); | |
return axios | |
.post(`${payload.profileId}/report/${payload.reportId}/tabular`, payload.body, { | |
params: { | |
fromDate: payload.body.fromDate, | |
toDate: payload.body.toDate, |