Skip to content

Instantly share code, notes, and snippets.

View gmail-to-discord.js
// 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
View gist:d12e9466afd8b2e8db93
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 / 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"
activate
if terminalIsRunning is true then
set newWnd to do script with command cmd
else
do script with command cmd in window 1
View react-redux-links.md
@joeybaker
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
joeybaker / cp_export.sh
Last active Nov 21, 2017
Export from a couch potato database
View cp_export.sh
# 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
joeybaker / install.sh
Last active Jan 16, 2017
plist file to restart SystemUIServer to work around mavericks silliness
View install.sh
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
View index.js
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 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
You can’t perform that action at this time.