Skip to content

Instantly share code, notes, and snippets.

Clayton Watts cletusw

Block or report user

Report or block cletusw

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@cletusw
cletusw / Flow.scpt
Created Oct 30, 2015
Change your background at a specific time (Mac OS X). Use `crontab -e` to edit your crontab:
View Flow.scpt
tell application "Finder"
-- wrapped in a try block for error suppression
try
set mainDisplayPicture to "/Users/claytonwatts/Pictures/Flow.jpg"
-- set the picture for additional monitors, if applicable
tell application "System Events"
@cletusw
cletusw / get-old-chromium-binary.md
Last active Jun 20, 2019
Download an old Chromium binary
View get-old-chromium-binary.md

(source)

Taking [denilson-sá's answer][2] further...

You need revision numbers to grab downloads. So first lookup the full version string from the following URL, adjusting parameters as needed:

https://omahaproxy.appspot.com/history.json?channel=stable&os=mac

For Chrome version 28 the full version string is 28.0.1500.71. Now go to https://omahaproxy.appspot.com and enter the full version string ("28.0.1500.71") into the Position Lookup box. Copy the Base Position number ("209842" in this case).

@cletusw
cletusw / git-bisect-run
Last active Aug 13, 2019
git bisect run
View git-bisect-run
Quick git tip: Most of you know (and love) git's "bisect" command, but how many have used "git bisect run"? Specify a shell script/command, and git will automatically run it on each bisect step. If it exits with a 0, the commit is marked "good". Anything else, and the commit is marked "bad".
For example, want to find the cause of a failing test?
git bisect start <failing commit> <passing commit>
git bisect run sh -c '(cd app && grunt test)'
Voila! Git will automatically find the first commit in the given range that fails the tests.
http://git-scm.com/docs/git-bisect#_bisect_run
@cletusw
cletusw / backdrop.html
Created May 21, 2015
Generate a backdrop with a cutout (ie, for highlighting a page element in an app walkthrough)
View backdrop.html
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">
<defs>
<mask id="walkthrough-backdrop-mask">
<rect width="100%" height="100%" x="0" y="0" fill="white"></rect>
<ellipse class="hole" ng-attr-cx="{{cutoutCenterX}}" ng-attr-cy="{{cutoutCenterY}}" ng-attr-rx="{{cutoutRadiusX}}" ng-attr-ry="{{cutoutRadiusY}}" fill="black"></ellipse>
</mask>
</defs>
<rect width="100%" height="100%" x="0" y="0" fill="black" fill-opacity="0.75" mask="url(#walkthrough-backdrop-mask)"></rect>
</svg>
@cletusw
cletusw / downgrade.sh
Created Apr 15, 2015
Convert video to x264 in mp4
View downgrade.sh
ffmpeg -i "$1" -c:v libx264 -preset veryslow -crf 35 -c:a copy "${1:0: -4} low.mp4"
View mostBlamed.sh
git blame --line-porcelain -L 300,319 path/to/file.js | sed -n 's/^author //p' | sort | uniq -c | sort -rn | sed -n '1 p' | sed -n 's/^ *[0-9]* //p'
# Or to see all for an entire directory
git log --pretty=format:"%an" -- path/to/dir/ | sort | uniq -c | sort -rn
@cletusw
cletusw / .eslintrc
Last active Oct 20, 2019
ESLint Reset - A starter .eslintrc file that resets all rules to off and includes a description of what each rule does. From here, enable the rules that you care about by changing the 0 to a 1 or 2. 1 means warning (will not affect exit code) and 2 means error (will affect exit code).
View .eslintrc
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"defaultParams": false, // enable default function parameters
"forOf": false, // enable for-of loops
"generators": false, // enable generators
"objectLiteralComputedProperties": false, // enable computed object literal property names
@cletusw
cletusw / attribute-web-components.txt
Last active Aug 29, 2015
Attribute Web Components (Decorators?)
View attribute-web-components.txt
View live: http://bl.ocks.org/cletusw/64a0e8fda34eba1b8cd1
TODO: Make dynamic (adding or removing the attribute adds or removes the functionality)
View git-step.sh
#!/bin/bash
show_usage () {
echo "Usage: `basename $0` [START [END]]"
echo
echo "Steps through the commit history from START to END,"
echo "then returns to the branch or commit from before execution."
echo
echo "START defaults to the root commit (beginning of history)."
echo "END defaults to current branch/commit."
View designer.html
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-scroll-header-panel/core-scroll-header-panel.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
You can’t perform that action at this time.