This file contains 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
# app/controllers/graphql_controller.rb | |
class GraphqlController < ApplicationController | |
def execute | |
# Reading the `dclid` cookie | |
dclid = cookies[:dclid] | |
# Handle the GraphQL query | |
variables = ensure_hash(params[:variables]) | |
context = { |
This file contains 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 { BlurImage, YouTube } from "@dub/ui"; | |
import { nFormatter } from "@dub/utils"; | |
import { Eye, UserCheck, Video } from "lucide-react"; | |
import { Suspense } from "react"; | |
export function YoutubeChannel({ id }: { id: string }) { | |
return ( | |
<Suspense fallback={<div className="not-prose grid gap-4"></div>}> | |
<YoutubeChannelRSC id={id} /> | |
</Suspense> |
This file contains 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
### Dub.co Individual Contributor License Agreement | |
Thank you for your interest in contributing to open source software projects (“Projects”) made available by Dub Technologies, Inc. or its affiliates (Dub). This Individual Contributor License Agreement (“Agreement”) sets out the terms governing any source code, object code, bug fixes, configuration changes, tools, specifications, documentation, data, materials, feedback, information or other works of authorship that you submit or have submitted, in any form and in any manner, to Dub in respect of any of the Projects (collectively “Contributions”). If you have any questions respecting this Agreement, please contact [email protected]. | |
You agree that the following terms apply to all of your past, present and future Contributions. Except for the licenses granted in this Agreement, you retain all of your right, title and interest in and to your Contributions. | |
**Copyright License.** You hereby grant, and agree to grant, to Dub a non-exclusive, perpetual, irrevoc |
This file contains 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 ipToInt(ip: string) { | |
return ip.split(".").reduce((acc, octet) => (acc << 8) + parseInt(octet), 0); | |
} | |
function isIpInCIDR(ip: string, cidr: string) { | |
const [cidrIp, prefixLength] = cidr.split("/"); | |
const mask = -1 << (32 - parseInt(prefixLength)); | |
const ipInt = ipToInt(ip); | |
const cidrIpInt = ipToInt(cidrIp); |
This file contains 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
// Note: this gist is a part of this OSS project that I'm currently working on: https://github.com/steven-tey/dub | |
export default async function getTitleFromUrl (url: string) { | |
const controller = new AbortController(); | |
const timeoutId = setTimeout(() => controller.abort(), 2000); // timeout if it takes longer than 2 seconds | |
const title = await fetch(url, { signal: controller.signal }) | |
.then((res) => { | |
clearTimeout(timeoutId); | |
return res.text(); | |
}) |
This file contains 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
// components/BlurImage.js | |
import Image from 'next/image'; | |
import { useState, useEffect } from 'react'; | |
import cn from 'clsx'; | |
export default function BlurImage(props) { | |
const [isLoading, setLoading] = useState(true); | |
const [src, setSrc] = useState(props.src); | |
useEffect(() => setSrc(props.src), [props.src]); // update the `src` value when the `prop.src` value changes |
This file contains 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
{ | |
"version": 2, | |
"builds": [ | |
{ | |
"src": "./index.py", | |
"use": "@vercel/python" | |
} | |
], | |
"routes": [ | |
{ |
This file contains 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
<script> | |
var question = 1; | |
var query = ''; | |
function formatRuntime(mins) { | |
if (mins == null) { | |
return 'N/A' | |
} else { | |
let h = Math.floor(mins / 60); | |
let m = mins % 60; |
This file contains 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
<body> | |
<center> | |
<h1> | |
<img | |
src="{{ url_for('static',filename='assets/avatar.svg') }}" | |
alt="Moviebot" | |
style="width:40px;height:40px; align:center;" | |
/> Moviebot | |
</h1> | |
</center> |
This file contains 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
{ | |
"dev": { | |
"app_function": "app.app", | |
"profile_name": null, | |
"project_name": "moviebot", | |
"runtime": "python3.6", | |
"s3_bucket": "sugges" | |
}, | |
"production": { | |
"app_function": "app.app", |
NewerOlder