Skip to content

Instantly share code, notes, and snippets.

// useful at script.google.com
// set these to discord webhooks.
const WEBHOOKS = {
SLAB: '',
ASANA: '',
FIGMA: '',
GREENHOUSE: ''
}
// these searches work great for me. The first does the search logic in
@joeybaker
joeybaker / open-in-vi.scrpt
Created June 14, 2018 18:32
Applescript to use in automator to open a file in Terminal in neovim
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"
activate
if terminalIsRunning is true then
set newWnd to do script with command cmd
else
do script with command cmd in window 1
On Thu, Jan 29, 2015 at 9:45 AM, <joey@byjoeybaker.com> wrote:
Hello–
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 (john@heapanalytics.com) wrote:
Hey Joey
@joeybaker
joeybaker / react-redux-links.md
Last active March 21, 2018 00:21
React/redux links
@joeybaker
joeybaker / strtotitle
Created May 2, 2012 20:10
strtotitle – php to title case a string
# 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
joeybaker / cp_export.sh
Last active November 21, 2017 00:22
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
// @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
joeybaker / install.sh
Last active January 16, 2017 16:41
plist file to restart SystemUIServer to work around mavericks silliness
curl -o ~/Library/LaunchAgents/restart_systemuiserver.plist https://gist.githubusercontent.com/joeybaker/1d32226d928d05a95860/raw/483d41b06427f524b5df0c4d224fb0e2e8ba14e9/restart_systemuiserver.plist \
&& launchctl load ~/Library/LaunchAgents/restart_systemuiserver.plist
@joeybaker
joeybaker / index.js
Last active November 17, 2016 02:59
css-modules require hook for node. via https://github.com/css-modules/css-modules/issues/13
import setupCSS from './load-css-require.js'
setupCSS(__dirname, (err) => {
if (err) throw err
require('my-front-end-components-that-require-css-files.js')
})
@joeybaker
joeybaker / redux-bugsnag.js
Created November 11, 2016 20:30
Redux middleware for bugsnag
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