Skip to content

Instantly share code, notes, and snippets.

Avatar

Aksel G. Gresvig AGresvig

View GitHub Profile
@AGresvig
AGresvig / JStoUTF8Converter.js
Created Nov 13, 2014
Javascript <-> UTF-8 conversion tool
View JStoUTF8Converter.js
var JStoUTF8Converter = {
encode: function(input) {
var output = '';
for (var i = 0; i < input.length; i++) {
var j = '\b\t\n\v\f\r"\'\\'.indexOf(input.charAt(i));
if (j != -1) {
output += '\\' + 'btnvfr"\'\\'.substr(j, 1);
} else if (input.substr(i, 2) == '</') {
output += '<\\/';
i++;
View post.jsx
var React = require('react');
module.exports = React.createClass({
render: function() {
return (
<div className="post">
<h2 className="postName">
ssdfsdf
{this.props.title}