Skip to content

Instantly share code, notes, and snippets.

View chrisvfritz's full-sized avatar

Chris Fritz chrisvfritz

  • Durham, NC, USA
  • 14:49 (UTC -04:00)
View GitHub Profile
@chrisvfritz
chrisvfritz / test_file.md
Created December 2, 2014 16:50
test description

Test

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

Test

@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);
$ 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'
]
window.$ = (element, propsOrChildren, childrenIfProps) ->
if (propsOrChildren? and propsOrChildren instanceof Array) or not (propsOrChildren instanceof Object)
props = null
children = propsOrChildren
else
props = propsOrChildren
children = childrenIfProps
React.createElement element, props, children
Object.keys(React.DOM).forEach (elementName) ->
@chrisvfritz
chrisvfritz / keybase.md
Created October 13, 2015 15:12
keybase.md

Keybase proof

I hereby claim:

  • I am chrisvfritz on github.
  • I am chrisvfritz (https://keybase.io/chrisvfritz) on keybase.
  • I have a public key whose fingerprint is 6FC1 8F2B 9215 8472 0B80 D5FF AFB9 EFE0 F2BF 46CA

To claim this, I am signing this object:

@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 …
@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);
# 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'
function getPlayers () {
var players = [
{ name: 'Alice', score: 99 },
{ name: 'Billy', score: 83 },
{ name: 'Cindy', score: 91 },
{ name: 'David', score: 96 },
{ name: 'Emily', score: 88 }
]
function randomIndex () {