Skip to content

Instantly share code, notes, and snippets.

View cdl's full-sized avatar

Colby Ludwig cdl

View GitHub Profile
diff --git a/pages/api/posts/create.js b/pages/api/posts/create.js
index e45df89..f995100 100644
--- a/pages/api/posts/create.js
+++ b/pages/api/posts/create.js
@@ -27,7 +27,7 @@ const handlePOST = async (req, res) => {
const user = await getUserFromJWT(token);
// Otherwise, post passes validations, let's create it.
- const post = await createPost({ title, content, authorId: user.id ?? null });
+ const post = await createPost({ title, content, authorId: user?.id ?? null });
@cdl
cdl / no-reddit.sh
Created July 4, 2015 01:31
Block all of Reddit via your /etc/hosts file.
# Simply curl -s this and pipe it into sh.
# This script uses root privileges, be careful!
# Appends a list of known Reddit subdomains to your /etc/hosts file, and points them to localhost.
# Should work totally fine, but I take no responsibility if it messes up your machine.
# Made by Colby Ludwig (twitter.com/cdl)
sudo bash -c "echo -e '\n\n# -- Block all of Reddit --\n127.0.0.1\t\treddit.com\n127.0.0.1\t\twww.reddit.com\n127.0.0.1\t\tnp.reddit.com\n127.0.0.1\t\tssl.reddit.com\n127.0.0.1\t\tblog.reddit.com\n127.0.0.1\t\tfr.reddit.com\n127.0.0.1\t\tpay.reddit.com\n127.0.0.1\t\tes.reddit.com\n127.0.0.1\t\ten-us.reddit.com\n127.0.0.1\t\ten.reddit.com\n127.0.0.1\t\tru.reddit.com\n127.0.0.1\t\tus.reddit.com\n127.0.0.1\t\tde.reddit.com\n127.0.0.1\t\tdd.reddit.com\n127.0.0.1\t\tno.reddit.com\n127.0.0.1\t\tpt.reddit.com\n127.0.0.1\t\tww.reddit.com\n127.0.0.1\t\tss.reddit.com\n127.0.0.1\t\t4x.reddit.com\n127.0.0.1\t\tsv.reddit.com\n127.0.0.1\t\tnl.reddit.com\n127.0.0.1\t\thw.reddit.com\n127.0.0.1\t\thr.reddit.com

Keybase proof

I hereby claim:

  • I am cdl on github.
  • I am cdl (https://keybase.io/cdl) on keybase.
  • I have a public key ASCLF_K6HEhtIP0yJY306U6XZ1fghbfwZq9KHZPcOdIYGgo

To claim this, I am signing this object:

{
"dependencies": {
"com.unity.collab-proxy": "1.2.16",
"com.unity.ide.rider": "1.1.4",
"com.unity.ide.vscode": "1.2.0",
"com.unity.test-framework": "1.1.13",
"com.unity.textmeshpro": "2.0.1",
"com.unity.timeline": "1.2.14",
"com.unity.ugui": "1.0.0",
"com.unity.modules.ai": "1.0.0",
@cdl
cdl / music.txt
Last active January 31, 2019 02:04
Obelisk Film Festival music list
# Obelisk Film Festival
### Music for the Obelisk Film Festival to play during interludes/breaks/entrance.
Title
Artist - Album
* * * * * * * *
You've Got Something
The Jungle Giants - She's a Riot
http://audiocontentdownload.apple.com/lp10_ms3_content_2016/MAContent10_AssetPack_0375_EXS_GuitarsVintageStrat.pkg
http://audiocontentdownload.apple.com/lp10_ms3_content_2016/MAContent10_AssetPack_0597_LTPChordTrainer.pkg
http://audiocontentdownload.apple.com/lp10_ms3_content_2016/MAContent10_AssetPack_0509_EXS_StringsEnsemble.pkg
http://audiocontentdownload.apple.com/lp10_ms3_content_2016/MAContent10_AssetPack_0484_EXS_OrchWoodwindClarinetSolo.pkg
http://audiocontentdownload.apple.com/lp10_ms3_content_2016/MAContent10_AssetPack_0554_AppleLoopsDiscoFunk2.pkg
http://audiocontentdownload.apple.com/lp10_ms3_content_2016/MAContent10_AssetPack_0375_EXS_GuitarsVintageStrat.pkg
http://audiocontentdownload.apple.com/lp10_ms3_content_2016/MAContent10_AssetPack_0597_LTPChordTrainer.pkg
http://audiocontentdownload.apple.com/lp10_ms3_content_2016/MAContent10_AssetPack_0509_EXS_StringsEnsemble.pkg
http://audiocontentdownload.apple.com/lp10_ms3_content_2016/MAContent10_AssetPack_0484_EXS_OrchWoodwindClarinetSolo.pkg
http://audiocontentdownload.apple.com/lp10_ms3_content_2016/MAContent10_AssetPack_0554_AppleLoopsDiscoFunk2.pkg
pyenv install 2.7.13
pyenv shell 2.7.13
pip install twisted
brew tap cartr/qt4
brew tap-pin cartr/qt4
brew install qt
brew install pyside
mkdir -p /Users/colby/.local/lib/python2.7/site-packages
echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> /Users/colby/.local/lib/python2.7/site-packages/homebrew.pth
@cdl
cdl / mashable.js
Created September 19, 2013 14:57
Reverse engineering the Mashable Velocity graph. Pasting their JS here for archival purposes.
function google_ad_request_done(t) {
var e, n = "";
if (0 !== t.length) {
if ("flash" == t[0].type) n += '<a href="' + google_info.feedback_url + '">Ads by Google</a><br>' + '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="' + google_ad.image_width + '" HEIGHT="' + google_ad.image_height + '"> <PARAM NAME="movie" VALUE="' + google_ad.image_url + '">' + '<PARAM NAME="quality" VALUE="high">' + '<PARAM NAME="AllowScriptAccess" VALUE="never">' + '<EMBED src="' + google_ad.image_url + '" WIDTH="' + google_ad.image_width + '" HEIGHT="' + google_ad.image_height + '" TYPE="application/x-shockwave-flash"' + ' AllowScriptAccess="never" ' + ' PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>';
else if ("image" == t[0].type) n += '<a href="' + google_info.feedback_url + '">Ads by Google</a><br> <a href="' + t[0].url + '" target="_top" title="go to ' + t[
@cdl
cdl / Vagrantfile
Last active August 21, 2016 21:39
Ruby & PostgreSQL Vagrantfile. Constants at the top are meant to be configured on a per-project basis, with defaults that are explained in comments above each of them.
# Ruby + PostgreSQL Vagrantfile
# Written by Colby Ludwig, @cdl
# Vagrantfile for setting up a base Ruby + PostgreSQL environment on
# Ubuntu 14.04 with the latest deps. Sets up the following:
# - rbenv for installing Ruby with the default `vagrant` user
# - shares the current directory for the project to ~/{dir-name}
# - sets up Postgres with a given database name and password (user is `postgres`)
# - forwards given ports
#