Skip to content

Instantly share code, notes, and snippets.

View brettkelly's full-sized avatar

Brett Kelly brettkelly

View GitHub Profile
@brettkelly
brettkelly / us_state_abbreviations.py
Last active July 13, 2022 21:58 — forked from JeffPaine/us_state_abbreviations.py
A python list of all US state abbreviations.
states = {
'AK': 'Alaska',
'AL': 'Alabama',
'AR': 'Arkansas',
'AZ': 'Arizona',
'CA': 'California',
'CO': 'Colorado',
'CT': 'Connecticut',
'DC': 'District of Columbia',
'DE': 'Delaware',
import React, {useState, useEffect} from "react"
import {useRouter} from 'next/router'
const Event = ({embed}) => {
const router = useRouter()
const [embedSRC, setEmbedSRC] = useState(embed);
// useEffect(() => {
// const handleRouteChange = () => {
// setEmbedSRC(embed)
// }

Using Git to Manage a Live Web Site

Overview

As a freelancer, I build a lot of web sites. That's a lot of code changes to track. Thankfully, a Git-enabled workflow with proper branching makes short work of project tracking. I can easily see development features in branches as well as a snapshot of the sites' production code. A nice addition to that workflow is that ability to use Git to push updates to any of the various sites I work on while committing changes.

Contents

@brettkelly
brettkelly / README.md
Last active February 19, 2021 21:00 — forked from lopspower/README.md
Hexadecimal color code for transparency

Hexadecimal color code for transparency

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

All hex value from 100% to 0% alpha:

  • 100% — FF
<?php
/**
* Get first paragraph from a WordPress post. Use inside the Loop.
*
* @return string
*/
function get_first_paragraph(){
global $post;
$str = wpautop( get_the_content() );
@brettkelly
brettkelly / KindleEvernoteSync.py
Created July 29, 2011 18:22 — forked from jplattel/KindleEvernoteSync.py
Synchronize all your Kindle clippings and notes into Evernote
import os
import time
document = open("My Clippings.txt","r")
data = "".join(document.readlines())
notes = []
try:
clippings = data.split('==========')
for clip in clippings: