Skip to content

Instantly share code, notes, and snippets.

echo hello from gist
@quackingduck
quackingduck / js_classes.js
Last active December 20, 2015 02:29
javascript madness __proto__ and prototype and class
// OBJECT PROGRAMMING
avi = {
walk: function() { console.log(this.name + ' is walking') },
name: 'Avi'
}
avi.walk()
avi.lastName = 'Kaufman'
#!/bin/bash
if [ ! -r "/usr/local/git" ] || [ ! -f /usr/bin/git ]; then
echo "Git doesn't appear to be installed via this installer. Aborting"
exit 1
fi
echo "This will uninstall git by removing /usr/local/git/**/*, /etc/paths.d/git, /etc/manpaths.d/git"
printf "Type 'yes' if you sure you wish to continue: "
read response
if [ "$response" == "yes" ]; then
sudo rm -rf /usr/local/git/
@quackingduck
quackingduck / parse_msg.coffee
Created December 20, 2012 02:06
Parse a json encoded hashmap or return an empty one and print a warning
# Parse a json encoded hashmap or return an empty one and print a warning
parseMsg = (jsonStr) ->
try json = JSON.parse jsonStr
catch err then handleParseErr err, jsonStr
json ? {}
handleParseErr = (err, jsonStr) ->
console.error '[WARN]','JSON parser:', err, 'input json was:', jsonStr
@quackingduck
quackingduck / config.ru
Created May 6, 2012 23:23
Rack config for a static site
# A config.ru useful for serving static sites from the "Bamboo" heroku stack.
#
# Interface:
#
# Url Path | Action
# -------- | -------------------------------------------------------------
# / | contents of: index.html OR
# | contents of: 404.html OR
# | default 404 message
# |
#!/usr/bin/env macruby
framework 'AppKit'
module AppDelegate
extend self
def applicationDidFinishLaunching(notification)
voice_type = "com.apple.speech.synthesis.voice.GoodNews"
@voice = NSSpeechSynthesizer.alloc.initWithVoice(voice_type)
@quackingduck
quackingduck / app.rb
Created February 12, 2011 10:55
A one-file MacRuby app
#!/usr/bin/env macruby
framework 'AppKit'
# Inspired by: http://cocoawithlove.com/2010/09/minimalist-cocoa-programming.html
# Inits NSApp
NSApplication.sharedApplication
# Allows an app without an applicaiton bundle or info.plist to still be an app
@quackingduck
quackingduck / div-vs-input.html
Created February 11, 2011 06:31
CSS question
<style>
body {
border-left: 1px solid black; margin-left: 40px; }
div,input {
font-family: sans-serif; font-size: 12px;
margin: 0; padding: 0; outline: 0; border: 0;
display: block; width: 20em;
}

Moral questions for veganism

Hypothetically, you are a vegan with an iPhone.

Your choice to become a vegan was because you determined it to be morally correct.

Your moral evaluation is based primarily on two considerations

  • That factory farming is harming the environment
  • That treating animals inhumanely is, well, inhumane