Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 express = require('express'), | |
router = express.Router(), | |
{ default: axios } = require('axios') | |
require('dotenv').config() | |
router.post('/api/youtube/view-count', async (req, res) => { | |
// https://developers.google.com/youtube/v3/docs/videos/list?apix=true&apix_params=%7B%22part%22%3A%5B%22statistics%2C%20status%22%5D%2C%22id%22%3A%5B%22_IrFoihwTUc%22%5D%7D#parameters | |
const youtubeBroadcastId = req.body.youtubeBroadcastId |
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 express = require('express'), | |
router = express.Router(), | |
{ default: axios } = require('axios') | |
require('dotenv').config() | |
router.post('/api/twitch/view-count', async (req, res) => { | |
// twitch forum: https://discuss.dev.twitch.tv/t/viewer-counter-help/24726/2 | |
// https://discuss.dev.twitch.tv/t/getting-stream-viewer-count-webhook-notifications/20645/5 |
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
#![feature(bench_black_box)] | |
use rand::rngs::SmallRng; | |
use rand::{Rng, SeedableRng}; | |
use std::hint::black_box; | |
use std::time::{Duration, Instant}; | |
fn main() { | |
for error_rate in [0, 1, 10, 100] { | |
println!( | |
"sqrt {}: {:?}", |
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
// SPDX-License-Identifier: MIT | |
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) | |
pragma solidity ^0.8.0; | |
import "../utils/Context.sol"; | |
/** | |
* @dev Contract module which provides a basic access control mechanism, where | |
* there is an account (an owner) that can be granted exclusive access to |
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 testQuery = async query => { | |
const pool = new sql.ConnectionPool({ // ... //}) | |
try { | |
await pool.connect() | |
return await pool.request().query(` | |
BEGIN TRANSACTION | |
${query} | |
ROLLBACK TRANSACTION | |
`) |
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
1. Create Procfile at the root of each frontend and backend folder (with command to start the server) | |
2. Create Heroku dynos for each (frontend and backend) | |
``` | |
heroku create -a my-awesome-frontend | |
heroku create -a my-awesome-backend | |
``` | |
3. Get the auth token from Heroku by running: `heroku auth:token` #=> HEROKU_API_TOKEN | |
4. Add remote origin for frontend and backend | |
``` |
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
<?php | |
// Here is a sample of the URLs this regex matches: (there can be more content after the given URL that will be ignored) | |
// http://youtu.be/dQw4w9WgXcQ | |
// http://www.youtube.com/embed/dQw4w9WgXcQ | |
// http://www.youtube.com/watch?v=dQw4w9WgXcQ | |
// http://www.youtube.com/?v=dQw4w9WgXcQ | |
// http://www.youtube.com/v/dQw4w9WgXcQ | |
// http://www.youtube.com/e/dQw4w9WgXcQ | |
// http://www.youtube.com/user/username#p/u/11/dQw4w9WgXcQ |
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 tweepy | |
# Authenticate to Twitter | |
auth = tweepy.OAuthHandler("CONSUMER_KEY", "CONSUMER_SECRET") | |
auth.set_access_token("ACCESS_TOKEN", "ACCESS_TOKEN_SECRET") | |
# Create API object | |
api = tweepy.API(auth) | |
# Create a tweet |
NewerOlder