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
// ParseFA-Name | |
// FontAwesome Names, first letter alphabetized, hyphens replaced with spaces | |
var awesomeOutput= ""; | |
$(".col-md-4.col-sm-6.col-lg-3").each(function (i, element) { | |
var properName = $(element).text().split("\n")[2].trim(); // takes all text items in element (the FA icon, class name, and unicode value), says "hey I just want [2], the class name,", and trims the extra space | |
properName = properName.replace("fa-", "").replace(/-/g, " "); // since class name is almost the same as the name, this removes the "fa-" prefix and replaces hyphens (-) with spaces ( ) | |
properName = properName.charAt(0).toUpperCase() + properName.substr(1) // capitalizes the first letter of the first word in the name | |
awesomeOutput += ('\n' + properName); // puts each name on its own line |
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
// ParseFA-Class | |
// FontAwesome Class Names | |
var awesomeOutput= ""; | |
$(".col-md-4.col-sm-6.col-lg-3").each(function (i, element) { | |
var className = $(element).text().split("\n")[2].trim(); // takes all text items in element (the FA icon, class name, and unicode value), says "hey I just want [2], the class name,", and trims the extra space | |
awesomeOutput += ('\n' + className); // puts each class name on its own line | |
}); | |
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
// ParseFA-Unicode | |
// FontAwesome Unicode Values | |
var awesomeOutput= ""; | |
$(".col-md-4.col-sm-6.col-lg-3").children(".muted").each(function (i, element) { | |
var unicode = $(element).text(); // grabs text within HTML element | |
unicode = unicode.substring(1,8); // selects only the unicode values (not their enclosing brackets) | |
awesomeOutput += ('\n' + unicode); // puts each unicode value on its own line | |
}); |
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
// Font Awesome Cheatsheet to CSV | |
var awesomeOutput = ""; | |
$(".col-md-4.col-sm-6.col-lg-3").each(function (i, element) { // selects a Font Awesome cheatsheet item | |
// Unicode value (i.e. "") | |
var unicode = $(element).children(".muted").text().substring(1,8); // the unicode value is in a child span element with class "muted", this grabs it and "removes" the surrounding [brackets] | |
// CSS class name (i.e. "fa-youtube-square") |
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
public async Task<(string token, DateTime expirationDate)> GetToken(User user) // syntactic sugar for the ValueTuple type | |
{ | |
var response = await "https://api.website.com/oauth2/token/" // I'm taking some liberties here, this is not totally legit auth code, but it would utlize properties from the User object passed into the method | |
.ReceiveJson<TokenResponse>(); | |
var token = response.access_token.ToString(); | |
var expirationDate = DateTime.Now.AddSeconds(response.expires_in); | |
return (token, expirationDate); // can also express ValueTuple explicitly: return new ValueTuple<string, DateTime>(token, expirationDate); | |
} |
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
FROM public.ecr.aws/lambda/python:3.8 | |
# install dependencies | |
# mdbtools depends on unixODBC-devel and gcc-c++ | |
# we start by enabling the EPEL package repository, which hosts the mdbtools package | |
RUN yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm -y && \ | |
yum update -y && \ | |
yum install -y mdbtools gcc-c++ unixODBC-devel | |
# add the python code to the Docker image |
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
FROM public.ecr.aws/lambda/python:3.8 | |
# install dependencies | |
# mdbtools depends on unixODBC-devel and gcc-c++ | |
# we start by enabling the EPEL package repository, which hosts the mdbtools package | |
RUN yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm -y && \ | |
yum update -y && \ | |
yum install -y mdbtools gcc-c++ unixODBC-devel | |
# add the python code to the Docker image |
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
# convert a table from an accdb file to CSV and upload to an AWS S3 bucket | |
import os, subprocess, urllib.request, requests, zipfile, boto3 | |
from bs4 import BeautifulSoup | |
from lxml import etree | |
def handler(event, context): # we aren't using event or context here, but you probably will in your real-world implementation | |
# cd into Lambda's writable directory (allows up to 512MB of files) | |
os.chdir('/tmp') | |
#todo: download the accdb file from S3 or the Internet |
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
beautifulsoup4==4.9.3 | |
boto3==1.18.30 | |
botocore==1.21.30 | |
bs4==0.0.1 | |
certifi==2021.5.30 | |
charset-normalizer==2.0.4 | |
idna==3.2 | |
jmespath==0.10.0 | |
lxml==4.6.3 | |
numpy==1.21.2 |