Skip to content

Instantly share code, notes, and snippets.

View EvanLovely's full-sized avatar

Evan Lovely EvanLovely

View GitHub Profile
@EvanLovely
EvanLovely / get_title_and_url.applescript
Created March 28, 2017 00:26 — forked from vitorgalvao/Get Title and URL.applescript
AppleScript and JavaScript for Automation to get frontmost tab’s url and title of various browsers.
-- AppleScript --
-- This example is meant as a simple starting point to show how to get the information in the simplest available way.
-- Keep in mind that when asking for a `return` after another, only the first one will be output.
-- This method is as good as its JXA counterpart.
-- Google Chrome
tell application "Google Chrome" to return title of active tab of front window
tell application "Google Chrome" to return URL of active tab of front window
-- Google Chrome Canary
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Author</key>
<string></string>
<key>AuthorURL</key>
<string></string>
<key>CanDragToMacroGroup</key>
<true/>
@EvanLovely
EvanLovely / gulpfile.js
Last active September 14, 2016 18:54 — forked from febbraro/-
var jsonFiles = ['*.theme.json'];
// Setup the linting
function lintJson() {
return gulp.src(jsonFiles)
.pipe(jsonlint())
.pipe(jsonlint.reporter());
}
// Add a validate task that will fail on lint error
@EvanLovely
EvanLovely / gulpfile.js
Last active September 14, 2016 18:46 — forked from febbraro/-
function lintJson() {
return gulp.src('*.theme.json')
.pipe(jsonlint())
.pipe(jsonlint.reporter());
}
gulp.task('validate:json', 'Test JSON', function() {
return lintJson().pipe(jsonlint.failAfterError());
});
tasks.validate.push('validate:json');
/// List to String (like JS's `join`)
/// Converts Sass list to string using `$glue` separator.
/// @param {list} $list
/// @param {string} $glue [''] - What join list items with (ex `,`)
/// @param {bool} $is-nested [false]
/// @return {string}
/// @link http://hugogiraudel.com/2013/08/08/advanced-sass-list-functions/ Source
@function to-string($list, $glue: '', $is-nested: false) {
$result: null;
#!/usr/bin/env node
var semver = require('semver');
var requiredVer = require('../package.json').devDependencies['p2-theme-core'];
var installedVer = require('p2-theme-core/package.json').version;
//console.log('requiredVer', requiredVer);
//console.log('installedVer', installedVer);
if (! semver.satisfies(installedVer, requiredVer)) {
console.log('Installed version of "p2-theme-core" is old; updating...');
var exec = require('child_process').execSync;
@EvanLovely
EvanLovely / highlight-code-bookmarklet.js
Last active September 1, 2021 13:49
Syntax highlighting bookmarklet
var colorScheme = 'darkula';
var link = document.createElement('link');
link.setAttribute('rel', 'stylesheet');
link.setAttribute('type', 'text/css');
link.setAttribute('href', '//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.1.0/styles/' + colorScheme + '.min.css');
document.getElementsByTagName('head')[0].appendChild(link);
var script = document.createElement('script');
script.setAttribute('type', 'text/javascript');
<!doctype html>
<html class="no-js" lang="en">
<head>
<title></title>
<meta name="description" content="">
<!-- Mobile viewport optimized: j.mp/bplateviewport -->
<meta name="viewport" content="width=device-width,initial-scale=1">
<!-- Bootstrap: Latest compiled and minified CSS -->
<h1>Using <a href="http://emmet.io">Emmet</a></h1>
<!-- .template>h1.title+.body>p*3 -->
<div class="template">
<h1 class="title"></h1>
<div class="body">
<p></p>
<p></p>
<p></p>
</div>
@EvanLovely
EvanLovely / dependency-version-checker.js
Last active December 29, 2015 20:59
Check if an installed node dependency is up to date; if not: update it.
#!/usr/bin/env node
var semver = require('semver');
var requiredVer = require('../package.json').devDependencies['p2-theme-core'];
var installedVer = require('p2-theme-core/package.json').version;
//console.log('requiredVer', requiredVer);
//console.log('installedVer', installedVer);
if (! semver.satisfies(installedVer, requiredVer)) {
console.log('Installed version of "p2-theme-core" is old; updating...');
var exec = require('child_process').execSync;