Skip to content

Instantly share code, notes, and snippets.

@turadg
turadg / designer.html
Created July 28, 2014 11:26
designer
<link rel="import" href="../chart-js/chart-js.html">
<link rel="import" href="../paper-button/paper-button.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-icons/iconsets/av-icons.html">
<link rel="import" href="../paper-fab/paper-fab.html">
<link rel="import" href="../paper-checkbox/paper-checkbox.html">
<polymer-element name="my-element">
<template>
@turadg
turadg / README.md
Created April 1, 2015 16:01
Retracked draft

Retracked wraps your event recording system in an API optimized for React components.

Usage

Setup

Somewhere early in execution:

# set the recording function
retracked.setup(myTrackingSystem.push);
effuse-hcii-cs-cmu-edu:~ taleahma$ brew install gource
==> Downloading http://pkgconfig.freedesktop.org/releases/pkg-config-0.23.tar.gz
######################################################################## 100.0%
==> ./configure --with-pc-path=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig:/usr/X11/lib/pkgconfig --disable-debug --
==> make install
/usr/local/Cellar/pkg-config/0.23: 7 files, 220K, built in 38 seconds
==> Downloading http://www.libsdl.org/release/SDL-1.2.14.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/sdl/1.2.14 --disable-debug --disable-dependency-tracking --disable-nasm
==> make install
/**
* The router runs this navigate action once a new route is resolved.
* This returns a promise that must be satisfied before the render
* starts. The promise consists of all actions that each handler
* in the route declares that it needs before navigating.
*
* WHEN we upgrade react-router to 1.0, we should revisit this design
* https://github.com/rackt/react-router/pull/1158
*
* @return {Promise} to satisfy all the dependencies of the route
@turadg
turadg / gist:941550
Created April 26, 2011 00:35
Shim for HTML5 number input type
/* Requires:
* Modernizr <http://www.modernizr.com/>
* JQuery Numeric <http://www.texotela.co.uk/code/jquery/numeric/>
*/
// require numeric input even when HTML5 not available
if (!Modernizr.inputtypes.number) {
// no native support for <input type="number">
$("input[type=number]").numeric(false, function() { alert("Integers only"); this.value = ""; this.focus(); });
}
@turadg
turadg / .htaccess
Created September 16, 2011 01:56
Rsync to CMU Andrew publishing and push to publish
RewriteEngine on
# match any directory
RewriteCond %{REQUEST_FILENAME} -d
# redirect somewhere instead of serving it
RewriteRule ^(.*)$ http://www.cs.cmu.edu/~taleahma/ [R,NC,L]

Keybase proof

I hereby claim:

  • I am turadg on github.
  • I am turadg (https://keybase.io/turadg) on keybase.
  • I have a public key whose fingerprint is 1AAF D87D B5DB 6B87 29A5 7646 0249 C9F5 1B7F 02C2

To claim this, I am signing this object:

@turadg
turadg / levenshteinDistanceMixin
Last active December 15, 2015 12:09
Underscore mixin for Levenshtein distance of two strings Adapted from [Levenshtein.coffee](https://raw.github.com/phstc/levenshtein/master/src/Levenshtein.coffee) by @phstc (http://coffeescriptcookbook.com/chapters/strings/matching-strings was broken)
# usage _.levenshteinDistance("PART", "PARTY") or _("PART").levenshteinDistance("PARTY")
_.mixin
levenshtein : (str1, str2) ->
return str2.length if str1.length == 0
distance = []
for i in [0..str1.length]
distance[i] = []
distance[i][0] = i
@turadg
turadg / poltergeist_screenshot_helper.rb
Last active December 15, 2015 20:59
Poltergeist screenshot helper for Rspec
# spec/support/poltergeist_screenshot_helper.rb
module PoltergeistScreenshotHelper
# FROM http://blog.jerodsanto.net/2012/12/capybara-and-poltergeist-snap/
def snap!(options={})
path = options.fetch :path, "~/.Trash"
file = options.fetch :file, "#{Time.now.to_i}.png"
full = options.fetch :full, true
path = File.expand_path path
@turadg
turadg / bluetooth-swap.sh
Last active December 22, 2015 20:59 — forked from hughsaunders/release_bt_keyboard.sh
Script to swap your Bluetooth devices connections between two Macs. Works great with iMacMonitor.app to quickly switch your iMac between being a laptop monitor or full computer. http://bogner.sh/2013/07/os-x-how-to-use-an-imac-as-monitor/
#!/usr/bin/env bash
# This script works after you've paired the Bluetooth devices with
# both the local and remote computer. Turning one off and the other on
# forces the devices to reconnect with the only computer that has BT on.
# Look up local SSH hosts with Bonjour using `dns-sd -B _ssh`
# You may want to set up an SSH keypair to log in without typing a password
REMOTE=Stone.local