Skip to content

Instantly share code, notes, and snippets.

View beporter's full-sized avatar

Brian Porter beporter

View GitHub Profile
@dmdeller
dmdeller / volume-down.scpt
Created August 20, 2011 17:40
PowerMate volume scripts
set myVolume to output volume of (get volume settings)
set myVolume to (myVolume - 2)
set volume output volume myVolume
tell application "PowerMate"
set aDevice to first device
tell aDevice
make light state with properties {state type:steady, brightness:(myVolume / 100), name:"Volume"}
end tell
end tell
@matthiaskern
matthiaskern / feedly_export_saved_for_later.js
Last active June 30, 2017 02:27
Small script to fetch saved for later items from feedly as JSON. Based on https://gist.github.com/bradcrawford/7288411
if(!(window.jQuery)) {
var script = document.createElement("script");
script.setAttribute("src", "https://code.jquery.com/jquery-2.2.1.min.js");
script.setAttribute("type", "text/javascript");
script.onload = logItems;
document.getElementsByTagName("head")[0].appendChild(script);
} else {
logItems();
}
@jmauerhan
jmauerhan / pre-commit.php
Last active July 13, 2018 22:48
A pre-commit hook written in php to fix code style and alert about phpmd rules
#!/usr/bin/php
<?php
require __DIR__ . '/../../vendor/autoload.php';
/**
* Dependencies:
* - Symfony Console Component: symfony/console
* - Symfony Process Component: symfony/process
* - PHP Mess Detector: phpmd/phpmd
@justinyost
justinyost / paging.ctp
Created March 20, 2012 16:05
Paging Element for Twitter Bootstrap and CakePHP 2.0+
<?php $span = isset($span) ? $span : 8; ?>
<?php $page = isset($this->request->params['named']['page']) ? $this->request->params['named']['page'] : 1; ?>
<div class="pagination">
<ul>
<?php echo $this->Paginator->prev(
'&larr; ' . __('Previous'),
array(
'escape' => false,
'tag' => 'li'
),
#!/bin/sh
#
# Usage: git semver-tags [-p|--pre]
#
# Lists semver tags in the repository in order from newest to oldest.
#
# Useful for e.g. programmatically finding the latest release tag:
# `git semver-tags | head -n 1`.
#
# Tag names must be valid according to the SemVer 1.0.0 specification
@richard-scott
richard-scott / 00_description
Created December 13, 2016 10:52 — forked from halberom/00_description
ansible - example of using filters to change each item in a list
The problem:
I wanted to use the jinja 'map' filter to modify each item in a string, in this simple
example, adding '.conf' to each item.
The 'format' filter in jinja takes arguments (value, *args, **kwargs). Unfortunately,
it uses 'value' as the pattern. When called inside map 'value' is the current item in
the list, or in other words *args as far as format is concerned. So it's the wrong way
around.
import sys
import subprocess
import tempfile
import urllib
text = sys.stdin.read()
chart_url_template = ('http://chart.apis.google.com/chart?'
'cht=qr&chs=300x300&chl={data}&chld=H|0')
chart_url = chart_url_template.format(data=urllib.quote(text))
@poke
poke / gw2-item-search.html
Created January 13, 2016 20:44
Guild Wars 2: Item search
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Guild Wars 2: Item search</title>
</head>
<body>
<div id="loader">Loading…</div>
<div id="app" style="display: none;">
@nickwynja
nickwynja / Application.applicationWillSwitchOut.applescript
Created October 10, 2012 21:49 — forked from benspaulding/Application.applicationWillSwitchOut.applescript
AppleScript that will save all documents with unsaved changes when BBEdit loses focus.
(*
File:
Application.applicationWillSwitchOut.scpt
Abstract:
This script will automatically save all on-disk text documents with unsaved
changes when BBEdit loses focus.
Version:
@erikreagan
erikreagan / mac-apps.md
Created August 4, 2012 19:18
Mac developer must-haves

Mac web developer apps

This gist's comment stream is a collection of webdev apps for OS X. Feel free to add links to apps you like, just make sure you add some context to what it does — either from the creator's website or your own thoughts.

— Erik