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
-- JSON Table | |
WITH json_table AS ( | |
SELECT '{"action": "remove_newsletter_cta_session", "controller": "pages"}'::json AS json_field | |
) | |
-- Return values from JSON column | |
SELECT | |
json_field->>'action' AS action, | |
json_field->>'controller' AS controller | |
FROM json_table |
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
<video src="https://source.here/path/to/video.webm" preload autoplay loop controls></video> |
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 asyncio | |
import aiohttp | |
from bs4 import BeautifulSoup | |
async def get_title(session, url): | |
async with session.get(url) as response: | |
html_source = await response.text() | |
soup = BeautifulSoup(html_source, "html.parser") |
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 pickle | |
dictionary_a = {'string_1': 1, 'string_2': 2.2, 'string_3': True} | |
# Pickling (serializing) dictionary A into a file | |
with open('saved_object.pickle', 'wb') as filename: | |
pickle.dump(dictionary_a, filename) | |
# Unpickling (de-serializing) dictionary A into B | |
with open('saved_object.pickle', 'rb') as filename: |
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
# To test these progress bars you will have to | |
# install the following packages | |
# pipenv install click progress progressbar2 tqdm clint | |
import string | |
# progress bars | |
import time | |
import click | |
from tqdm import tqdm |
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
#!/usr/bin/env ruby | |
require 'colorize' | |
# if ARGV is zero (or no argument given) then default to 6. Else, keep ARGV. | |
length = ARGV[0].to_i.zero? ? 6 : ARGV[0].to_i | |
colors = String.colors | |
colors.delete(:black) | |
def scramble_pass(length) |
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
a_list = ['item1', 'item2', 'item3'] |