Skip to content

Instantly share code, notes, and snippets.

View cdeutsch's full-sized avatar
👨‍🏭
Hire me! Fullstack Engineer open to new developer or manager opportunities.

C Deutsch cdeutsch

👨‍🏭
Hire me! Fullstack Engineer open to new developer or manager opportunities.
View GitHub Profile
@cdeutsch
cdeutsch / toggle.scpt
Created January 19, 2018 23:01
Toggle iTerm FocusFollowsMouse
activate application "iTerm"
tell application "System Events" to tell application process "iTerm2"
-- open the preferences or bring to front (window 1)
keystroke "," using {command down}
delay 0.1
-- Change to the General tab
click button "Pointer" of toolbar 1 of window 1
delay 0.1
@cdeutsch
cdeutsch / gist:a5e5b6ad6c2e5007da1a1d4b8e69893d
Created January 24, 2018 16:07
Mute Discord using AppleScript
tell application "Discord" to activate
tell application "System Events"
-- requires that you create a keyboard shortcut for cmd+shift+m
keystroke "m" using {command down, shift down}
keystroke tab using {command down}
end tell
@cdeutsch
cdeutsch / toggle.scpt
Created March 22, 2018 17:51
Toggle mute on Discord with Apple Script
-- requires that "cmd+shift+m" is the keyboard shortcut for mute
on run
tell application "Discord" to activate
tell application "System Events"
-- toggle mute
keystroke "m" using {command down, shift down}
-- cmd+tab back to previous application
keystroke tab using {command down}
end tell
end run
@cdeutsch
cdeutsch / addDevMiddlewares.ts
Created April 9, 2018 14:24
Typescript Webpack, Node Server backend
import { Express } from 'express';
import path from 'path';
import webpack from 'webpack';
import webpackDevMiddleware from 'webpack-dev-middleware';
const webpackConfig = require('../../../frontend/webpack/webpack.dev.config');
export function addDevMiddlewares(app: Express) {
const compiler = webpack(webpackConfig);
const middleware = webpackDevMiddleware(compiler, {
@cdeutsch
cdeutsch / gist:e1700dc128364e589e7781516f0ed4d1
Created April 10, 2018 16:15
Select words in JSON and CSS using `cmd+D` in VSCode the way God intended
// This will comment out any lines that begin with wordPattern in jsonMain.js and cssMain.js
// jsonMain.js and cssMain.js moved to these locations in VSCode 1.22.1
sed -i -e "s/wordPattern/\/\/wordPattern/g" /Applications/Visual\ Studio\ Code.app/Contents/Resources/app/extensions/json-language-features/client/out/jsonMain.js
sed -i -e "s/wordPattern/\/\/wordPattern/g" /Applications/Visual\ Studio\ Code.app/Contents/Resources/app/extensions/css-language-features/client/out/cssMain.js
@cdeutsch
cdeutsch / toggle.scpt
Created April 12, 2018 20:18
Toggle Play Pause in Google Chrome using AppleScript
if application "Google Chrome" is running then
tell application "Google Chrome"
activate
repeat with w in (windows)
set j to 0
repeat with t in (tabs of w)
set j to j + 1
tell t
if URL starts with "http://www.youtube.com/watch" or URL starts with "https://www.youtube.com/watch" then
set (active tab index of w) to j
@cdeutsch
cdeutsch / webpack.config.js
Last active March 26, 2019 12:57
Caching Webpack v4 css-loader CSS Modules with LESS
module: {
rules: [
{
test: /\.less$/,
use: [
...(process.env.NODE_ENV === 'production'
? [
{
loader: MiniCssExtractPlugin.loader,
},
@cdeutsch
cdeutsch / .gitconfig
Last active May 1, 2018 21:09
My Git aliases
[alias]
# short hand
co = checkout
br = branch
# short hand with some flags
st = status -sb
# reset all files
nuke = reset --hard HEAD
@cdeutsch
cdeutsch / index.js
Created May 11, 2018 19:37
Amazon AWS IOT Button to IFTTT Webhook
/**
* This is a sample that connects Lambda with IFTTT Maker channel. The event is
* sent in this format: <serialNumber>-<clickType>.
*
* The following JSON template shows what is sent as the payload:
{
"serialNumber": "GXXXXXXXXXXXXXXXXX",
"batteryVoltage": "xxmV",
"clickType": "SINGLE" | "DOUBLE" | "LONG"
}
@cdeutsch
cdeutsch / index.js
Created May 11, 2018 19:51
Amazon AWS IOT Button to Webhook POST
const https = require('https');
const querystring = require('querystring');
exports.handler = (event, context, callback) => {
console.log('Received event:', event);
const postData = querystring.stringify({});
const options = {
hostname: 'my-glitch.glitch.me',