Skip to content

Instantly share code, notes, and snippets.

View gmail-to-discord.js
// useful at
// set these to discord webhooks.
const WEBHOOKS = {
SLAB: '',
ASANA: '',
FIGMA: '',
// these searches work great for me. The first does the search logic in
joeybaker / open-in-vi.scrpt
Created Jun 14, 2018
Applescript to use in automator to open a file in Terminal in neovim
View open-in-vi.scrpt
on run {input}
set filename to POSIX path of input
set cmd to "clear;cd $(dirname " & filename & ");nvim " & quoted form of filename & "; exit"
tell application "System Events" to set terminalIsRunning to exists application process "Terminal"
tell application "Terminal"
if terminalIsRunning is true then
set newWnd to do script with command cmd
do script with command cmd in window 1
View gist:d12e9466afd8b2e8db93
On Thu, Jan 29, 2015 at 9:45 AM, <> wrote:
I recently updated to your new snippet, but it violates the Content Security Protocol settings I have in place because it uses `eval`. It there anyway to opt-out of a script that uses `eval`?
On 29 January, 2015 at 12:08:25 PM, John Clover ( wrote:
Hey Joey
joeybaker / strtotitle
Created May 2, 2012
strtotitle – php to title case a string
View strtotitle
# converts a string to title case
# input: string
# output: string in title case
function strtotitle($title) {
$blacklist = array( 'of','a','the','and','an','or','nor','but','is','then','else', 'at','from','by','on','off','for','in','out','over','to','into','with' );
$words = explode(' ', $title);
foreach ($words as $key => $word) {
if ($key == 0 || !in_array($word, $blacklist))
$words[$key] = ucfirst($word);
joeybaker /
Last active Nov 21, 2017
Export from a couch potato database
# print all the titles in the db
strings -a -t x id_stor | pcregrep -M '[a-z0-9]{1,9}\stitles\[\n[a-z0-9]{1,9}\s(.*?)u$' | grep -v 'titles' | cut -d " " -f 2- | sort | uniq | sed 's/u$//' | sed 's/://' | sed 's/\///' > couchpotato_export.txt
# get all current movies
# note: with GNU sed, the `sed -E` should be `sed -r`
ls /Volumes/raid6/Movies | sed 's/ ([0-9][0-9][0-9][0-9])//' | sed -E 's/(.*), The/The \1/' | sort > movie_files.txt
# get the wanted movies
grep -v -f couchpotato_export.txt movie_files.txt
View vim-styled-components-syntax-weirdness
// @flow
// This is a mininmal example, much of the real component is stripped out.
import React, { PureComponent } from 'react'
import { Image, Alert } from 'react-native'
import autobind from 'autobind-decorator'
import styled from 'styled-components/native'
import Form from '../../components/Form/Form.component'
joeybaker /
Last active Jan 16, 2017
plist file to restart SystemUIServer to work around mavericks silliness
curl -o ~/Library/LaunchAgents/restart_systemuiserver.plist \
&& launchctl load ~/Library/LaunchAgents/restart_systemuiserver.plist
View index.js
import setupCSS from './load-css-require.js'
setupCSS(__dirname, (err) => {
if (err) throw err
joeybaker / redux-bugsnag.js
Created Nov 11, 2016
Redux middleware for bugsnag
View redux-bugsnag.js
import requestAnimationFrame from 'fbjs/lib/requestAnimationFrame'
import {get, omit} from 'lodash'
// this is okay b/c we tell webpack to ignore the node version of bugsnag in
// package.json
// "browser": {"bugsnag": false}
import bugsnag from 'bugsnag'
const SEVERITIES = {ERROR: 'error', WARN: 'warning', INFO: 'info'}
const NODE_ENV = process.env.NODE_ENV
const IS_BROWSER = process.browser