Skip to content

Instantly share code, notes, and snippets.

@karlhorky
karlhorky / angular-throttle.coffee
Created April 4, 2014 09:36
throttle through an AngularJS service. based on https://gist.github.com/mrgamer/6139485
angular.module("app").factory "throttle", [
"$timeout"
($timeout) ->
return (delay, no_trailing, callback, debounce_mode) ->
timeout_id = undefined
last_exec = 0
if typeof no_trailing isnt "boolean"
debounce_mode = callback
callback = no_trailing
@karlhorky
karlhorky / .extra
Last active August 29, 2015 14:05
Add line disabling atomic_save if not found in Sublime Text preferences. Fixes ST3 with Vagrant + NFS http://serverfault.com/questions/534507/vagrant-nfs-share-doesnt-show-updated-file-if-size-doesnt-change
# Fixes Sublime Text 3 issue with Vagrant and NFS http://serverfault.com/questions/534507/vagrant-nfs-share-doesnt-show-updated-file-if-size-doesnt-change
SUBLIME_PREFS="$HOME/Library/Application Support/Sublime Text 3/Packages/User/Preferences.sublime-settings"
if ! grep -q atomic_save "$SUBLIME_PREFS"; then
perl -ni -e 'print;if ($.==1) {print " \"atomic_save\": false,\n"}' "$SUBLIME_PREFS"
fi
unset SUBLIME_PREFS
from selenium.common.exceptions import NoSuchElementException, TimeoutException
class DomHelper(object):
driver = None
waiter = None
def open_page(self, url):
self.driver.get(url)
@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:
<!--
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 / variables.json
Created July 27, 2015 12:34
Dynamic JSON Schema Defaults
{
"title": "root",
"type": "object",
"definitions": {
"emailShareSubject": {
"type": "string",
"description": "Email share subject",
"minLength": 4
},
"emailShareSubjectCREDIT": {