Skip to content

Instantly share code, notes, and snippets.

View brettkelly's full-sized avatar

Brett Kelly brettkelly

View GitHub Profile
@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
@brettkelly
brettkelly / pethemes.csv
Last active April 2, 2020 00:52
PE theme list
Site Theme Version
https://montoursolar.com ronneby_child 1.0.0
https://patternenergynewmexico.com Divi 4.0.11
https://crystalriversolar.com ronneby_child 1.0.0
https://heritageprairierenewable.com dfd-ronneby 3.2.0
http://cmw.patternmicro.site ronneby_child 1.0.0
http://crs.pattermicro.site ronneby_child 1.0.0
https://oldjacksonsolartexas.com dfd-ronneby 3.2.0
https://southerncrosstransmission.com ronneby_child 1.0.0
http://hickory.patternmicro.site dfd-ronneby 3.2.0
This is a another test.
@brettkelly
brettkelly / grayblur.sh
Created February 12, 2020 22:16
Grayscale and blur an image
#!/bin/bash
filename=$(basename -- "$1")
extension="${filename##*.}"
plain="${filename%.*}";
newfile="${plain}.blurred.${extension}";
convert ${filename} -blur 0x4 -set colorspace Gray -separate -average ${newfile}
# One-liner to download the thumbnail for a Vimeo video.
wget $( curl -s http://vimeo.com/api/oembed.json?url='https://vimeo.com/235215203' | python -c "import sys,json; print json.load(sys.stdin)['thumbnail_url']" )
Coffee coffee = new Coffee();
if(coffee.Empty) {
coffee.Refill();
}
coffee.Drink();
@brettkelly
brettkelly / BufferClipboardUrl.py
Created February 19, 2014 04:48
Creates a Buffer-friendly "Title :: URL"-formatted post using the URL in the clipboard, then sends the whole mess to Buffer. This is meant for use with Pythonista on iOS
#!/usr/bin/env python
# Coded poorly by Brett Kelly
# http://nerdgap.com
# @inkedmn
# -*- coding: utf-8 -*-
import urllib2
import urllib
import re
property targetDir : "/Users/bkelly/Dropbox/Notes/"
property editorApp : "/Applications/Byword.app"
on getNewFileName()
set fileName to (text returned of (display dialog "Enter the filename with extension" default answer "Untitled-1.md"))
return fileName
end getNewFileName
tell application "Byword"
set fname to my getNewFileName()
<?php
function get_two_paragraphs(){
global $post;
$str = wpautop( get_the_content() );
$psToGrab = 2; // number of paragraphs to get
$maxFirstParaLength = 200; // character max in first paragraph
$matches = array(); // matching elements will go here
$pattern = '%<p[^>]*>(.*?)</p>%i'; // match what's between all <p> tags
preg_match_all($pattern, $str, $matches); // do the regex match
<?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() );