Skip to content

Instantly share code, notes, and snippets.

View EvanLovely's full-sized avatar

Evan Lovely EvanLovely

View GitHub Profile
@EvanLovely
EvanLovely / responsiveImgToBg.js
Created July 29, 2015 17:28
Turn responsive img tags to background images
/**
* Background Image Helper
*/
Drupal.behaviors.imgToBG = {
attach: function (context) {
var $wrapper = $('.js-turn-img-to-bg', context);
var debounceDelay = 300;
(function imgToBG() {
@EvanLovely
EvanLovely / imgToBg.js
Created July 29, 2015 17:28
Turn img tags to background images
$('.js-bg-to-img').each(function () {
$(this).find('img').each(function () {
var $img = $(this);
var src = '';
var $wrapMe;
src = $img.attr('src');
$wrapMe = $img;
if (src.length) {
// we have a value
@EvanLovely
EvanLovely / SassMeister-input.scss
Created April 10, 2015 18:52
Generated by SassMeister.com.
// ----
// Sass (v3.3.14)
// Compass (v1.0.1)
// ----
.block {
background: gray;
&s & {
width: 20%;
}
@EvanLovely
EvanLovely / git-top-authors.sh
Created March 27, 2015 21:54
Show a list of the top authors of all the files in a folder, according to `git blame`.
#!/bin/bash
DIR="$1"
IFS=$'\n'
cd "$DIR"
LIST=""
for i in $(find . -iname "*.scss"); do
LIST="`git blame --line-porcelain "$i" | grep 'author ' | sed "s,author,," | tr -d ' '`
$LIST"

Event Name:

Location:

Date:


Talk topic:

-- Quite a lot modified to input text into a plain text file like used by taskpaper. Originally based somewhere back in time on Efficient Computing's AppleScript: http://efficientcomputing.commons.gc.cuny.edu/2012/03/17/copy-email-message-in-mail-app-to-evernote-applescript/
tell application "Mail"
--get selected messages
set theSelection to selection
--loop through all selected messages
repeat with theMessage in theSelection
--get information from message
set theMessageDate to the date received of theMessage
@EvanLovely
EvanLovely / how_many_files_with_extension.sh
Last active April 8, 2018 10:24
bash function: find how many of a file type are here
# find how many of a file type are here
howmany () {
find . -name "*.$1" | wc -l
}
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -dump | grep -B6 bindings:.*:
cd ~/active-project/site_root && git log --abbrev-commit --date=relative -1
ps xro %cpu=,comm= | while read cpu comm; ((i++<5)); do
int=$cpu
int="${int%%.*}"
if (($int >= 50)); then color=$'\e[31m';
elif (($int >= 25)); then color=$'\e[33m';
else color=$'\e[32m';
fi;
echo "$color$cpu% $(basename "$comm")"$'\e[0m'"";