Skip to content

Instantly share code, notes, and snippets.

Evan Haveman emh

Block or report user

Report or block emh

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am emh on github.
  • I am emh (https://keybase.io/emh) on keybase.
  • I have a public key whose fingerprint is 868F 95FA 4A0F 12D6 D8CF B181 A015 74A0 3833 02F2

To claim this, I am signing this object:

@emh
emh / gist:7441569
Created Nov 13, 2013
I wanted to use a bunch of underscore.string (http://epeli.github.io/underscore.string/) functions as filters in an AngularJS project and rather than writing separate filters for each function I came up with this.
View gist:7441569
/**
* call titleize like:
* {{ expression | _str.'titleize' }}
* call truncate like:
* {{ expression | _str:'truncate':5:'...' }}
* etc.
*/
app.filter('_str', function() {
return function(text, fn) {
var args = Array.prototype.slice.call(arguments, 2);
@emh
emh / gist:329963
Created Mar 12, 2010
Javascript Partials - because I hate seeing HTML embedded in my Javascript code.
View gist:329963
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>javascript partials</title>
<script src="http://code.jquery.com/jquery-1.4.1.min.js" type="text/javascript"></script>
<script>
function createHello() {
var name = $('#name_field').attr('value');
You can’t perform that action at this time.