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
#!/bin/bash | |
# Check if a file path is provided | |
if [ "$#" -ne 1 ]; then | |
echo "Usage: $0 <csv_file_path>" | |
exit 1 | |
fi | |
file_path=$1 | |
total_size=0 |
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
package main | |
import ( | |
"bytes" | |
"io" | |
"log" | |
"net/http" | |
"time" | |
) |
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
package main | |
import ( | |
"fmt" | |
) | |
type thing struct { | |
val string | |
} |
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 time | |
from functools import wraps | |
def conditional_decorator(decorator, condition): | |
""" | |
Used to conditionally decorate a function. | |
""" | |
def wrapped_decorator(func): |
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 createObjectFromTypes<T>({types, data}: {types: string[]; data: T[]}) { | |
const sortedData = types.reduce((acc, type) => { | |
const typeData = data.reduce((acc, item) => { | |
if (item.sys.contentType.sys.id === type) { | |
return [...acc, item]; | |
} | |
return acc; | |
}, []); |
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 React, {useState} from 'react'; | |
import ReactDOM from 'react-dom'; | |
import {Button} from '/component/base/Button'; | |
export const Test = ({children, toolTip, ...props}) => { | |
const [toolTipStyle, setToolTipStyle] = useState({ | |
display: 'none', | |
top: 0, | |
left: 0, |
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
def verify_state_input(fields) do | |
required_fields = [:client_id, :provider, :redirect_uri, :sub] | |
# Determine which keys are missing from the state input and add it to our | |
# errors so that we can return exactly what we're missing to the client | |
field_errors = | |
required_fields | |
|> Enum.reduce(%{}, fn required_key, acc -> | |
has_key? = |
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
defmodule ApiWeb.TestController do | |
use ApiWeb, :controller | |
alias Api.OAuth.Github | |
alias ApiWeb.View.TestView | |
# action_fallback(ApiWeb.FallbackController) | |
def callback(conn, %{"code" => code, "state" => _state}) do | |
response = Github.get_token(code) | |
IO.inspect(response) |
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
defmodule Api.OAuth.Github do | |
use OK.Pipe | |
@authorize_url "https://github.com/login/oauth/authorize" | |
@token_url "https://github.com/login/oauth/access_token" | |
@api_url_base "https://api.github.com" | |
@base_url "http://localhost:4000" | |
@client_id System.get_env("GITHUB_CLIENT_ID") | |
@client_secret System.get_env("GITHUB_CLIENT_SECRET") |
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
0xae2154ff601936F76FF23f4d2B0de7e4E0219b53 |
NewerOlder