Skip to content

Instantly share code, notes, and snippets.

View chrisvfritz's full-sized avatar

Chris Fritz chrisvfritz

  • Durham, NC, USA
  • 21:02 (UTC -04:00)
View GitHub Profile
$ Jumbotron, style: styles.welcome.base, [
$h2 'this is a catchy tagline'
$p 'here is a short mission statement, expanding on the tagline'
$hr()
$a href: '/demo', [
$ Button,
bsStyle: 'primary'
bsSize: 'large'
'Try the demo'
]
@chrisvfritz
chrisvfritz / improved-createElement-interface.js
Last active August 29, 2015 14:23
An improved interface to React.DOM elements and React.createElement
window.$ = function(element, propsOrChildren, childrenIfProps){
var props, children;
if ((propsOrChildren != null && propsOrChildren instanceof Array) || !(propsOrChildren instanceof Object)) {
props = null;
children = propsOrChildren;
} else {
props = propsOrChildren;
children = childrenIfProps;
}
return React.createElement(element, props, children);
# Since React has made jQuery obsolete for me, I use $ to replace JSX.
window.$ = React.create-element
for key, value of React.DOM
window."$#key" = value
# And here's an example of a render function using this syntax.
render: ->
$ Jumbotron, style: styles.welcome.base, [
$h2 key: \tagline, 'this is a catchy tagline'
$p key: \mission, 'here is a short mission statement, expanding on the tagline'
@chrisvfritz
chrisvfritz / test_file.md
Created December 2, 2014 16:55
test description

Test

@chrisvfritz
chrisvfritz / test_file.md
Created December 2, 2014 16:50
test description

Test

@chrisvfritz
chrisvfritz / index.html
Created November 18, 2014 19:22
Simplest possible HTML template
<!doctype html>
<html>
<head>
<title>This is the title of the webpage!</title>
</head>
<body>
<p>This is an example paragraph. Anything in the <strong>body</strong> tag will appear on the page, just like this <strong>p</strong> tag and its contents.</p>
</body>
</html>
@chrisvfritz
chrisvfritz / docverter_error_20130918.html
Created September 18, 2013 23:36
Docverter error while trying to convert from Markdown to MOBI
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>RuntimeError at &#x2F;convert</title>
<script type="text/javascript">
//<!--
function toggle(id) {
var pre = document.getElementById("pre-" + id);
@chrisvfritz
chrisvfritz / simple_trending_example.rb
Last active December 22, 2015 06:39
This is an example implementation of a really simple algorithm in Ruby to identify trending words and phrases in a collection of posts. This was written in a single sitting, late at night, without research, so it's definitely not the most efficient way to tackle this problem. I haven't even tested it with real data to make sure that it works as …