Skip to content

Instantly share code, notes, and snippets.

@karlhorky
karlhorky / flash.html
Created November 16, 2014 16:50
Flash Feature Detect
<!doctype html>
<html class="no-flash" lang="en">
<head>
<script>
(function() {
var hasFlash = false;
try {
var fo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
if (fo) {
hasFlash = true;
### Keybase proof
I hereby claim:
* I am karlhorky on github.
* I am kh (https://keybase.io/kh) on keybase.
* I have a public key whose fingerprint is BB07 C14B 0440 2198 CBF0 F518 5B63 9973 080B C112
To claim this, I am signing this object:
@karlhorky
karlhorky / vagrant-port-forwarding.md
Last active November 16, 2017 19:24 — forked from altryne/vagrant-port-forwarding.md
Vagrant Port Forwarding on OS X Yosemite

Vagrant Port Forwarding (8080 -> 80, 8443 -> 443) with pf on OSX Mavericks/Yosemite

This guide is a fork from this gist.

Since Mavericks stopped using the deprecated ipfw (as of Mountain Lion), we'll be using pf to allow port forwarding.

1. Create the anchor file

Create an anchor file under /etc/pf.anchors/com.vagrant with your redirection rule like:

rdr pass on lo0 inet proto tcp from any to any port 80 -&gt; 127.0.0.1 port 8080
<!--
Example 1: Using IF ELSE logic
Works with Outlook (Desktop)?: Yes
Works with Outlook.com?: No
When using IF ELSE logic, Outlook.com will remove content in both conditionals, which is problematic.
-->
<!--[if mso]>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
@karlhorky
karlhorky / SassMeister-input.scss
Created February 24, 2015 10:18
Generated by SassMeister.com.
// ----
// Sass (v3.4.12)
// Compass (v1.0.3)
// ----
.component {
margin-top: 10px;
@at-root .affects-component #{&} {
margin-top: 0;
@karlhorky
karlhorky / README.md
Last active August 29, 2015 14:16
Template Inheritance for Handlebars (thejohnfreeman.com)

Template Inheritance for Handlebars

23 MAR 2012

Archived from http://thejohnfreeman.com/blog/2012/03/23/template-inheritance-for-handlebars.html

Handlebars is a member of the family of "logic-less" template systems born from Mustache. I will not describe the merits of logic-less templates in this post. (If you are unfamiliar with them, then please visit either of the two links at the beginning of this paragraph.) Rather, I want to describe a simple technique for extending Handlebars with template inheritance.

The goal

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@karlhorky
karlhorky / Monokai (Block Cursor Everywhere).tmTheme
Last active December 11, 2015 11:28
Custom Block Cursor Color Scheme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Monokai</string>
<key>settings</key>
<array>
<dict>
<key>name</key>
@karlhorky
karlhorky / autocomplete.controller.js
Last active December 21, 2016 21:39
Directive class extending with ECMAScript 6
class AutocompleteController {
constructor () {
'ngInject';
}
querySearch (query) {
return this.service.search(query);
}
selectedItemChange(item) {
@karlhorky
karlhorky / server.js
Created July 17, 2015 15:01
Simple File Upload with Express
var express = require('express'),
busboy = require('connect-busboy'),
app = express(),
fs = require('fs'),
router = express.Router();
router.get('/', function(req, res) {
res.send('<form action="" method="post" enctype="multipart/form-data"><input type="file" name="displayImage"><input type="submit" name="Upload"></form>');
});